Package boofcv.alg.fiducial.calib.chess
Class ChessboardCornerClusterToGrid
java.lang.Object
boofcv.alg.fiducial.calib.chess.ChessboardCornerClusterToGrid
- All Implemented Interfaces:
VerbosePrint
Given a chessboard corner cluster find the grid which it matches. A grid is an ordering of corners in a specific
order and such that their edges are consistent and form a 4-neighborhood. The grid will be in "standard order".
Depending on the chessboard pattern there might be multiple multiple configurations that are in standard order
or a unique ordering.
On a grid a "Corner" is defined as a corner point which has a black square attached to it which is not attached
to any more corner points. These are useful in that they allow orientation to be uniquely defined under certain
conditions. If the "allowNoCorner" flag is true then grid with no corners are allowed.
The corner point at grid(0,0) will be set to a valid corner point with a "corner" that's closest to the (0,0) pixel
coordinate. If there are no corner points then the corner which is closest to (0,0) pixel is selected.
Edges will be ordered in CCW direction and the index of an edge which connects two adjacent corners to
each other follows the (i+2)%4 relationship. If multiple corners can be (0,0) then the one closest to
the top left corner will be selected.
The largest rectangular grid is returned. The idea being that it's not uncommon for there to be noise
which adds an extra stray element. This will remove those stray elements.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
static class
-
Field Summary
Modifier and TypeFieldDescriptionboolean
If false then a hole in the middle of the grid will be considered a failureboolean
If true then it will find the largest rectangular grid and return this.protected int
Dimension of the sparse/dense gridsprotected int
Dimension of the sparse/dense grids -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
clusterToSparse
(ChessboardCornerGraph cluster) Converts the graph into a sparse grid.getDense
(int row, int col) Used to access an element in the sparse gridboolean
Returns true of the candidate is the top-left corner in a white square.void
Rotates the grid in the CCW directionvoid
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> configuration) void
Converts the sparse into a dense gridboolean
After the sparse grid has been found this function can then be called to extract a complete target.
-
Field Details
-
findLargestGrid
public boolean findLargestGridIf true then it will find the largest rectangular grid and return this. This will often remove stray noise -
allowHoles
public boolean allowHolesIf false then a hole in the middle of the grid will be considered a failure -
sparseCols
protected int sparseColsDimension of the sparse/dense grids -
sparseRows
protected int sparseRowsDimension of the sparse/dense grids
-
-
Constructor Details
-
ChessboardCornerClusterToGrid
public ChessboardCornerClusterToGrid()
-
-
Method Details
-
clusterToSparse
Converts the graph into a sparse grid. This ensures that chessboard constraints are logically consistent in the grid- Returns:
- true if no errors were detected
-
sparseToGrid
After the sparse grid has been found this function can then be called to extract a complete target. It will find the largest rectangular region with all the elements contained.- Parameters:
info
- (Output) Found rectangular grid- Returns:
- true if no errors were detected
-
sparseToDense
public void sparseToDense()Converts the sparse into a dense grid -
isWhiteSquareOrientation
Returns true of the candidate is the top-left corner in a white square.- Parameters:
a
- Corner at top-leftc
- Corner at bottom-right
-
rotateCCW
Rotates the grid in the CCW direction -
getDense
Used to access an element in the sparse grid -
setVerbose
public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration) - Specified by:
setVerbose
in interfaceVerbosePrint
-