generateCheckerboardPoints

Generate checkerboard corner locations

Syntax

  • [worldPoints] = generateCheckerboardPoints(boardSize,squareSize) example

Description

example

[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.

Examples

expand all

Generate and Plot Corners of an 8-by-8 Checkerboard

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));

Input Arguments

expand all

boardSize — Generated checkerboard dimensions2-element [height, width] vector

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

squareSize — Generated checkerboard square side lengthscalar

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

expand all

worldPoints — Generated checkerboard corner coordinatesM-by-2 matrix

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)
Was this topic helpful?