Hi!
I'm currently working on a little robot with a stereo setup (made with 2 logitech C270, not the best, but still decent with 640x480 on linux) to detect obstacles indoor and create a 2D maps of the room.
I tried to calibrate both cameras then calibrate the whole setup and I achieved finally to get decent results :
Left camera with 100 images :
errReproj = 0.16552850392837773
cameraMatrix =
[813,6236504501936, 0, 322,084934872842;
0, 813,7875223412764, 246,1504964804209;
0, 0, 1]
distCoeffs =[0,01298432313476952; 0,06663299254719597;
0;
0;
-1,474057784906827]
Right camera with 100 images :
errReproj = 0.1717557062634702
cameraMatrix =
[812,5880346983992, 0, 311,5146085418734;
0, 813,0827212604557, 232,3997472460254;
0, 0, 1]
distCoeffs =
[0,01009600201848234;
-0,2462621231670898;
0;
0;
1,891318564864029]
Stereo calibration :
RMS=0.3906354057793356
My number seems decent, even if the stereo calibration could be a bit better. I'm using those options for the camera calibration :
private static final int flagsCorner = Calib3d.CALIB_CB_FAST_CHECK
| Calib3d.CALIB_CB_ADAPTIVE_THRESH
| Calib3d.CALIB_CB_NORMALIZE_IMAGE;
private static final int flagsCalib = Calib3d.CALIB_CB_FAST_CHECK;
private static final TermCriteria criteria = new TermCriteria(TermCriteria.EPS
+ TermCriteria.COUNT, 5000000, 0.00000001);
And those ones for the stereo :
private static final int CORNERS_FLAGS = Calib3d.CALIB_CB_FAST_CHECK
| Calib3d.CALIB_CB_ADAPTIVE_THRESH
| Calib3d.CALIB_CB_NORMALIZE_IMAGE;
private static final int CALIB_FLAGS = Calib3d.CALIB_CB_FAST_CHECK;
private static final TermCriteria CORNERS_CRITERIA = new TermCriteria(TermCriteria.EPS
+ TermCriteria.COUNT, 5000000, 0.00000001);
private static final TermCriteria CALIB_CRITERIA = new TermCriteria(TermCriteria.EPS
+ TermCriteria.COUNT, 5000000, 0.0001);
So, my issue is that I can't get a decent disparity map. Even if the image seems to be undistored well :
Original pic :
After undistortion + adding line to show Y axis :
But when it goes through the StereoBM.compute(), I can't get a good disparity map, even by tweaking the different values available :
This is an example with those parameters :
Blocksize : 39
Smaller Blocksize : 0
Disp12MaxDiff : 0
Min disparity : 1
Num of disparity : 32
Prefilter cap : 61
Prefilter size : 5
Speckle Range : 0
Speckle window size : 0
Texture threshold : 74
Uniqueness Ratio : 6
So, I would like to know if something looks wrong in my results, matrix, and datas, any help is welcome!
Thank you