Stereo Calibration sample bug?

asked 2013-10-04 18:04:25 -0500

TonyM gravatar image

Hello to all! I'm writing here because i can't understand a line of the opencv c++ sample stereo calibration program: , line number 161:

for( i = 0; i < nimages; i++ )
    for( j = 0; j < boardSize.height; j++ )
        for( k = 0; k < boardSize.width; k++ )
            objectPoints[i].push_back(Point3f(j*squareSize, k*squareSize, 0));

It is the piece of code that calculates the calibration points coordinates in calibration object frame of reference. I can't understand why, when calibration object points are calculated, the point coordinates are (j, k, 0): "j" is used for height, so, i don't understand why it is used as abscissa, and viceversa for k. In my humble opinion, it is a bug and it should be:

objectPoints[i].push_back(Point3f(k*squareSize, j*squareSize, 0));

I've used Google and found that in EmguCV example (, the code is:

for (int i = 0; i < height; i++)
    for (int j = 0; j < width; j++)
      object_list.Add(new MCvPoint3D32f(j * 20.0F, i * 20.0F, 0.0F));

and this makes me think that i could be right. But I'm not sure, so I'm asking you: I'm right or wrong? And if I'm not right... can you please explain me why?

Thanks in advance

edit retag flag offensive close merge delete