checkerboard

Create checkerboard image

Syntax

I = checkerboard
I = checkerboard(n)
I = checkerboard(n,p,q)

Description

I = checkerboard creates an 8-by-8 square checkerboard image that has four identifiable corners. Each square has 10 pixels per side. The light squares on the left half of the checkerboard are white. The light squares on the right half of the checkerboard are gray.

I = checkerboard(n) creates a checkerboard image where each square has n pixels per side.

I = checkerboard(n,p,q) creates a rectangular checkerboard where p specifies the number of rows and q specifies the number of columns. If you omit q, it defaults to p and the checkerboard is square.

Each row and column is made up of tiles. Each tile contains four squares, n pixels per side, defined as

TILE = [DARK LIGHT; LIGHT DARK]

The light squares on the left half of the checkerboard are white. The light squares on the right half of the checkerboard are gray.

Examples

Create a checkerboard where the side of every square is 20 pixels in length.

I = checkerboard(20);imshow(I)

Create a rectangular checkerboard that is 2 tiles in height and 3 tiles wide.

J = checkerboard(10,2,3);
figure, imshow(J)

Create a black and white checkerboard.

K = (checkerboard > 0.5); 
figure, imshow(K)

Was this topic helpful?