#include <GT2004BallSpecialist.h>
Public Member Functions | |
GT2004BallSpecialist (const ColorCorrector &colorCorrector) | |
void | searchBall (const Image &image, const ColorTable &colorTable, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, int x, int y, BallPercept &ballPercept) |
unsigned char | getSimilarityToOrange (unsigned char y, unsigned char u, unsigned char v) |
Private Member Functions | |
void | scanForBallPoints (const Image &image, const CameraInfo &bwCameraInfo, const ColorTable &colorTable, int x, int y, BallPointList &ballPoints, int &countAmbiguous, int &countOrange, int &maxOrangePerLine, int &countPixel) |
bool | findEndOfBall (const Image &image, const CameraInfo &bwCameraInfo, const ColorTable &colorTable, const BallPoint &start, const Vector2< int > &step, BallPoint &destination, int &countAmbiguous, int &countOrange, int &maxOrangePerLine, int &countPixel) |
bool | createBallPerceptLevenbergMarquardt (const BallPointList &ballPoints, Vector2< int > ¢er, double &radius) |
bool | checkIfPointsAreInsideBall (const BallPointList &ballPoints, Vector2< int > ¢er, double radius) |
void | addBallPercept (const Image &image, const CameraInfo &bwCameraInfo, const ColorTable &colorTable, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const Vector2< int > ¢er, double radius, BallPercept &ballPercept) |
Private Attributes | |
const ColorCorrector & | colorCorrector |
Classes | |
class | BallPoint |
class | BallPointList |
Definition at line 28 of file GT2004BallSpecialist.h.
GT2004BallSpecialist::GT2004BallSpecialist | ( | const ColorCorrector & | colorCorrector | ) |
Definition at line 24 of file GT2004BallSpecialist.cpp.
void GT2004BallSpecialist::addBallPercept | ( | const Image & | image, | |
const CameraInfo & | bwCameraInfo, | |||
const ColorTable & | colorTable, | |||
const CameraMatrix & | cameraMatrix, | |||
const CameraMatrix & | prevCameraMatrix, | |||
const Vector2< int > & | center, | |||
double | radius, | |||
BallPercept & | ballPercept | |||
) | [private] |
The function checks whether a ball percept is plausible and will add it if so.
image | The image the ballpercept comes from. | |
bwCameraInfo | Object containing camera parameters. | |
colorTable | The colortable to be used | |
cameraMatrix | The matrix of the camera of the image. | |
prevCameraMatrix | The matrix of the camera of a previous image. | |
center | The center of the ball. | |
radius | The radius of the ball. | |
ballPercept | The object the ball is added to. |
Definition at line 618 of file GT2004BallSpecialist.cpp.
References BallPercept::add(), Drawings::black, Geometry::calculateAnglesForPoint(), ColorClasses::colorClassToDrawingsColor(), CORRECTED_COLOR_CLASS, DOT, CameraInfo::focalLengthInv, BresenhamLineScan::getNext(), Drawings::gray, gray, image, int(), CameraMatrix::isValid, CameraInfo::opticalCenter, orange, pi_4, Geometry::pixelSizeToAngleSize(), Pose3D::rotation, Pose3D::translation, Vector2< V >::x, Vector2< V >::y, and Vector3< V >::z.
bool GT2004BallSpecialist::checkIfPointsAreInsideBall | ( | const BallPointList & | ballPoints, | |
Vector2< int > & | center, | |||
double | radius | |||
) | [private] |
Definition at line 605 of file GT2004BallSpecialist.cpp.
References Geometry::distance(), and GT2004BallSpecialist::BallPointList::number.
bool GT2004BallSpecialist::createBallPerceptLevenbergMarquardt | ( | const BallPointList & | ballPoints, | |
Vector2< int > & | center, | |||
double & | radius | |||
) | [private] |
The function tries to calculate the ball percept by using the Levenberg-Marquardt algorithm. The function fails if less than 3 points are available.
Definition at line 526 of file GT2004BallSpecialist.cpp.
References idText, int(), GT2004BallSpecialist::BallPointList::number, OUTPUT, Matrix_nxn< T, N >::solve(), text, Vector2< V >::x, and Vector2< V >::y.
bool GT2004BallSpecialist::findEndOfBall | ( | const Image & | image, | |
const CameraInfo & | bwCameraInfo, | |||
const ColorTable & | colorTable, | |||
const BallPoint & | start, | |||
const Vector2< int > & | step, | |||
BallPoint & | destination, | |||
int & | countAmbiguous, | |||
int & | countOrange, | |||
int & | maxOrangePerLine, | |||
int & | countPixel | |||
) | [private] |
Finds the end of the ball
Definition at line 352 of file GT2004BallSpecialist.cpp.
References GT2004BallSpecialist::BallPoint::atBorder, Drawings::blue, blue, colorCorrector, ColorCorrector::correct(), CORRECTED_COLOR_CLASS, getSimilarityToOrange(), green, Drawings::green, GT2004BallSpecialist::BallPoint::greenIsClose, GT2004BallSpecialist::BallPoint::hardEdge, image, LINE, max, Drawings::orange, orange, Drawings::pink, pink, Drawings::ps_solid, Drawings::red, red, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Drawings::skyblue, skyblue, Vector2< V >::x, Vector2< V >::y, yellow, and GT2004BallSpecialist::BallPoint::yellowIsClose.
Referenced by scanForBallPoints().
unsigned char GT2004BallSpecialist::getSimilarityToOrange | ( | unsigned char | y, | |
unsigned char | u, | |||
unsigned char | v | |||
) | [inline] |
Returns the Similarity of the given color to orange.
Definition at line 49 of file GT2004BallSpecialist.h.
References b, Image::convertFromYCbCrToRGB(), max, and min.
Referenced by findEndOfBall().
void GT2004BallSpecialist::scanForBallPoints | ( | const Image & | image, | |
const CameraInfo & | bwCameraInfo, | |||
const ColorTable & | colorTable, | |||
int | x, | |||
int | y, | |||
BallPointList & | ballPoints, | |||
int & | countAmbiguous, | |||
int & | countOrange, | |||
int & | maxOrangePerLine, | |||
int & | countPixel | |||
) | [private] |
Scan for the ball starting at a given trigger point
Definition at line 158 of file GT2004BallSpecialist.cpp.
References GT2004BallSpecialist::BallPointList::add(), GT2004BallSpecialist::BallPoint::atBorder, Drawings::black, DOT, east, findEndOfBall(), image, north, south, west, Drawings::white, Vector2< V >::x, and Vector2< V >::y.
void GT2004BallSpecialist::searchBall | ( | const Image & | image, | |
const ColorTable & | colorTable, | |||
const CameraMatrix & | cameraMatrix, | |||
const CameraMatrix & | prevCameraMatrix, | |||
int | x, | |||
int | y, | |||
BallPercept & | ballPercept | |||
) |
Searches for the ball in the image, starting from the secified point.
Definition at line 33 of file GT2004BallSpecialist.cpp.
References CameraInfo::focalLength, CameraInfo::focalLengthInv, image, GT2004BallSpecialist::BallPointList::number, CameraInfo::opticalCenter, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.
Referenced by GT2004ImageProcessor::execute().
const ColorCorrector& GT2004BallSpecialist::colorCorrector [private] |