#include <CheckerboardDetector.h>
Inheritance diagram for CheckerboardDetector:
Public Member Functions | |
CheckerboardDetector (const ImageProcessorInterfaces &interfaces) | |
virtual void | execute () |
Private Types | |
typedef Vector2< double > | v2dArray [100] |
typedef bool | bArray [100] |
Private Member Functions | |
DECLARE_DEBUG_IMAGE (imageProcessorGeneral) | |
double | getAngleBetweenScreenPoints (const Vector2< double > &p1, const Vector2< double > &p2) |
Vector2< double > | getExactTransitionMiddle (const Geometry::PixeledLine lin, const int start, const int amount) |
void | getTransitionsOnLine (const Geometry::PixeledLine lin, v2dArray *transPos, bArray *transWhiteBlack, int &numOfTrans) |
Vector2< double > | getTransitionToWhite (const Geometry::PixeledLine lin) |
Vector2< double > | getMiddleAndLengthOfPerpendicular (const Vector2< double > t1, const Vector2< double > t2, double &len) |
bool | getLineThroughPixelsCandidate (const v2dArray *points, const int numOfPoints, double &m, double &n) |
bool | getLineThroughPixels (const v2dArray *points, const int numOfPoints, Geometry::PixeledLine &lin) |
Vector2< double > | getPositionFromAngles (const double alpha2, const double a2, const double alpha1, const double a1) |
double | yPosFromTransitionIndex (int index) |
Private Attributes | |
int | minY |
int | maxY |
int | maxDelta |
Definition at line 28 of file CheckerboardDetector.h.
typedef bool CheckerboardDetector::bArray[100] [private] |
Definition at line 45 of file CheckerboardDetector.h.
typedef Vector2<double> CheckerboardDetector::v2dArray[100] [private] |
Definition at line 44 of file CheckerboardDetector.h.
CheckerboardDetector::CheckerboardDetector | ( | const ImageProcessorInterfaces & | interfaces | ) |
Constructor.
interfaces | The paramters of the ImageProcessor module. |
Definition at line 12 of file CheckerboardDetector.cpp.
CheckerboardDetector::DECLARE_DEBUG_IMAGE | ( | imageProcessorGeneral | ) | [private] |
void CheckerboardDetector::execute | ( | ) | [virtual] |
Executes the module
Implements Module.
Definition at line 335 of file CheckerboardDetector.cpp.
References Image::cameraInfo, DEBUG_IMAGE_SET_PIXEL_YELLOW, RobotDimensions::distancePanCenterToCameraX, Image::frameNumber, getMiddleAndLengthOfPerpendicular(), getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), getTransitionsOnLine(), Image::image, ImageProcessorInterfaces::image, INIT_DEBUG_IMAGE, maxDelta, maxY, minY, SpecialPercept::reset(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, ImageProcessorInterfaces::specialPercept, Vector2< V >::x, and Vector2< V >::y.
double CheckerboardDetector::getAngleBetweenScreenPoints | ( | const Vector2< double > & | p1, | |
const Vector2< double > & | p2 | |||
) | [private] |
calculates the exact middle of an black white transition in a PixeledLine.
p1 | one point in camera coordinates | |
p2 | another point in camera coordinates |
Definition at line 277 of file CheckerboardDetector.cpp.
References Image::cameraInfo, ImageProcessorInterfaces::image, CameraInfo::openingAngleHeight, CameraInfo::openingAngleWidth, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.
Vector2< double > CheckerboardDetector::getExactTransitionMiddle | ( | const Geometry::PixeledLine | lin, | |
const int | start, | |||
const int | amount | |||
) | [private] |
calculates the exact middle of an black white transition in a PixeledLine.
lin | the PixeledLine to investigate | |
start | index of black white transition in lin to investigate | |
amount | the total change of brightness in this black white transition |
Definition at line 17 of file CheckerboardDetector.cpp.
References abs(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, ImageProcessorInterfaces::image, Vector2< V >::x, and Vector2< V >::y.
Referenced by getTransitionsOnLine(), and getTransitionToWhite().
bool CheckerboardDetector::getLineThroughPixels | ( | const v2dArray * | points, | |
const int | numOfPoints, | |||
Geometry::PixeledLine & | lin | |||
) | [private] |
approximates a PixeledLine through a number of points without found elopers
points | an array of points that should be approximated by a line | |
numOfPoints | number of points in the array | |
lin | the returned PixeledLine |
Definition at line 207 of file CheckerboardDetector.cpp.
References Image::cameraInfo, Geometry::clipLineWithRectangleCohenSutherland(), getLineThroughPixelsCandidate(), ImageProcessorInterfaces::image, CameraInfo::resolutionHeight, and CameraInfo::resolutionWidth.
bool CheckerboardDetector::getLineThroughPixelsCandidate | ( | const v2dArray * | points, | |
const int | numOfPoints, | |||
double & | m, | |||
double & | n | |||
) | [private] |
approximates a line f(x)=m*x+n through a number of points
points | an array of points that should be approximated by a line | |
numOfPoints | number of points in the array | |
m | the returned Anstieg of the line (f(x)=mx+n) | |
n | the returned offset of the line (f(x)=mx+n) |
Definition at line 178 of file CheckerboardDetector.cpp.
Referenced by getLineThroughPixels().
Vector2< double > CheckerboardDetector::getMiddleAndLengthOfPerpendicular | ( | const Vector2< double > | t1, | |
const Vector2< double > | t2, | |||
double & | len | |||
) | [private] |
calculate a middle perpendicular to t1-t2, find transitions to white on that perpendicular and return the middle between the transitions to white. This gives a better and more secure black block middle than the the middle between t1 and t2 itself.
t1 | beginning of black block | |
t2 | end of black block | |
len | returned length of the found perpendicular in black, 0 otherwise |
Definition at line 148 of file CheckerboardDetector.cpp.
References Image::cameraInfo, Geometry::clipLineWithRectangleCohenSutherland(), getTransitionToWhite(), ImageProcessorInterfaces::image, pi_2, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.
Referenced by execute().
Vector2< double > CheckerboardDetector::getPositionFromAngles | ( | const double | alpha2, | |
const double | a2, | |||
const double | alpha1, | |||
const double | a1 | |||
) | [private] |
calculate a position relative to the checkerboard
alpha2 | absolute angle between the left most and the middle seen black white transition | |
a2 | absolute distance on the checkboard between the left most and the middle seen black white transition | |
alpha1 | absolute angle between the middle and the right most seen black white transition | |
a1 | absolute distance on the checkboard between the middle and the right most seen black white transition |
Definition at line 249 of file CheckerboardDetector.cpp.
References b, pi, Vector2< V >::x, and Vector2< V >::y.
void CheckerboardDetector::getTransitionsOnLine | ( | const Geometry::PixeledLine | lin, | |
v2dArray * | transPos, | |||
bArray * | transWhiteBlack, | |||
int & | numOfTrans | |||
) | [private] |
finds all black white transitions in a PixeledLine
lin | the PixeledLine to investigate | |
transPos | returned array of found transition middle positions | |
transWhiteBlack | returned array of booleans whether transition is from white to black or vice versa | |
numOfTrans | returned number of found transitions |
Definition at line 36 of file CheckerboardDetector.cpp.
References abs(), DEBUG_IMAGE_SET_PIXEL_BLUE, DEBUG_IMAGE_SET_PIXEL_RED, getExactTransitionMiddle(), Geometry::PixeledLine::getNumberOfPixels(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, ImageProcessorInterfaces::image, maxDelta, Vector2< V >::x, and Vector2< V >::y.
Referenced by execute().
Vector2< double > CheckerboardDetector::getTransitionToWhite | ( | const Geometry::PixeledLine | lin | ) | [private] |
finds the first transition to white starting from within a black block
lin | the PixeledLine to investigate |
Definition at line 107 of file CheckerboardDetector.cpp.
References getExactTransitionMiddle(), Geometry::PixeledLine::getNumberOfPixels(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, ImageProcessorInterfaces::image, maxDelta, maxY, and minY.
Referenced by getMiddleAndLengthOfPerpendicular().
double CheckerboardDetector::yPosFromTransitionIndex | ( | int | index | ) | [private] |
calculate the real y position of a black white transition on the checkerboard
index | index of the black white transition relative to the left side (0) of the large black middle block, left is negative, right positive |
Definition at line 330 of file CheckerboardDetector.cpp.
int CheckerboardDetector::maxDelta [private] |
Definition at line 43 of file CheckerboardDetector.h.
Referenced by execute(), getTransitionsOnLine(), and getTransitionToWhite().
int CheckerboardDetector::maxY [private] |
Definition at line 43 of file CheckerboardDetector.h.
Referenced by execute(), and getTransitionToWhite().
int CheckerboardDetector::minY [private] |
Definition at line 43 of file CheckerboardDetector.h.
Referenced by execute(), and getTransitionToWhite().