EasternEdgeRobotics / Software_2017

The control software for 2017
MIT License
3 stars 0 forks source link

Allow images to be down-sampled before calibration #321

Closed cal-pratt closed 7 years ago

cal-pratt commented 7 years ago

Before running a chessboard calibration, images are down-sampled to speed up the calculation process. After the initial estimates are found, the points are scaled, and fixed to proper image corners using cornerSubPix method. This keeps error low while increasing calibration time greatly.

cal-pratt commented 7 years ago

I was noticing a large amount of pixel error after running larger scales. This is because large jumps in scales can cause a larger error to be propagated into the final image, making the subpixel correction algorithm fail. A single jump to original resolution causes large pixel errors: image

To reduce the error, the image is gradually scaled to proper size, running the subpixel correction algorithm iteratively on larger images:

image

This in turn creates far less rms error in the final projection.

Before iterative solution:

scale 1
calibrateCameraRmsError: 0.28
INFO: cameraMatrix = {
    { 2425.728384975679, 0.0, 1336.8598231006679, },
    { 0.0, 2433.2315978304923, 971.5522263984041, },
    { 0.0, 0.0, 1.0, },
}; 

scale 2 
calibrateCameraRmsError: 0.4
INFO: cameraMatrix = {
    { 2420.7773012863013, 0.0, 1343.5666398362293, },
    { 0.0, 2428.060191585721, 959.0764544347993, },
    { 0.0, 0.0, 1.0, },
}; 

scale 5
calibrateCameraRmsError: 2.27
INFO: cameraMatrix = {
    { 2413.637540967931, 0.0, 1341.4026027457041, },
    { 0.0, 2410.52816873944, 951.5685457494493, },
    { 0.0, 0.0, 1.0, },
}; 

After iterative solution:


scale 1
calibrateCameraRmsError: 0.282
cameraMatrix = {
    { 2425.728384975679, 0.0, 1336.8598231006679, },
    { 0.0, 2433.2315978304923, 971.5522263984041, },
    { 0.0, 0.0, 1.0, },
}; 0.28 rms

scale: 1.8
calibrateCameraRmsError: 0.284
cameraMatrix = {
    { 2425.731155347157, 0.0, 1336.8592156109237, },
    { 0.0, 2433.234347855433, 971.5502012742322, },
    { 0.0, 0.0, 1.0, },
};

scale: 2.5
calibrateCameraRmsError: 0.295
cameraMatrix = {
    { 2420.777955568642, 0.0, 1343.5665168042763, },
    { 0.0, 2428.0608312564236, 959.0759604057756, },
    { 0.0, 0.0, 1.0, },
};