Chessboard Pdf Open Cv Face Detection

  1. Open Cv Face Detection Example
$begingroup$

In this section you will object detection techniques like face detection etc. Since OpenCV is an open source. OpenCV-Python Tutorials Documentation.

What are the internal workings of the OpenCV function findChessboardCorners?

  • Camera calibration with square chessboard¶. The goal of this tutorial is to learn how to calibrate a camera given a set of chessboard images. Test data: use images in your data/chess folder.
  • Hi, I am using the cv::findChessboardCorners and cv::cornerSubPix to recognize a chessboard from an undistorted image for camera to marker detection, meaning that I have all camera parameters and are only looking at the transformation between camera and marker. However, I would like to get a measure of how good (or bad) a given chessboard detection.
GeertenGeerten
$endgroup$

1 Answer

$begingroup$

The source code of OpenCV is available, so I'd recommend just taking some time going through the code. The relevant file for this particular function is:

I've not looked into it in detail, but it looks like

is the main implementation of this method. In here they

  1. Use cvCheckChessboard to determine if a chessboard is in the image
  2. Convert to binary (B&W) and dilate to split the corners apart
  3. Use icvGenerateQuads to find the squares.

The code then seems to go though a set of checks to condense these quads to chessboard corners, including icvFindConnectedQuads, icvCleanFoundConnectedQuads to remove extra corners, icvCheckQuadGroup, and icvCheckBoardMonotony.

All of these functions are implemented in the same file, apart from cvCheckChessboard which is in calib3d/src/checkchessboard.cpp. Depending how well you wanted to understand the code, there seem to be a number of debugging lines, which can be included if you #define DEBUG_CHESSBOARD, that may help you see what's going on.

ChrisChris
$endgroup$

Not the answer you're looking for? Browse other questions tagged image-processingopencv or ask your own question.

Jump to navigationJump to search
Feature detection
Edge detection
Corner detection
Blob detection
Ridge detection
Hough transform
Structure tensor
Affine invariant feature detection
Feature description
Scale space

Chessboards arise frequently in computer vision theory and practice because their highly structured geometry is well-suited for algorithmic detection and processing. The appearance of chessboards in computer vision can be divided into two main areas: camera calibration and 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.

  • 1Chessboard camera calibration
  • 2Chessboard feature extraction

Chessboard camera calibration[edit]

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.[1] Practical cameras are complex devices, and photogrammetry is needed to model the relationship between image sensor measurements and the 3D world. In the standard pinhole camera model, one models the relationship between world coordinates X{displaystyle mathbf {X} } and image (pixel) coordinates x{displaystyle mathbf {x} } via the perspective transformation

x=K[Rt]X,xP2,XP3,{displaystyle mathbf {x} =K{begin{bmatrix}R&tend{bmatrix}}mathbf {X} quad ,quad mathbf {x} in mathbb {P} ^{2}quad ,quad mathbf {X} in mathbb {P} ^{3},}

where Pn{displaystyle mathbb {P} ^{n}} is the projective space of dimension n{displaystyle n}.

In this setting, camera calibration is the process of estimating the parameters of the 3×4{displaystyle 3times 4} matrix M=K[Rt]{displaystyle M=K{begin{bmatrix}R&tend{bmatrix}}} 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.[2] 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[edit]

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 algorithm.[3] 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.[1]

3D calibration rig built from three mutually perpendicular chessboards

Multiplane calibration[edit]

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.[4]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.[5]

Open Cv Face Detection Example

Multiple views of a chessboard for multiplane calibration
Reconstructed orientations
(camera-centric coordinates)
Reconstructed orientations
(world-centric coordinates)

Chessboard feature extraction[edit]

The second context in which chessboards arise in computer vision is to demonstrate several canonical feature extraction algorithms. In feature extraction, 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.[2] 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[edit]

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 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.[6] The algorithm works by analyzing the eigenvalues of the 2D discrete 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 chessboard image. Clearly, the Harris detector is able to accurately detect the corners of the board.

Perspective-transformed chessboard image
Output of Harris corner detector

Lines[edit]

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(ρ,θ){displaystyle (rho ,theta )} describing the distance and angle, respectively, of their normal vectors with respect to the origin. The discrete Hough transform exploits this idea by transforming a spatial image into a matrix in (ρ,θ){displaystyle (rho ,theta )}-space whose (i,j){displaystyle (i,j)}-th entry counts the number of image edge points that lie on the line parametrized by (ρi,θj){displaystyle (rho _{i},theta _{j})}.[7][8][9] As such, one can detect lines in an image by simply searching for 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 chessboard image. Clearly, the Hough transform is able to accurately detect the lines induced by the board squares.

Open
Perspective-transformed chessboard image
Canny edge detector applied to chessboard image
Hough transform of edge image with 19 largest local maxima denoted
Lines parameterized by Hough transform local maxima

The following MATLAB code generates the above images using the Image Processing Toolbox:

See also[edit]

Further reading[edit]

  1. 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).
  2. Z. Weixing, et al. 'A fast and accurate algorithm for chessboard corner detection.' 2nd International Congress on Image and Signal Processing. (2009).
  3. 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).
  4. 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).
  5. J. Ha. 'Automatic detection of chessboard and its applications.' Opt. Eng. vol. 48(6) (2009).
  6. F. Zhao, et al. 'An automated x-corner detection algorithm (axda).' Journal of Software. vol. 6(5), pp. 791–797 (2011).
  7. S. Arca, E. Casiraghi, and G. Lombardi. 'Corner localization in chessboards for camera calibration.' IADAT. (2005).
  8. 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).
  9. S. Malek, et al. 'Tracking chessboard corners using projective transformation for augmented reality. International Conference on Communications, Computing and Control Applications. (2011).

References[edit]

  1. ^ abD. Forsyth and J. Ponce. Computer Vision: A Modern Approach. Prentice Hall. (2002). ISBN978-0262061582.
  2. ^ abR. Szeliski. Computer Vision: Algorithms and Applications. Springer Science and Business Media. (2010). ISBN978-1848829350.
  3. ^O. Faugeras. Three-dimensional Computer Vision. MIT Press. (1993). ISBN978-0262061582.
  4. ^Z. Zhang. 'A flexible new technique for camera calibration.' IEEE Transactions on Pattern Analysis and Machine Intelligence. vol. 22(11), pp. 1330-1334 (2000).
  5. ^J. Bouguet, 'Camera calibration toolbox for MATLAB'. http://www.vision.caltech.edu/bouguetj/calib_doc/. (2013).
  6. ^C. Harris and M. Stephens. 'A combined corner and edge detector.' Proceedings of the 4th Alvey Vision Conference. pp. 147-151 (1988).
  7. ^L. Shapiro and G. Stockman. Computer Vision. Prentice-Hall, Inc. (2001). ISBN978-0130307965
  8. ^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).
  9. ^P. Hough. 'Machine analysis of bubble chamber pictures.' Proc. Int. Conf. High Energy Accelerators and Instrumentation. (1959).

External links[edit]

The following links are pointers to popular MATLAB and OpenCV implementations of chessboard-related computer vision algorithms.

  • Camera Calibration Toolbox for MATLAB - MATLAB toolbox implementing many common camera calibration methods
  • Camera Calibration and 3D Reconstruction - OpenCV implementation of many common camera calibration methods
  • Multiplane Camera Calibration From Multiple Chessboard Views - MATLAB example of applying multiview auto-calibration to a series of chessboard images
  • MATLAB chessboard detection - MATLAB function from the Computer Vision System Toolbox for detecting chessboards in images
  • OpenCV chessboard detection - OpenCV function for detecting chessboards in images
  • MATLAB Harris corner detection - MATLAB function for performing Harris corner detection
  • OpenCV Harris corner detection - OpenCV function for performing Harris corner detection
  • MATLAB Hough transform - MATLAB function for computing the Hough transform
  • OpenCV Hough transform - OpenCV function for computing the Hough transform
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Chessboard_detection&oldid=804837830'
Hidden categories: