Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CheckerboardDetector Class Reference

A solution of the ImageProcessor module that looks for vertical checkerboards (a row of black and white ~10x10cm tiles with a white boarder and a middle mark in eye height that allows precise location of the robot relative to the checkerboard from a single image. More...

#include <CheckerboardDetector.h>

Inheritance diagram for CheckerboardDetector:

Inheritance graph
[legend]
Collaboration diagram for CheckerboardDetector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CheckerboardDetector (const ImageProcessorInterfaces &interfaces)
 Constructor.

virtual void execute ()
 Executes the module.


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)
 calculates the exact middle of an black white transition in a PixeledLine.

Vector2< double > getExactTransitionMiddle (const Geometry::PixeledLine lin, const int start, const int amount)
 calculates the exact middle of an black white transition in a PixeledLine.

void getTransitionsOnLine (const Geometry::PixeledLine lin, v2dArray *transPos, bArray *transWhiteBlack, int &numOfTrans)
 finds all black white transitions in a PixeledLine

Vector2< double > getTransitionToWhite (const Geometry::PixeledLine lin)
 finds the first transition to white starting from within a black block

Vector2< double > getMiddleAndLengthOfPerpendicular (const Vector2< double > t1, const Vector2< double > t2, double &len)
 calculate a middle perpendicular to t1-t2, find transitions to white on that perpendicular and return the middle between the transitions to white.

bool getLineThroughPixelsCandidate (const v2dArray *points, const int numOfPoints, double &m, double &n)
 approximates a line f(x)=m*x+n through a number of points

bool getLineThroughPixels (const v2dArray *points, const int numOfPoints, Geometry::PixeledLine &lin)
 approximates a PixeledLine through a number of points without found elopers

Vector2< double > getPositionFromAngles (const double alpha2, const double a2, const double alpha1, const double a1)
 calculate a position relative to the checkerboard

double yPosFromTransitionIndex (int index)
 calculate the real y position of a black white transition on the checkerboard


Private Attributes

int minY
int maxY
int maxDelta

Detailed Description

A solution of the ImageProcessor module that looks for vertical checkerboards (a row of black and white ~10x10cm tiles with a white boarder and a middle mark in eye height that allows precise location of the robot relative to the checkerboard from a single image.

Author:
Uwe Düffert

Definition at line 28 of file CheckerboardDetector.h.


Member Typedef Documentation

typedef Vector2<double> CheckerboardDetector::v2dArray[100] [private]
 

Definition at line 44 of file CheckerboardDetector.h.

Referenced by execute(), getLineThroughPixels(), getLineThroughPixelsCandidate(), and getTransitionsOnLine().

typedef bool CheckerboardDetector::bArray[100] [private]
 

Definition at line 45 of file CheckerboardDetector.h.

Referenced by execute(), and getTransitionsOnLine().


Constructor & Destructor Documentation

CheckerboardDetector::CheckerboardDetector const ImageProcessorInterfaces interfaces  ) 
 

Constructor.

Parameters:
interfaces The paramters of the ImageProcessor module.

Definition at line 12 of file CheckerboardDetector.cpp.


Member Function Documentation

void CheckerboardDetector::execute  )  [virtual]
 

Executes the module.

Implements Module.

Definition at line 335 of file CheckerboardDetector.cpp.

References bArray, Image::cameraInfo, SpecialPercept::checkerPose, DEBUG_IMAGE_SET_PIXEL_BLACK, DEBUG_IMAGE_SET_PIXEL_BLUE, DEBUG_IMAGE_SET_PIXEL_GREEN, DEBUG_IMAGE_SET_PIXEL_RED, DEBUG_IMAGE_SET_PIXEL_WHITE, DEBUG_IMAGE_SET_PIXEL_Y, DEBUG_IMAGE_SET_PIXEL_YELLOW, RobotDimensions::distancePanCenterToCameraX, Image::frameNumber, getAngleBetweenScreenPoints(), getLineThroughPixels(), getMiddleAndLengthOfPerpendicular(), Geometry::PixeledLine::getNumberOfPixels(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), getPositionFromAngles(), getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), getTransitionsOnLine(), Image::image, INIT_DEBUG_IMAGE, maxDelta, maxY, minY, CameraInfo::openingAngleWidth, SpecialPercept::reset(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Pose2D::rotation, Pose3D::rotation, SEND_DEBUG_IMAGE, Pose2D::translation, SpecialPercept::type, v2dArray, Vector3< V >::x, Vector2< V >::x, Vector2< double >::x, Vector3< V >::y, Vector2< double >::y, Vector2< V >::y, and yPosFromTransitionIndex().

Here is the call graph for this function:

CheckerboardDetector::DECLARE_DEBUG_IMAGE imageProcessorGeneral   )  [private]
 

double CheckerboardDetector::getAngleBetweenScreenPoints const Vector2< double > &  p1,
const Vector2< double > &  p2
[private]
 

calculates the exact middle of an black white transition in a PixeledLine.

Parameters:
p1 one point in camera coordinates
p2 another point in camera coordinates
Returns:
the resulting arc difference between these 2 points

Definition at line 277 of file CheckerboardDetector.cpp.

References Image::cameraInfo, CameraInfo::openingAngleHeight, CameraInfo::openingAngleWidth, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().

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.

Parameters:
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
Returns:
the resulting position of the middle of the black white transition

Definition at line 17 of file CheckerboardDetector.cpp.

References Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, Vector2< V >::x, and Vector2< V >::y.

Referenced by getTransitionsOnLine(), and getTransitionToWhite().

Here is the call graph for this function:

void CheckerboardDetector::getTransitionsOnLine const Geometry::PixeledLine  lin,
v2dArray transPos,
bArray transWhiteBlack,
int &  numOfTrans
[private]
 

finds all black white transitions in a PixeledLine

Parameters:
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 bArray, DEBUG_IMAGE_SET_PIXEL_BLUE, DEBUG_IMAGE_SET_PIXEL_RED, getExactTransitionMiddle(), Geometry::PixeledLine::getNumberOfPixels(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, maxDelta, and v2dArray.

Referenced by execute().

Here is the call graph for this function:

Vector2< double > CheckerboardDetector::getTransitionToWhite const Geometry::PixeledLine  lin  )  [private]
 

finds the first transition to white starting from within a black block

Parameters:
lin the PixeledLine to investigate
Returns:
the position of the found transition to white, (-1,-1) otherwise

Definition at line 107 of file CheckerboardDetector.cpp.

References getExactTransitionMiddle(), Geometry::PixeledLine::getNumberOfPixels(), Geometry::PixeledLine::getPixelX(), Geometry::PixeledLine::getPixelY(), Image::image, maxDelta, maxY, and minY.

Referenced by getMiddleAndLengthOfPerpendicular().

Here is the call graph for this function:

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.

Parameters:
t1 beginning of black block
t2 end of black block
len returned length of the found perpendicular in black, 0 otherwise
Returns:
the position of of found middle of the perpendicular (if it exists), (-1,-1) otherwise

Definition at line 148 of file CheckerboardDetector.cpp.

References Image::cameraInfo, Geometry::clipLineWithRectangleCohenSutherland(), getTransitionToWhite(), pi_2, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().

Here is the call graph for this function:

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

Parameters:
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)
Returns:
true if a line (candidate) was found

Definition at line 178 of file CheckerboardDetector.cpp.

References v2dArray.

Referenced by getLineThroughPixels().

bool CheckerboardDetector::getLineThroughPixels const v2dArray points,
const int  numOfPoints,
Geometry::PixeledLine lin
[private]
 

approximates a PixeledLine through a number of points without found elopers

Parameters:
points an array of points that should be approximated by a line
numOfPoints number of points in the array
lin the returned PixeledLine
Returns:
true if a line was found

Definition at line 207 of file CheckerboardDetector.cpp.

References Image::cameraInfo, Geometry::clipLineWithRectangleCohenSutherland(), getLineThroughPixelsCandidate(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, and v2dArray.

Referenced by execute().

Here is the call graph for this function:

Vector2< double > CheckerboardDetector::getPositionFromAngles const double  alpha2,
const double  a2,
const double  alpha1,
const double  a1
[private]
 

calculate a position relative to the checkerboard

Parameters:
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
Returns:
returned position relative to seen middle transition in checkerboard

Definition at line 249 of file CheckerboardDetector.cpp.

References pi, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().

double CheckerboardDetector::yPosFromTransitionIndex int  index  )  [private]
 

calculate the real y position of a black white transition on the checkerboard

Parameters:
index index of the black white transition relative to the left side (0) of the large black middle block, left is negative, right positive
Returns:
real y position

Definition at line 330 of file CheckerboardDetector.cpp.

Referenced by execute().


Member Data Documentation

int CheckerboardDetector::minY [private]
 

Definition at line 43 of file CheckerboardDetector.h.

Referenced by execute(), and getTransitionToWhite().

int CheckerboardDetector::maxY [private]
 

Definition at line 43 of file CheckerboardDetector.h.

Referenced by execute(), and getTransitionToWhite().

int CheckerboardDetector::maxDelta [private]
 

Definition at line 43 of file CheckerboardDetector.h.

Referenced by execute(), getTransitionsOnLine(), and getTransitionToWhite().


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 20:05:05 2004 for GT2004 by doxygen 1.3.6