Monday, October 10, 2011

7

STEREO VISION: 3D RECONSTRUCTION ERROR

Today I would like to publish the answer to another question in the comments of a previous post that might be worth its own post:

Hi Martin,

You gave such an informative article. Good Job Martin:-)

I'll explain steps that I performed in calculating distance of object.

1. Calibrated stereo camera with chessboard 8x6 cm with 2.8cm square size.

2. My calibration was success with rms error 0.206 and rectified images was good.

3. I found my interest point on left-right image. I tried to determine distance of object using method you specified. There is an error in distance measured from 3cm for closer object to 12cm or more for distant object.
Say, actual - 27cm ; measured - 24cm.
actual - 60cm ; measured - 48cm.


My queries are,
- why does there comes this much big varition is distance measurement?
- What may be reason/solution for this error?

Is there any mistake in my procedure or do i miss parameters?

Regards
Sathya Kumar

Dear Sathya,

First of all, thank you very much for your kind comment. Regarding your queries, I am afraid that what you describe is quite normal. The steps that you followed are correct, so I don't think that you did any mistake in your procedure or missed any parameters.

The thing is, that the relation between the disparity and the depth is non-linear.


Google ads, probably not very well related to the audience of this blog...


For this reason there is such a big variation in the distance measurement error, for close objects a small variation in disparity means a small variation on depth. But, for far objects a small variation in disparity means a big variation in depth.

So, there is no easy solution, it is unavoidable to get bigger error for distant objects, but you can try to mitigate the effects and reduce the error by getting a calibration as good as possible. And to do that you should take captures of the calibration pattern in as many different positions and orientations as possible, far, near, inclined, etc... Also increasing a bit the size of the chessboard could help you to get better accuracy for distant objects.

I hope this solved your doubts.

Best regards,
Martin

7 comments:

Sathya said...

Hi Martin,

I'm back with bunch of results and queries:-) First of all Thank You for your information Martin.

As you suggested, I experimented with various size chessboards and with various pose as near, far, inclined and tilted. Result of experimentation made me stunned:-)

Following are chessboard size I used,
1. 9 x 6 x 5.7cm
2. 9 x 6 x 3.7cm
3. 8 x 6 x 2.8cm

For each calibration I took about 15 samples and I monitored variation in focal length, rms value and accuracy in measured distance.

From this, following are some conclusion and results I arrived at.

- Calibration with larger chessboard (size specified as 1 above) reduces error greatly. I got +/- 3 or less for distance upto 50cm and error increases little as distance of object increased.

- Calibration with medium size chessborad (2) produces +/- 4cm error and increases greatly as distance increases.

- Calibration with small size (3) produces +/- 4cm for closer object and 10-12cm as distance of object increased.

Following is my query,
1. For same chessboard of size (1) produces different value of focal length. (Referred from Camera Matrix and Q matrix).

Say, with less tilted, inclined samples gives focal length - 853.642834899439 pixels and baseline as 8.9cm. These values are very closer to original values. Error in distance measurement is +/-3cm and good improvement.

Say, with no inclination or no tilted samples gives focal length - 3537.76389326708 pixels and baseline as 8.9cm. Focal length is irrelevant to original value. Error in measured distance also irrelevant, say, actual - 25cm; measured - 118 cm.

How focal length and error is related with calibration samples (especially tilt, inclination)?

Here is link with list of images that I took with less tilted large chessboard samples.
http://www.flickr.com/photos/68499538@N06/?saved=1

Regards
Sathya Kumar

Sathya said...

Hi Martin,

I'm back with bunch of results and queries:-) First of all Thank You for your information Martin.

As you suggested, I experimented with various size chessboards and with various pose as near, far, inclined and tilted. Result of experimentation made me stunned:-)

Following are chessboard size I used,
1. 9 x 6 x 5.7cm
2. 9 x 6 x 3.7cm
3. 8 x 6 x 2.8cm

For each calibration I took about 15 samples and I monitored variation in focal length, rms value and accuracy in measured distance.

From this, following are some conclusion and results I arrived at.

- Calibration with larger chessboard (size specified as 1 above) reduces error greatly. I got +/- 3 or less for distance upto 50cm and error increases little as distance of object increased.

- Calibration with medium size chessborad (2) produces +/- 4cm error and increases greatly as distance increases.

- Calibration with small size (3) produces +/- 4cm for closer object and 10-12cm as distance of object increased.

Following is my query,
1. For same chessboard of size (1) produces different value of focal length. (Referred from Camera Matrix and Q matrix).

Say, with less tilted, inclined samples gives focal length - 853.642834899439 pixels and baseline as 8.9cm. These values are very closer to original values. Error in distance measurement is +/-3cm and good improvement.

Say, with no inclination or no tilted samples gives focal length - 3537.76389326708 pixels and baseline as 8.9cm. Focal length is irrelevant to original value. Error in measured distance also irrelevant, say, actual - 25cm; measured - 118 cm.

How focal length and error is related with calibration samples (especially tilt, inclination)?

Here is link with list of images that I took with less tilted large chessboard samples.
http://www.flickr.com/photos/68499538@N06/?saved=1

Regards
Sathya Kumar

Martin Peris said...

Hi Sathya!

Sorry for taking so long to reply. I am happy to hear that you achieved some progress with your calibration :)

The effect that you describe is normal, if the samples of calibration chessboard are co-planar with the image plane (no inclination or no tilted samples) then it becomes difficult to approximate the accurately the real value of the focal length. And if you don't have a good approximation of the real value of the focal length then you get a big error in your measurements.

That is why it is recommended to also take samples of the calibration chessboard that are tilted and inclined.

Also, one small advice, at calibration time make sure that the chessboard is completely rigid. I have seen in some of the images that you posted that the chessboard gets a bit deformed when you hold it and that will introduce small errors in the calibration. If you want to get results as accurate as possible you should make sure that the chessboard doesn't get deformed when you handle it.

I hope this could be useful for you.
Best regards,
Martin

Sathya said...

Hi Martin,

Thanks for your informative advice:-) I pinned chessboard chart on thermocol and now pasted on it to make it rigid:-)

Martin, how to find that real value of focal length? Do you mean real 'f' as obtained from calibration matrices or value specified in data sheet?

Regards
Sathya Kumar

Martin Peris said...

Hi Sathya,

Thanks for the follow-up. When I refer to "real value of focal length" I mean the "f" as obtained from the calibration procedure :)

Best regards,
Martin.

kazu said...

Hi Martin!

I have developed a stereo camera with reference to you.I have a question about the scale of the 3D point cloud.

I have taken 9x6 chessboard with 2.7cm square size, and enter 2.7 (cm) the square size to your program, I was calibrated.RMS error is 1.364727 and avg error is 0.535176, roughly rectifying the correct result was obtained.

Then, place the object to the location of the shooting distance of 100cm from the stereo camera, I got a 3D point cloud of the sample block matching program in OpenCV2.However, the average value of z was about "7" .
Will you be able to fix the scale of cm What can I do? Or what will I missing?

Ali Raza said...

Please can u tell me when two rays from two camera are interest at point P is this a absolute point that what we want or not ???

Post a Comment

Facebook

Twitter

Friends