Chessboard Detection
   HOME

TheInfoList



OR:

Chessboard A chessboard is a game board used to play chess. It consists of 64 squares, 8 rows by 8 columns, on which the chess pieces are placed. It is square in shape and uses two colours of squares, one light and one dark, in a chequered pattern. During p ...
s arise frequently in
computer vision Computer vision tasks include methods for image sensor, acquiring, Image processing, processing, Image analysis, analyzing, and understanding digital images, and extraction of high-dimensional data from the real world in order to produce numerical ...
theory and practice because their highly structured geometry is well-suited for algorithmic
detection {{Unreferenced, date=March 2018 In general, detection is the action of accessing information without specific cooperation from with the sender. In the history of radio communications, the term "detector" was first used for a device that detected ...
and processing. The appearance of chessboards in computer vision can be divided into two main areas: camera calibration and
feature extraction Feature may refer to: Computing * Feature recognition, could be a hole, pocket, or notch * Feature (computer vision), could be an edge, corner or blob * Feature (machine learning), in statistics: individual measurable properties of the phenome ...
. This article provides a unified discussion of the role that chessboards play in the canonical methods from these two areas, including references to the seminal literature, examples, and pointers to software implementations.


Chessboard camera calibration

A classical problem in computer vision is three-dimensional (3D) reconstruction, where one seeks to infer 3D structure about a scene from two-dimensional (2D) images of it.D. Forsyth and J. Ponce. ''Computer Vision: A Modern Approach''. Prentice Hall. (2002). . Practical cameras are complex devices, and
photogrammetry Photogrammetry is the science and technology of obtaining reliable information about physical objects and the environment through the process of recording, measuring and interpreting photographic images and patterns of electromagnetic radiant ima ...
is needed to model the relationship between image sensor measurements and the 3D world. In the standard
pinhole camera model The pinhole camera model describes the mathematical relationship between the coordinates of a point in three-dimensional space and its projection onto the image plane of an ''ideal'' pinhole camera, where the camera aperture is described as a ...
, one models the relationship between world coordinates \mathbf and image (pixel) coordinates \mathbf via the perspective transformation : \mathbf = K \begin R & t \end \mathbf \quad, \quad \mathbf \in \mathbb^2 \quad , \quad \mathbf \in \mathbb^3, where \mathbb^n is the
projective space In mathematics, the concept of a projective space originated from the visual effect of perspective, where parallel lines seem to meet ''at infinity''. A projective space may thus be viewed as the extension of a Euclidean space, or, more generally ...
of dimension n. In this setting, camera calibration is the process of estimating the parameters of the 3 \times 4 matrix M = K \begin R & t \end of the perspective model. Camera calibration is an important step in the computer vision pipeline because many subsequent algorithms require knowledge of camera parameters as input.R. Szeliski. ''Computer Vision: Algorithms and Applications''. Springer Science and Business Media. (2010). . Chessboards are often used during camera calibration because they are simple to construct, and their planar grid structure defines many natural interest points in an image. The following two methods are classic calibration techniques that often employ chessboards.


Direct linear transformation

Direct linear transformation (DLT) calibration uses correspondences between world points and camera image points to estimate camera parameters. In particular, DLT calibration exploits the fact that the perspective pinhole camera model defines a set of similarity relations that can be solved via the
direct linear transformation Direct linear transformation (DLT) is an algorithm which solves a set of variables from a set of similarity relations: : \mathbf_ \propto \mathbf \, \mathbf_   for \, k = 1, \ldots, N where \mathbf_ and \mathbf_ are known vectors, \, ...
algorithm.O. Faugeras. ''Three-dimensional Computer Vision''. MIT Press. (1993). . To employ this approach, one requires accurate coordinates of a non-degenerate set of points in 3D space. A common way to achieve this is to construct a camera calibration rig (example below) built from three mutually perpendicular chessboards. Since the corners of each square are equidistant, it is straightforward to compute the 3D coordinates of each corner given the width of each square. The advantage of DLT calibration is its simplicity; arbitrary cameras can be calibrated by solving a single homogeneous linear system. However, the practical use of DLT calibration is limited by the necessity of a 3D calibration rig and the fact that extremely accurate 3D coordinates are required to avoid numerical instability.


Multiplane calibration

Multiplane calibration is a variant of camera auto-calibration that allows one to compute the parameters of a camera from two or more views of a planar surface. The seminal work in multiplane calibration is due to Zhang.Z. Zhang. "A flexible new technique for camera calibration." IEEE Transactions on Pattern Analysis and Machine Intelligence. vol. 22(11), pp. 1330-1334 (2000). Zhang's method calibrates cameras by solving a particular homogeneous linear system that captures the homographic relationships between multiple perspective views of the same plane. This multiview approach is popular because, in practice, it is more natural to capture multiple views of a single planar surface - like a chessboard - than to construct a precise 3D calibration rig, as required by DLT calibration. The following figures demonstrate a practical application of multiplane camera calibration from multiple views of a chessboard.J. Bouguet, "Camera calibration toolbox for MATLAB". http://www.vision.caltech.edu/bouguetj/calib_doc/. (2013).


Chessboard feature extraction

The second context in which chessboards arise in computer vision is to demonstrate several canonical
feature extraction Feature may refer to: Computing * Feature recognition, could be a hole, pocket, or notch * Feature (computer vision), could be an edge, corner or blob * Feature (machine learning), in statistics: individual measurable properties of the phenome ...
algorithms. In
feature extraction Feature may refer to: Computing * Feature recognition, could be a hole, pocket, or notch * Feature (computer vision), could be an edge, corner or blob * Feature (machine learning), in statistics: individual measurable properties of the phenome ...
, one seeks to identify image interest points, which summarize the semantic content of an image and, hence, offer a reduced dimensionality representation of one's data. Chessboards - in particular - are often used to demonstrate feature extraction algorithms because their regular geometry naturally exhibits local image features like edges, lines, and corners. The following sections demonstrate the application of common feature extraction algorithms to a chessboard image.


Corners

Corners are a natural local image feature exploited in many computer vision systems. Loosely speaking, one can define a ''corner'' as the intersection of two edges. A variety of
corner detection Corner detection is an approach used within computer vision systems to extract certain kinds of Feature detection (computer vision), features and infer the contents of an image. Corner detection is frequently used in motion detection, image reg ...
algorithms exist that formalize this notion into concrete algorithms. Corners are a useful image feature because they are necessarily distinct from their neighboring pixels. The Harris corner detector is a standard algorithm for corner detection in computer vision.C. Harris and M. Stephens. "A combined corner and edge detector." Proceedings of the 4th Alvey Vision Conference. pp. 147-151 (1988). The algorithm works by analyzing the
eigenvalues In linear algebra, an eigenvector ( ) or characteristic vector is a vector that has its direction unchanged (or reversed) by a given linear transformation. More precisely, an eigenvector \mathbf v of a linear transformation T is scaled by a ...
of the 2D discrete
structure tensor In mathematics, the structure tensor, also referred to as the second-moment matrix, is a matrix (mathematics), matrix derived from the gradient of a function (mathematics), function. It describes the distribution of the gradient in a specified ne ...
matrix at each image pixel and flagging a pixel as a corner when the eigenvalues of its structure tensor are sufficiently large. Intuitively, the eigenvalues of the structure tensor matrix associated with a given pixel describe the gradient strength in a neighborhood of that pixel. As such, a structure tensor matrix with large eigenvalues corresponds to an image neighborhood with large gradients in orthogonal directions - ''i.e.,'' a corner. A chessboard contains natural corners at the boundaries between board squares, so one would expect corner detection algorithms to successfully detect them in practice. Indeed, the following figure demonstrates Harris corner detection applied to a perspective-transformed chessboard image. Clearly, the Harris detector is able to accurately detect the corners of the board.


Lines

Lines are another natural local image feature exploited in many computer vision systems. Geometrically, the set of all lines in a 2D image can be parametrized by
polar coordinates In mathematics, the polar coordinate system specifies a given point (mathematics), point in a plane (mathematics), plane by using a distance and an angle as its two coordinate system, coordinates. These are *the point's distance from a reference ...
(\rho,\theta) describing the distance and angle, respectively, of their normal vectors with respect to the origin. The discrete
Hough transform The Hough transform () is a feature extraction technique used in image analysis, computer vision, pattern recognition, and digital image processing. The purpose of the technique is to find imperfect instances of objects within a certain class of ...
exploits this idea by transforming a spatial image into a matrix in (\rho,\theta)-space whose (i,j)-th entry counts the number of image edge points that lie on the line parametrized by (\rho_i,\theta_j).L. Shapiro and G. Stockman. ''Computer Vision''. Prentice-Hall, Inc. (2001). R. Duda and P. Hart. "Use of the Hough transformation to detect lines and curves in pictures," Comm. ACM, vol. 15, pp. 11-15 (1972).P. Hough. "Machine analysis of bubble chamber pictures." Proc. Int. Conf. High Energy Accelerators and Instrumentation. (1959). As such, one can detect lines in an image by simply searching for
local maxima In mathematical analysis, the maximum and minimum of a function (mathematics), function are, respectively, the greatest and least value taken by the function. Known generically as extremum, they may be defined either within a given Interval (ma ...
of its discrete Hough transform. The grid structure of a chessboard naturally defines two sets of parallel lines in an image of it. Therefore, one expects that line detection algorithms should successfully detect these lines in practice. Indeed, the following figure demonstrates Hough transform-based line detection applied to a perspective-transformed chessboard image. Clearly, the Hough transform is able to accurately detect the lines induced by the board squares. {{multiple image , title=Example: line detection , align=center , text_align=center , total_width=1000 , width1=767, height1=548, image1=Perspective chessboard.png, caption1=Perspective-transformed chessboard image , width2=767, height2=548, image2=Perspective chessboard edges.png, caption2=
Canny edge detector The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986. Canny also produced a ''computational theory of edge detection'' expla ...
applied to chessboard image , width3=767, height3=548, image3=Perspective chessboard hough transform.png, caption3=
Hough transform The Hough transform () is a feature extraction technique used in image analysis, computer vision, pattern recognition, and digital image processing. The purpose of the technique is to find imperfect instances of objects within a certain class of ...
of edge image with 19 largest local maxima denoted , width4=767, height4=548, image4=Perspective chessboard detected lines.png, caption4=Lines parameterized by
Hough transform The Hough transform () is a feature extraction technique used in image analysis, computer vision, pattern recognition, and digital image processing. The purpose of the technique is to find imperfect instances of objects within a certain class of ...
local maxima The following
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
code generates the above images using th
Image Processing Toolbox
% Load image I = imread('Perspective_chessboard.png'); % Compute edge image BW = edge(I, 'canny'); % Compute Hough transform theta rho= hough(BW); % Find local maxima of Hough transform numpeaks = 19; thresh = ceil(0.1 * max(H(:))); P = houghpeaks(H, numpeaks, 'threshold', thresh); % Extract image lines lines = houghlines(BW, theta, rho, P, 'FillGap', 50, 'MinLength', 60); % -------------------------------------------------------------------------- % Display results % -------------------------------------------------------------------------- % Original image figure; imshow(I); % Edge image figure; imshow(BW); % Hough transform figure; image(theta, rho, imadjust(mat2gray(H)), 'CDataMapping', 'scaled'); hold on; colormap(gray(256)); plot(theta(P(:, 2)), rho(P(:, 1)), 'o', 'color', 'r'); % Detected lines figure; imshow(I); hold on; n = size(I, 2); for k = 1:length(lines) % Overlay kth line x = ines(k).point1(1) lines(k).point2(1) y = ines(k).point1(2) lines(k).point2(2) line = @(z) ((y(2) - y(1)) / (x(2) - x(1))) * (z - x(1)) + y(1); plot( n line( n, 'Color', 'r'); end


Limitations

The main limitation of using chessboard patterns for geometric camera calibration is that due to their highly repetitive structure, they need to be completely visible in the camera image. This assumption may be violated e.g. when specular reflections due to inhomogenous lighting cause chessboard detection to fail in some of the corners. The measurement of camera distortions close to the image corners is also altered by the need of a completely visible chessboard target. To solve this issue, chessboard targets can be combined with some position encoding. One popular way is to place ArUco markersS. Garrido-Jurado et al. "Automatic generation and detection of highly reliable fiducial markers under occlusion." Pattern Recognition, vol. 47(6), pp. 2280-2292. https://dl.acm.org/doi/abs/10.1016/J.PATCOG.2014.01.005. (2014). inside the lightchessboard squares. The main advantage of such ChArUco targetsOpenCV. https://docs.opencv.org/3.4/df/d4a/tutorial_charuco_detection.html. is that all light chessboard squares are uniquely coded and identifiable. This also allows to do single image multiplane calibration by placing multiple targets with different ArUco in one scene. An alternative way for adding position encoding to chessboard patterns is the PuzzleBoard pattern:P. Stelldinger, et al. "PuzzleBoard: A New Camera Calibration Pattern with Position Encoding." German Conference on Pattern Recognition. (2024). https://users.informatik.haw-hamburg.de/~stelldinger/pub/PuzzleBoard/. (2024). Each chessboard edge is given one bit of information such that local parts of the pattern show a unique bit pattern. In comparison to ChArUco patterns, the position encoding can be read at much lower resolutions.


See also

*
Computer vision Computer vision tasks include methods for image sensor, acquiring, Image processing, processing, Image analysis, analyzing, and understanding digital images, and extraction of high-dimensional data from the real world in order to produce numerical ...
*
Projective geometry In mathematics, projective geometry is the study of geometric properties that are invariant with respect to projective transformations. This means that, compared to elementary Euclidean geometry, projective geometry has a different setting (''p ...
*
Pinhole camera A pinhole camera is a simple camera without a lens but with a tiny aperture (the so-called ''Pinhole (optics), pinhole'')—effectively a light-proof box with a small hole in one side. Light from a scene passes through the aperture and projects a ...
*
Photogrammetry Photogrammetry is the science and technology of obtaining reliable information about physical objects and the environment through the process of recording, measuring and interpreting photographic images and patterns of electromagnetic radiant ima ...
* Camera calibration * Feature detection *
Feature extraction Feature may refer to: Computing * Feature recognition, could be a hole, pocket, or notch * Feature (computer vision), could be an edge, corner or blob * Feature (machine learning), in statistics: individual measurable properties of the phenome ...
* Canny edge detection *
Corner detection Corner detection is an approach used within computer vision systems to extract certain kinds of Feature detection (computer vision), features and infer the contents of an image. Corner detection is frequently used in motion detection, image reg ...
* Structure tensor matrix *
Hough transform The Hough transform () is a feature extraction technique used in image analysis, computer vision, pattern recognition, and digital image processing. The purpose of the technique is to find imperfect instances of objects within a certain class of ...


Further reading

# M. Rufli, D. Scaramuzza, and R. Siegwart. "Automatic detection of checkerboards on blurred and distorted images." IEEE/RSJ International Conference on Intelligent Robots and Systems. (2008). # Z. Weixing, et al. "A fast and accurate algorithm for chessboard corner detection." 2nd International Congress on Image and Signal Processing. (2009). # A. De la Escalera and J. Armingol. "Automatic chessboard detection for intrinsic and extrinsic camera parameter calibration." Sensors. vol. 10(3), pp. 2027–2044 (2010). # S. Bennett and J. Lasenby. "ChESS - quick and robust detection of chess-board features." Computer Vision and Image Understanding. vol. 118, pp. 197–210 (2014). # J. Ha. "Automatic detection of chessboard and its applications." Opt. Eng. vol. 48(6) (2009). # F. Zhao, et al. "An automated x-corner detection algorithm (axda)." Journal of Software. vol. 6(5), pp. 791–797 (2011). # S. Arca, E. Casiraghi, and G. Lombardi. "Corner localization in chessboards for camera calibration." IADAT. (2005). # X. Hu, P. Du, and Y. Zhou. "Automatic corner detection of chess board for medical endoscopy camera calibration." Proceedings of the 10th International Conference on Virtual Reality Continuum and Its Applications in Industry. ACM. (2011). # S. Malek, et al. "Tracking chessboard corners using projective transformation for augmented reality. International Conference on Communications, Computing and Control Applications. (2011).


References


External links

The following links are pointers to popular implementations of chessboard-related computer vision algorithms.
Camera Calibration Toolbox for MATLAB
- MATLAB toolbox implementing many common camera calibration methods

- OpenCV implementation of many common camera calibration methods

- MATLAB example of applying multiview auto-calibration to a series of chessboard images

- MATLAB function from th
Computer Vision System Toolbox
for detecting chessboards in images

- OpenCV function for detecting chessboards in images

- MATLAB function for performing Harris corner detection

- OpenCV function for performing Harris corner detection

- MATLAB function for computing the Hough transform

- OpenCV function for computing the Hough transform
mrgingham
- tool for detection of chessboards Feature detection (computer vision)