Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

stereo calibration issues

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 :

left original right original

After undistortion + adding line to show Y axis :

left undistorded right undistorded

But when it goes through the StereoBM.compute(), I can't get a good disparity map, even by tweaking the different values available :

disparity map 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

stereo calibration issues

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 :

left original right original

After undistortion + adding line to show Y axis :

left undistorded right undistorded

But when it goes through the StereoBM.compute(), I can't get a good disparity map, even by tweaking the different values available :

disparity map

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

stereo calibration issues

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 :

left original right original

After undistortion + adding line to show Y axis :

left undistorded right undistorded

But when it goes through the StereoBM.compute(), I can't get a good disparity map, even by tweaking the different values available :

disparity map

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

EDIT : I made more tests this morning on a more opened area, and I'm getting better results : new results

It looks like I'm able to get mid to long range datas (~4/5m and more) but It is struggling with low range. How can I improve this? Is it a calibration issue? The distance between both cameras is currently of 14cm. Is it too much?

My goal would be to let the robot navigating among the room, so mid/long range detection is not really important, but close detection is!

stereo calibration issues

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 :

left original right original

After undistortion + adding line to show Y axis :

left undistorded right undistorded

But when it goes through the StereoBM.compute(), I can't get a good disparity map, even by tweaking the different values available :

disparity map

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

EDIT : I made more tests this morning on a more opened area, and I'm getting better results : new results

It looks like I'm able to get mid to long range datas (~4/5m and more) but It is struggling with low range. How can I improve this? Is it a calibration issue? The distance between both cameras is currently of 14cm. Is it too much?

My goal would be to let the robot navigating among the room, so mid/long range detection is not really important, but close detection is!

EDIT2 : After reading internet stuff ( https://www.cs.cf.ac.uk/Dave/Vision_lecture/node11.html ), I understood that my setup (14cm between both cameras) was not good to find close items. I rebuilt my robot so I only have 7cm between both cameras and it looks much better!

My first calibration gave me a RMS of 0.42, down to 0.28 using those flags for stereo calibrations:

private static final int CALIB_FLAGS = Calib3d.CALIB_SAME_FOCAL_LENGTH
        | Calib3d.CALIB_ZERO_TANGENT_DIST;

image description