Disparity map from stereo vision not accurate
Show older comments
I have a problem trying to do depht axtraction from a stereo vision system.
I'm using two cameras (iDS, no RGB but B&W images) with two different optics both with the same focal lenght (8 mm).
After the calibration done with the 'stereo camera calibrator' app from Matlab the result was an overall mean error of 0.32 pixels.
Then I took these photos of an object with both cameras:

and I tried to obtain the disparity map with this code:
left=imread('spinaleft.png');
right=imread('spinaright.png');
figure
imshowpair(left,right,"montage")
%% rectification
[leftRect,rightRect,reprojectionMatrix]=rectifyStereoImages(left,right,stereoParams2607);
figure
A=stereoAnaglyph(leftRect,rightRect);
imshow(A)
%% disparity
leftRect=im2gray(leftRect);
rightRect=im2gray(rightRect);
disparityRange = [0 432];
disparityMap = disparityBM(leftRect,rightRect,'DisparityRange',disparityRange,'UniquenessThreshold',10,'BlockSize',9,'ContrastThreshold',0.5);
figure
imshow(disparityMap,disparityRange)
title('Disparity Map')
colormap jet
colorbar
but unfortunately the disparity map is too different from the reality. This was the best one I've got:


I really don't understand what I'm doing wrong, and I have some doubts:
1) could it be better if I use RGB photos instead of B&W photos?
2) why there's a blue area in the left side of the disparity map?
3) why are the windows in red? It looks like the system sees them closer than they are.
Thanks for helping me!
2 Comments
Giridharan Kumaravelu
on 28 Jul 2023
I don't think the results are poor because they are B&W photos. There might have been something gone wrong during the calibration process. Could you share the following for a deeper investigation?
- The calibration images that you used to calibrate the camera.
- The calibration results that you got (in a MAT file).
- Link to spec sheet of the camera that you are using.
Luca
on 29 Jul 2023
Accepted Answer
More Answers (0)
Categories
Find more on Stereo Vision in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
