Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stereo Rectification of two different cameras in OpenCv

Tags:

opencv

I have the stereo calibration parameters of two different cameras (different resolutions). I want to use this data for stereo rectification and calculating the disparity map. The problem is that the images from the two cameras have different sizes and I don't know how to specify these sizes. cvStereoRectify takes only a single size, assuming that both the images are of the same size.

Any suggestion in this regard will be highly appreciated.

Regards,

Khan

like image 499
user846400 Avatar asked Jul 15 '11 12:07

user846400


1 Answers

Have you tried using a region of interest on the higher resolution camera? For example, say you have a 640x480 camera and an 800x600 camera. You might 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 that's helpful!

like image 104
mevatron Avatar answered Nov 15 '22 07:11

mevatron