Fisheye Stereo Rectification and Disparity

asked 2018-09-19 03:27:04 -0500

updated 2018-09-19 06:18:36 -0500

Good day, I am trying for stereo calibration and rectification. After that I will create disparity map. For stereo calibration and rectification, I used this code:

In my code, I took the parameters and used fisheye::initUndistortRectifyMap and remap for rectification. However, I can't even see the %2 of the image. I don't where is wrong. The images are:



And after rectification, the result:


The exact code I am using is in this repo, and will be update for sure:

My repository

I am thinking that in function initUndistortRectifyMap, I use somehing wrong. Actually it is easy, I give K and D, R and P, which means camera matrix, distortion coefs, rectification and projection. After that it should solve it. when I don't give R and P, I give identity for R and camera matrix for P. In this way, at least I get some result. The result can be seen in here:

Better image

Thanks for the help. I can give any info. You can find calibration results in the repo also. Every file you need is in the repo and ready. You can do the calibration with the repo link in the above also. Thanks in advance.

Edit: Dataset link ->

edit retag flag offensive close merge delete


@yeser their is something wrong with your extrinsic and intrinsic parameters. What is the FOV of your fisheye image? Try to fix k2,k3,k4. I think you have larger FOV hence your facing this problem.

ak1 gravatar imageak1 ( 2018-09-19 05:36:31 -0500 )edit

Thank you for the comment. FOV is 170 degrees. I calibrated as you say, with fixes. Black screen is coming on rectification unfortunately. I am so new to these things, so I don't know fov effects or not. I didn't add the result because everything is black, left/right images(rectified).

yeser gravatar imageyeser ( 2018-09-19 05:50:26 -0500 )edit

How many stereo pairs you are using for calibration ? Actually opencv fisheye module can calibrate fisheye image around 160 degree accurately but I have calibrated lens with 184 degree Fov using this module only and the result was very good. I have given 67 stereo pairs. Can you try to calibrate full frame fisheye image instead of circular fisheye? Can you upload your calibration database and mention link here?

ak1 gravatar imageak1 ( 2018-09-19 05:59:34 -0500 )edit

38 pairs. I am using full frame fisheye I think, as you can see from the dataset: I can add more images but I think there are some "calibration parameters or code" mistakes because with 38 pairs I should've see something at least . I couldn't upload all of the images unfortunately, because of google drive. Hope it can give some infos to you. Thanks

yeser gravatar imageyeser ( 2018-09-19 06:11:48 -0500 )edit

Okay. I think you should try to take dataset properly. You chess board should cover all the regions in fov. Try to take images chessborad very close to camera. Try to give more skew.

ak1 gravatar imageak1 ( 2018-09-19 06:20:29 -0500 )edit

and try to image at different ranges, like very close , normal, very far. Also take images at edges. Hope so this should solves your problem. If not then try omnidir package. Anyways you need to take dataset properly.

ak1 gravatar imageak1 ( 2018-09-19 06:23:44 -0500 )edit

I will upload new image dataset. No matter what it gives black screen. I took pictures far away to close, from edges to center. No idea how to improve it. Thanks for the advices. Is there any good resource to understand(less math) this thing? I am new about this and opencv docs are sooooooo bad unfortunately.

yeser gravatar imageyeser ( 2018-09-19 07:10:44 -0500 )edit

Check calibration lecture from computer vision fundamentals by Dr. Mubarak Shah

ak1 gravatar imageak1 ( 2018-09-19 07:13:15 -0500 )edit

My new dataset:

to stereoCalibrate, I used every flag and fix_K* parameters, every combination. Non of them work. No one knows why?

yeser gravatar imageyeser ( 2018-09-21 03:35:05 -0500 )edit