Ask Your Question

what is optimal window size for cornerSubPix on chessboard?

asked 2013-09-03 13:03:41 -0500

xaffeine gravatar image

In the process of calibrating stereo pairs of cameras, I've recently begun using cornerSubPix, and it generally helps. I am puzzled about the windowSize parameter, though. So far, it seems to do best with a size of (4, 4), judging by the computed reprojection error. I use over 50 image pairs from various angles and distances.

My main question is, why does it need a window size bigger than 1 or 2? Doesn't findChessboard give answers correct to within +/- about 1 pixel?

Also (not really a question) the official calibSample and stereoCalibSample programs use a size of (11, 11) which sometimes yields result worse than the unrefined results. It seems like that should be changed.

edit retag flag offensive close merge delete


I am surprised to get no answers at all. I wonder if my question was not clear enough.

xaffeine gravatar imagexaffeine ( 2013-09-16 12:57:53 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-02-14 07:54:47 -0500

wisewolf76 gravatar image

If I correctly remember the window size defines the dimension of the neighbourhood (around each point) used in the corner detection/refinement process. For example, with (4, 4) you are using a small cell of 9x9 pixels centered in the corner points that you want to refine. The size must be big enough to have enough gradient information to properly find the ideal corner location (if the window is small and the corner is a bit blurred or noisy, the refinement will be propably worse that the original result) but at the same time the window should be small enough to guarantee only one corner inside it. Notice that, the images acquired for the calibration process should guarantee sharp and big chessboards so that you can use a bigger windows size.

edit flag offensive delete link more

Question Tools


Asked: 2013-09-03 13:03:41 -0500

Seen: 520 times

Last updated: Feb 14 '20