cv::findChessBoardCorners behaves differently in different opencv versions

asked 2017-03-01 07:08:20 -0600

ampawd gravatar image

there's a fisheye chessboard distorted image from which its needed to remove the distortion. I wrote the program that do that successfully on opencv 3.2.0 where this piece of code works perfectly fine on linux with the above mentioned cv version (the sizes are 8 and 5 for which it detects the corners)

bool patternFound = false;
std::vector<cv::Point2f> corners;
for (int i = 7; i <= 30; ++i)
{
    int w = i;
    int h = i-3;
    patternFound = cv::findChessboardCorners(image, cv::Size(w, h), corners,
                                      cv::CALIB_CB_ADAPTIVE_THRESH | cv::CALIB_CB_NORMALIZE_IMAGE);
 }

but on Mac with opencv 3.1.0.2 it does not find the corners and this

cv::findChessboardCorners(image, cv::Size(w, h), corners,
                                      cv::CALIB_CB_ADAPTIVE_THRESH | cv::CALIB_CB_NORMALIZE_IMAGE);

always returns false

Why is that happening ?

is this a bug and how to fix it ?

please check the comments where I added a link to image because (karma is not enough to paste a link in a question)

edit retag flag offensive close merge delete

Comments

the https://ibb.co/gEPFWF (distorted image)

ampawd gravatar imageampawd ( 2017-03-01 07:08:38 -0600 )edit

because opencv 3.1.0.2 is not opencv 3.2.0 as you can see in file history

LBerger gravatar imageLBerger ( 2017-03-01 07:12:23 -0600 )edit

how to modify the code to make it work on both versions correctly ?

ampawd gravatar imageampawd ( 2017-03-01 07:25:18 -0600 )edit

git clone https://github.com/opencv/opencv.git and of course rebuild opencv : delete cmakecache.txt and generate again

LBerger gravatar imageLBerger ( 2017-03-01 07:27:28 -0600 )edit

you mean just building on a same opencv version ?

ampawd gravatar imageampawd ( 2017-03-01 07:31:50 -0600 )edit