Chessboard detection: Difference between revisions

Content deleted Content added
Created page with '{{FeatureDetectionCompVisNavbox}} Chessboards arise frequently in computer vision theory and practice because their highly structured geome...'
 
BG19bot (talk | contribs)
m WP:CHECKWIKI error fix for #64. Do general fixes if a problem exists. - using AWB (10497)
Line 1:
{{FeatureDetectionCompVisNavbox}}
 
Chessboards arise frequently in [[Computer_vision| computer vision]] theory and practice because their highly structured geometry is well-suited for algorithmic [[Detection| detection]] and processing. The appearance of chessboards in computer vision can be divided into two main areas: [[Camera_resectioning|Camera resectioning|camera calibration]] and [[Feature_Feature (computer_visioncomputer vision)| feature extraction]]. 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 [[3D_reconstruction_from_multiple_images|3D reconstruction from multiple images|three-dimensional (3D) reconstruction]], where one seeks to infer 3D structure about a scene from two-dimensional (2D) images of it.<ref name=forsyth2002>D. Forsyth and J. Ponce. Computer Vision: A Modern Approach. Prentice Hall. (2002). [http://www.amazon.com/Computer-Vision-Modern-Approach-Edition/dp/013608592X ISBN 978-0262061582].</ref> Practical cameras are complex devices, and [[Photogrammetry| photogrammetry]] is needed to model the relationship between image sensor measurements and the 3D world. In the standard [[Pinhole_camera_model| pinhole camera model]], one models the relationship between world coordinates <math>\mathbf{X}</math> and image (pixel) coordinates <math>\mathbf{x}</math> via the [[3D_projection|3D projection|perspective transformation]]
 
:<math>
Line 11:
</math>
 
where <math>\mathbb{P}^n</math> is the [[Projective_space| projective space]] of dimension <math>n</math>.
 
In this setting, [[Camera_resectioning|Camera resectioning|camera calibration]] is the process of estimating the parameters of the <math>3 \times 4</math> matrix <math>M = K \begin{bmatrix} R & t \end{bmatrix}</math> 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.<ref name=szeliski2010>R. Szeliski. Computer Vision: Algorithms and Applications. Springer Science and Business Media. (2010). [http://www.springer.com/computer/image+processing/book/978-1-84882-934-3 ISBN 978-1848829350].</ref> Chessboards are often used during camera calibration because they are simple to construct, and their planar grid structure defines many natural [[Interest_point_detection|Interest point detection|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 the the perspective pinhole camera model defines a set of similarity relations that can be solved via the [[Direct_linear_transformation| direct linear transformation]] algorithm.<ref name=faugeras1993>O. Faugeras. Three-dimensional Computer Vision. MIT Press. (1993). [http://www.amazon.com/Three-Dimensional-Computer-Vision-Artificial-Intelligence/dp/0262061589 ISBN 978-0262061582].</ref> 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 [[System_of_linear_equationsSystem of linear equations#Homogeneous_systems|Homogeneous systems|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_stability|Numerical stability|numerical instability]].<ref name=forsyth2002/>
 
{{Auto images
Line 29:
===Multiplane calibration===
 
Multiplane calibration is a variant of [[Camera_auto-calibration| 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.<ref name=zhang2000>Z. Zhang. "A flexible new technique for camera calibration." IEEE Transactions on Pattern Analysis and Machine Intelligence. vol. 22(11), pp. 1330-1334 (2000).</ref> [[Camera_resectioningCamera resectioning#Zhang.27s_method|27s method|Zhang's method]] calibrates cameras by solving a particular [[System_of_linear_equationsSystem of linear equations#Homogeneous_systems|Homogeneous systems|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.<ref name=bouguet2013>J. Bouguet, "Camera calibration toolbox for MATLAB". http://www.vision.caltech.edu/bouguetj/calib_doc/. (2013).</ref>
 
{{Auto images
Line 36:
|text_align=center
|total_width=900
|width1=1128|height1=678|image1=Multiple chessboard views.png|caption1=Multiple views of a chessboard for [[Camera_autoCamera auto-calibration| multiplane calibration]]
|width2= 507|height2=384|image2=Reconstructed boards camera.png|caption2=Reconstructed orientations <br /> (camera-centric coordinates)
|width3= 529|height3=471|image3=Reconstructed boards world.png|caption3=Reconstructed orientations <br /> (world-centric coordinates)
Line 43:
==Chessboard feature extraction==
 
The second context in which chessboards arise in computer vision is to demonstrate several canonical [[Feature_extraction| feature extraction]] algorithms. In [[Feature_extraction| feature extraction]], one seeks to identify image [[Interest_point_detection|Interest point detection|interest points]], which summarize the semantic content of an image and, hence, offer a [[Dimensionality_reductionDimensionality reduction| reduced dimensionality]] representation of one's data.<ref name=szeliski2010/> 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 [[:Image:Perspective chessboard.png| 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]] 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 [[Corner_detectionCorner detection#The_Harris_The Harris .26_Stephens_26 Stephens .2F_Plessey_2F Plessey .2F_Shi2F Shi.E2.80.93Tomasi_corner_detection_algorithm|93Tomasi corner detection algorithm|Harris corner detector]] is a standard algorithm for corner detection in computer vision.<ref name=harris1998>C. Harris and M. Stephens. "A combined corner and edge detector." Proceedings of the 4th Alvey Vision Conference. pp. 147-151 (1988).</ref>. The algorithm works by analyzing the [[Eigenvalues_and_eigenvectors|Eigenvalues and eigenvectors|eigenvalues]] of the 2D discrete [[Structure_tensor| structure tensor]] 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 [[:Image:Perspective chessboard.png| chessboard image]]. Clearly, the Harris detector is able to accurately detect the corners of the board.
 
{{Auto images
Line 57:
|total_width=600
|width1=767|height1=548|image1=Perspective chessboard.png|caption1=Perspective-transformed chessboard image
|width2=767|height2=548|image2=Harris corners detected on chessboard.png|caption2=Output of [[Corner_detectionCorner detection#The_Harris_The Harris .26_Stephens_26 Stephens .2F_Plessey_2F Plessey .2F_Shi2F Shi.E2.80.93Tomasi_corner_detection_algorithm|93Tomasi corner detection algorithm|Harris corner detector]]
}}
 
The following [[MATLAB| MATLAB]] code generates the above image using the [http://www.mathworks.com/products/image/ Image Processing Toolbox]:
 
<source lang="matlab">
Line 84:
===Lines===
 
Lines are another natural local [[Feature_Feature (computer_visioncomputer vision)| image feature]] exploited in many computer vision systems. Geometrically, the set of all lines in a 2D image can be parametrized by [[Polar_coordinate_system|Polar coordinate system|polar coordinates]] <math>(\rho,\theta)</math> describing the distance and angle, respectively, of their [[Normal_Normal (geometry)| normal vectors]] with respect to the origin. The discrete [[Hough_transform| Hough transform]] exploits this idea by transforming a spatial image into a matrix in <math>(\rho,\theta)</math>-space whose <math>(i,j)</math>-th entry counts the number of image edge points that lie on the line parametrized by <math>(\rho_i,\theta_j)</math>.<ref name=shapiro2001>L. Shapiro and G. Stockman. Computer Vision. Prentice-Hall, Inc. (2001). [http://www.amazon.com/Computer-Vision-Linda-G-Shapiro/dp/0130307963 ISBN 978-0130307965]</ref><ref name=duda1972>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).</ref><ref name=hough1959>P. Hough. "Machine analysis of bubble chamber pictures." Proc. Int. Conf. High Energy Accelerators and Instrumentation. (1959).</ref> As such, one can detect lines in an image by simply searching for [[Maxima_and_minima|Maxima and minima|local maxima]] 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 [[:Image:Perspective chessboard.png| chessboard image]]. Clearly, the Hough transform is able to accurately detect the lines induced by the board squares.
 
{{Auto images
Line 94:
|total_width=1200
|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| Canny edge detector]] applied to chessboard image
|width3=767|height3=548|image3=Perspective chessboard hough transform.png|caption3=[[Hough_transform| Hough transform]] 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| Hough transform]] local maxima
}}
 
The following [[MATLAB| MATLAB]] code generates the above images using the [http://www.mathworks.com/products/image/ Image Processing Toolbox]:
 
<source lang="matlab">
Line 151:
==See also==
 
*[[Computer_vision| Computer vision]]
*[[Projective_geometry| Projective geometry]]
*[[Pinhole_camera| Pinhole camera]]
*[[Photogrammetry| Photogrammetry]]
*[[Camera_resectioning|Camera resectioning|Camera calibration]]
*[[Feature_detection_Feature detection (computer_visioncomputer vision)| Feature detection]]
*[[Feature_extraction| Feature extraction]]
*[[Canny_edge_detector|Canny edge detector|Canny edge detection]]
*[[Corner_detection| Corner detection]]
*[[Structure_tensorStructure tensor| Structure tensor matrix]]
*[[Hough_transform| Hough transform]]
 
==External links==
 
The following links are pointers to popular [[MATLAB| MATLAB]] and [[OpenCV| OpenCV]] implementations of chessboard-related computer vision algorithms.
* [http://www.vision.caltech.edu/bouguetj/calib_doc/ Camera Calibration Toolbox for MATLAB] - MATLAB toolbox implementing many common camera calibration methods
* [http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html Camera Calibration and 3D Reconstruction] - OpenCV implementation of many common camera calibration methods
Line 180:
# 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&nbsp;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&nbsp;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&nbsp;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).