Making a Chessboard Pattern for Camera Calibration

The following code can be used to make a chessboard image given the number of rows and columns of the chessboard, square size in pixel, and two colors.

The default size of the square is 100 pixels and default colors are black and white.

crvlMakeChessboardPattern(chessboardImg, 6, 8);
crvlMakeChessboardPattern(chessboardImg, 5, 7, 200, CV_RGB(255, 0, 0), CV_RGB(0, 0, 255))

Use an image viewer like Irfanview to print the saved chessboard pattern to a paper maintaining the required size of the chessboard in metric measurements.

As an example, if you want to print a 5×7 chessboard pattern where one square should be 3cm×3cm, select the options as follows.

Printing options.