Stereo Camera Calibration

Posted: April 25, 2012 in C/C++, OpenCV, Programming
Tags: , , , ,

I am planning to do 3D object reconstruction using stereo camera so first i need to do stereo calibration on my 3D camera.

The stereo camera i am using is Fujifilm w3 3D Camera. This camera produces MPO file image which is JPG in stereo format. For pre processing of course it is need to be converted into pair of images which can be read by OpenCV by using Stereo Photomarker (SPM) (

One thing you should notice when using this SPM when converting .MPO into pair of JPG images is to reset the automatic alignment (press “Home” to reset the alignment).  SPM automatically aligns the .MPO image so it can be viewed better when you use 3D glasses, but this alignment will crop the images. I don’t want this cropped images since resulted images won’t have the same size and it’s disaster.

The stereo calibration code can be read on here:

if it is success you can get xml calibration file similar to this:

<?xml version="1.0"?>
<Q type_id="opencv-matrix">
    1. 0. 0. -2.8327271270751953e+002 0. 1. 0. -1.5946473121643066e+002
    0. 0. 0. 1.0546290540664800e+003 0. 0. -2.3597727835463600e-001

At first i use chess pattern with 9×6 inner corners, 11 pairs of image, 1024×768 in size. And the result is really bad distortion, as you can see in corners of the image below

Then i figure out i need to use larger chess pattern and more pair of image. Then i use 15×8 inner corners, 26 pairs of image, and 1024×768 resolution. The rectified result looks better

  1. azam says:

    hi azer..
    can you provide me the step to compile the code at martin’s blog. i am new to this…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s