Main Content

generateCheckerboardPoints

Generate checkerboard corner locations

Description

worldPoints = generateCheckerboardPoints(boardSize,squareSize) returns an M-by-2 matrix containing M [x, y] corner coordinates for the squares on a checkerboard. The point [0,0] corresponds to the lower-right corner of the top-left square of the board.

example

Examples

collapse all

Generate the checkerboard, and obtain world coordinates.

    I = checkerboard;
    squareSize = 10;
    worldPoints = generateCheckerboardPoints([8 8], squareSize);

Offset the points, placing the first point at the lower-right corner of the first square.

    imshow(insertMarker(I, worldPoints + squareSize));

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Generated checkerboard dimensions, specified as a 2-element [height, width] vector. You express the dimensions of the checkerboard in number of squares.

Checkerboard square side length, specified as a scalar in world units. You express world units as a measurement, such as millimeters or inches.

Output Arguments

collapse all

Generated checkerboard corner coordinates, returned as an M-by-2 matrix of M number of [x y] coordinates. The coordinates represent the corners of the squares on the checkerboard. The point [0,0] corresponds to the lower-right corner of the top-left square of the board. The number of points, M, that the function returns are based on the number of squares on the checkerboard. This value is set with the boardSize parameter.

M = (boardSize(1)-1) * (boardSize(2)-1)

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2013b