public class DetectCircleHexagonalGrid<T extends ImageGray<T>> extends DetectCircleGrid<T>
Detects a hexagonal circle grid. Circles are spaced such that center of each circle is the same distance from each of its five neighbors. Rows and columns are counted in a zig-zag pattern, see example below. When there is symmetric ambiguity the canonical orientation is used.
Canonical orientation is defined as having the rows/columns matched, element (0,0) being occupied. If there are multiple solution a solution will be selected which is in counter-clockwise order (image coordinates) and if there is still ambiguity the ellipse closest to the image origin will be selected as (0,0).
For each circle there is one control point. The control point is first found by detecting all the ellipses, which is what a circle appears to be under perspective distortion. The center the ellipse might not match the physical center of the circle. The intersection of lines does not change under perspective distortion. The outer common tangent lines between neighboring ellipses are found. Then the intersection of two such lines is found. This intersection will be the physical center of the circle.
- See Also:
DetectCircleHexagonalGridpublic DetectCircleHexagonalGrid(int numRows, int numCols, InputToBinary<T> inputToBinary, BinaryEllipseDetector<T> ellipseDetector, EllipsesIntoClusters clustering)Creates and configures the detector
numRows- number of rows in grid
numCols- number of columns in grid
inputToBinary- Converts the input image into a binary image
ellipseDetector- Detects ellipses inside the image
clustering- Finds clusters of ellipses
configureContourDetectorprotected void configureContourDetector(T gray)Description copied from class:
DetectCircleGridConfigures the contour detector based on the image size. Setting a maximum contour and turning off recording of inner contours and improve speed and reduce the memory foot print significantly.
totalEllipsespublic int totalEllipses(int numRows, int numCols)Description copied from class:
DetectCircleGridComputes the number of ellipses on the grid
putGridIntoCanonicalprotected void putGridIntoCanonical(EllipseClustersIntoGrid.Grid g)Puts the grid into a canonical orientation