Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image Rectification [closed]


I need to implement image rectification .Problem is given image of object from four viewpoints(topL,topR,bottomL,bottomR)I need to do pairwise rectification .I tried some code in OpenCV but havent been able to make progress .Can someone tell me a good way(source code /tutorial) to execute the rectification? I need to use C/C++/OpenCV.

http://portal.acm.org/citation.cfm?id=1833349.1778777

like image 602
Manish Avatar asked Nov 28 '22 06:11

Manish


1 Answers

This is an extremely broad question, here is a general outline of one way you could do it...

  • Find strong features or corners on both images using cvGoodFeaturesToTrack()

  • Pass the features you found into cvFindCornerSubPix() to get more precise floating point representations of the locations of strong features

  • Calculate the optical flow between the two images using the sub-pixel features from the last step using cvCalcOpticalFlowPyrLK or another optical flow function. (I like cvCalcOpticalFlowPyrLK())

This is where it gets tricky... in order to rectify images it helps to have some knowledge about the intrinsic camera properites (field of view, focal length) especially if you are planning to do some kind of 3d reconstruction or compute disparity correspondence. Since you didn't mention anything about a calibrated camera set up I will continue on the uncalibrated algorithm.

  • You will need to find the Fundamental Matrix which encodes all aspects of the scene used to compute a rectification matrix. Use cvFindFundamentalMatrix() to do this.

  • Armed with the Fundamental Matrix you must now find the Homography Matrix, which will map both images to the same plane. Use cvStereoRectifyUncalibrated() to do this. Although the name would suggest that it is rectifying your images it is NOT, it just returns homography matrices that you can USE to rectify your images.

  • Finally, using the Homography matrices from the last step you can rectify both images by calling cvInitUndistortRectifyMap() to get a remap matrix and then pass that into cvRemap() to do the actual remapping.

I must warn you that there are many parameters that go into each of these library calls and you will have to manipulate many matrices and many images, not to mention without the intrinsic camera calibration details you will have to make many assumptions that could drastically affect your results... It is no easy task.


I would recommend buying and/or reading Learning OpenCV if you want to learn more, it is far beyond the scope of a short paragraph on stackoverflow to expect to learn all of this :)

like image 88
tbridge Avatar answered Feb 15 '23 02:02

tbridge