Stereo fix two different cameras in OpenCv

I have stereo calibration options for two different cameras (different resolutions). I want to use this data for stereo rectification and calculation of the map of non-conformities. The problem is that the images from the two cameras have different sizes, and I do not know how to specify these sizes. cvStereoRectify accepts only one size, assuming that both images are the same size.

Any suggestion in this regard would be greatly appreciated.

Hi,

Khan

+6
source share
2 answers

Have you tried to use a region of interest on a higher resolution camera? For example, let's say you have a 640x480 camera and a 800x600 camera. You can do the following:

VideoCapture videoLo(LOW), videoHi(HIGH); Mat loRes, hiRes; Point hiCenter(hiRes.size().width / 2, hiRes.size().height / 2); int key = 0; do { videoLo >> loRes; videoHi >> hiRes; // this will give you the center 640x480 of the high res image. Mat hiResWin(hiRes, Rect(hiCenter.x - loRes.size().width / 2, hiCenter.y - loRes.size().height / 2, loRes.size().width, loRes.size().height)); key = waitKey(33); } while((char)key != 27); 

Hope this is helpful!

+1
source

I ran into the same issue when I was performing stereo calibration. It can be solved by setting image size options

  captureR = cvCreateCameraCapture( 0 ); // from camera 1 cvSetCaptureProperty(captureR, CV_CAP_PROP_FRAME_WIDTH, 640); cvSetCaptureProperty(captureR, CV_CAP_PROP_FRAME_HEIGHT, 480); if(!captureR) { printf("\nCouldn't open the camera1\n"); return -1;} captureL = cvCreateCameraCapture( 1 ); //from camera 2 cvSetCaptureProperty(captureL, CV_CAP_PROP_FRAME_WIDTH, 640); cvSetCaptureProperty(captureL, CV_CAP_PROP_FRAME_HEIGHT, 480); if(!captureL) { printf("\nCouldn't open the camera2\n"); return -1;} 
+1
source

Source: https://habr.com/ru/post/892830/


All Articles