Basic Image AlgorithmS Library
2.8.0
|
Detects a checkerboard pattern (typically 7x4 inner corners, asymmetric layout recommended) in an image using a cross shaped image filter. More...
#include <FeatureDetector/CheckerboardDetectorCrossFilter.hh>
Public Member Functions | |
CheckerboardDetectorCrossFilter () | |
Standard constructor. More... | |
std::vector< HomgPoint2D > | GetCheckerboard (Image< unsigned char > img, int numberOfCols=7, int numberOfRows=4, bool upperLeftIsBlack=true) |
Find a checkerboard of size numberOfCols x numberOfRows in the given image. More... | |
virtual | ~CheckerboardDetectorCrossFilter () |
Static Public Member Functions | |
static int | Compute (BIAS::Image< unsigned char > &img, const unsigned int &xCorners, const unsigned int &yCorners, t_CoordVecf &coords, const bool &saveDebugImage=false) |
Detects a (recommended asymmetric) checkerboard pattern. More... | |
Protected Member Functions | |
bool | doLinesIntersect (HomgPoint2D &a, HomgPoint2D &b, HomgPoint2D &c, HomgPoint2D &d) |
Check if the finite lines a - b and c - d intersect. More... | |
void | ExtendTopology (Image< unsigned char > &img, std::vector< HomgPoint2D > &knotPositions, std::deque< std::deque< int > > &rectTopolog) |
Find the side of the rectangular topology which is most likely not on the edge of the checkerboard and extend the checkerboard to it. More... | |
void | GenerateRectangularTopology (Image< unsigned char > &img, std::vector< HomgPoint2D > &knotPositions, std::vector< std::vector< int > > &adjacence, std::deque< std::deque< int > > &rectTopolog) |
Generate a rectangular topology out of the adjcence lists. More... | |
double | getAverage (Image< unsigned char > &img, HomgPoint2D center, int halfWinSize) |
Get the average image grey value (also for color images) in a window. More... | |
void | GetAvgBlackWhiteValue (Image< unsigned char > &img, std::vector< HomgPoint2D > points, double &avgBlack, double &avgWhite, int angleSteps) |
Calculate the average black and white values of the cross filter at a given set of points. More... | |
void | GetCCACenter (const std::vector< HomgPoint2D > pixels, std::vector< HomgPoint2D > ¢ers, int width, int height) |
Calculate a connected components analysis for a given set of pixel coordinates. More... | |
double | GetCheckerLineFactor (Image< unsigned char > img, HomgPoint2D a, HomgPoint2D b) |
Calculate a fitness value for the line between a and b to be a checkerboard line. More... | |
void | GetFilterResponseSum (Image< unsigned char > &img, std::vector< HomgPoint2D > &response, float threshold=25000.0, int halfWinSize=20, bool fastMode=true) |
Calculate the filter result for the whole image and return the pixel coordinates above the given threshold. More... | |
std::vector< HomgPoint2D > | GetFinalCheckerboard (Image< unsigned char > &img, std::vector< HomgPoint2D > &knotPositions, std::deque< std::deque< int > > &rectTopolog, int numberOfRows, int numberOfCols, bool upperLeftIsBlack) |
Analyse the rectangular topology and rotate and flip the checkerboard to its unique representation. More... | |
HomgPoint2D | lineIntersection (HomgPoint2D &a, HomgPoint2D &b, HomgPoint2D &c, HomgPoint2D &d) |
Calculate the intersection point of the infinite lines a - b and c - d. More... | |
void | SearchForMissingTopologyEntries (Image< unsigned char > &img, std::vector< HomgPoint2D > &knotPositions, std::deque< std::deque< int > > &rectTopolog) |
Fill the topology entries that are unknown (negative indices) by generating an appropriate knot. More... | |
void | StretchImageValues (Image< unsigned char > &img, unsigned int from, unsigned int to) |
Stretch the image values such that from => 0 and to => 255. More... | |
Protected Attributes | |
int | defaultAngleSteps_ |
The default number of rotation stpes performed at each filter evaluation. More... | |
int | defaultHalfWinSize_ |
The default half window size of the filter window. More... | |
int | initialFilterThreshold_ |
The initial value for the filter response threshold for a pixel to be evaluated further. More... | |
int | initialLineThreshold_ |
The initial value for the line threshold in the topology generation. More... | |
Static Protected Attributes | |
static CheckerboardDetectorCrossFilter * | instancePointer_ = NULL |
Instance pointer if an instance was created. More... | |
Detects a checkerboard pattern (typically 7x4 inner corners, asymmetric layout recommended) in an image using a cross shaped image filter.
Definition at line 36 of file CheckerboardDetectorCrossFilter.hh.
CheckerboardDetectorCrossFilter::CheckerboardDetectorCrossFilter | ( | ) |
Standard constructor.
Definition at line 19 of file CheckerboardDetectorCrossFilter.cpp.
|
virtual |
Definition at line 40 of file CheckerboardDetectorCrossFilter.cpp.
|
static |
Detects a (recommended asymmetric) checkerboard pattern.
img | Input image |
xCorners | Number of inner checkerboard corners in x direction |
yCorners | Number of inner checkerboard corners in y direction |
coords | The resulting set of corner coordinates |
saveDebugImage | ignored (just for compatibility) |
Definition at line 47 of file CheckerboardDetectorCrossFilter.cpp.
Referenced by BIAS::ImageCanvasCheckerboardExtract::SelectCheckerboardCorners().
|
protected |
Check if the finite lines a - b and c - d intersect.
Definition at line 1159 of file CheckerboardDetectorCrossFilter.cpp.
|
protected |
Find the side of the rectangular topology which is most likely not on the edge of the checkerboard and extend the checkerboard to it.
img | Input image |
knotPositions | The image coordinates of the knots |
rectTopolog | The rectangular topology of the knots |
Definition at line 643 of file CheckerboardDetectorCrossFilter.cpp.
|
protected |
Generate a rectangular topology out of the adjcence lists.
img | Input image |
knotPositions | The image coordinates of the knots |
adjacence | The adjacence list for each knot |
rectTopolog | The resulting rectangular output structure |
Definition at line 276 of file CheckerboardDetectorCrossFilter.cpp.
|
protected |
Get the average image grey value (also for color images) in a window.
img | Input image |
center | The center of the square window |
halfWinSize | The half size of the square the value is calculated from |
Definition at line 1176 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::GetWidth().
|
protected |
Calculate the average black and white values of the cross filter at a given set of points.
img | Input image |
points | The set of positions the filters are evaluated |
avgBlack | The resulting average black value |
avgWhite | The resulting average white value |
angleStep | The number of rotations of the cross filter |
Definition at line 78 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetChannelCount(), and BIAS::Image< StorageType >::GetImageDataArray().
|
protected |
Calculate a connected components analysis for a given set of pixel coordinates.
pixels | The input pixel coordinates |
centers | The centers of weight of the resulting cluster |
width | The maximum x component of the input pixels |
height | The maximum y component of the input pixels |
Definition at line 239 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::BlobDetectorCCA< StorageType >::Detect(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::SetZero().
vector< HomgPoint2D > CheckerboardDetectorCrossFilter::GetCheckerboard | ( | Image< unsigned char > | img, |
int | numberOfCols = 7 , |
||
int | numberOfRows = 4 , |
||
bool | upperLeftIsBlack = true |
||
) |
Find a checkerboard of size numberOfCols x numberOfRows in the given image.
img | Input image |
numberOfCols | The number of corners on the checkerboard in horizontal direction |
numberOfRows | The number of corners on the checkerboard in vertical direction |
upperLeftIsBlack | Set true if the field between corners (0,0), (0,1), (1,0) and (1,1) is black |
Definition at line 946 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::GetWidth().
|
protected |
Calculate a fitness value for the line between a and b to be a checkerboard line.
Definition at line 1196 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::GetWidth().
|
protected |
Calculate the filter result for the whole image and return the pixel coordinates above the given threshold.
img | Input image |
response | The set of pixels above the threshold |
threshold | Filter threshold |
halfWinSize | The size of the cross filter |
fastMode | speed up the filter search but risk missing some points |
Definition at line 133 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::GetWidth().
|
protected |
Analyse the rectangular topology and rotate and flip the checkerboard to its unique representation.
img | Input image |
knotPositions | The image coordinates of the knots |
rectTopolog | The rectangular topology |
numberOfRows | The expected number of rows of the checkerboard |
numberOfCols | The expected number of columns of the checkerboard |
upperLeftIsBlack | Set true if the field between corners (0,0), (0,1), (1,0) and (1,1) is black |
Definition at line 844 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::Vector3< T >::CrossProduct(), BIAS::ImageBase::GetChannelCount(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::Vector3< T >::size().
|
protected |
Calculate the intersection point of the infinite lines a - b and c - d.
Definition at line 1169 of file CheckerboardDetectorCrossFilter.cpp.
|
protected |
Fill the topology entries that are unknown (negative indices) by generating an appropriate knot.
img | Input image |
knotPositions | The image coordinates of the knots |
rectTopolog | The rectangular topology |
Definition at line 602 of file CheckerboardDetectorCrossFilter.cpp.
|
protected |
Stretch the image values such that from => 0 and to => 255.
img | Input image |
from | The value that is pulled to 0 |
to | The value that is pushed to 255 |
Definition at line 220 of file CheckerboardDetectorCrossFilter.cpp.
References BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::ImageBase::GetWidth().
|
protected |
The default number of rotation stpes performed at each filter evaluation.
Definition at line 186 of file CheckerboardDetectorCrossFilter.hh.
|
protected |
The default half window size of the filter window.
Definition at line 183 of file CheckerboardDetectorCrossFilter.hh.
|
protected |
The initial value for the filter response threshold for a pixel to be evaluated further.
Definition at line 189 of file CheckerboardDetectorCrossFilter.hh.
|
protected |
The initial value for the line threshold in the topology generation.
Definition at line 192 of file CheckerboardDetectorCrossFilter.hh.
|
staticprotected |
Instance pointer if an instance was created.
This hack is needed to stay compatible to the static function calls of the other checkerboard detectors
Definition at line 196 of file CheckerboardDetectorCrossFilter.hh.