GT2004ImageProcessor Class Reference

#include <GT2004ImageProcessor.h>

Inheritance diagram for GT2004ImageProcessor:

ImageProcessor Module ImageProcessorInterfaces MessageHandler List of all members.

Helpers for grid drawing

void plot (const unsigned char *p, Drawings::Color color)
const unsigned char * last
Drawings::Color lineColor

Public Member Functions

 GT2004ImageProcessor (const ImageProcessorInterfaces &interfaces)
virtual void execute ()
virtual bool handleMessage (InMessage &message)

Private Member Functions

void scanColumns ()
void scanRows ()
void scan (const Vector2< int > &start, const Vector2< int > &end, bool vertical, bool noLines)
void clusterRobots (const unsigned char *bottomPoint, bool redFound, bool blueFound)
void filterPercepts ()
void filterLinesPercept (LinesPercept &percept, int type, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const Image &image)
double calcEdgeAngle (const Vector2< int > &pointInImage, const Vector2< int > &pointOnField, double scanAngle, const RingBuffer< const unsigned char *, 7 > &pixelBuffer, const bool againstScanline=false, int channel=0) const
Vector2< int > getCoords (const unsigned char *p) const
 DECLARE_DEBUG_IMAGE (imageProcessorPlayers)
 DECLARE_DEBUG_IMAGE (imageProcessorGeneral)
 DECLARE_DEBUG_COLOR_CLASS_IMAGE (segmentedImage1)
 DECLARE_DEBUG_IMAGE (imageProcessorBall)
 DECLARE_DEBUG_IMAGE (imageProcessorGradients)

Private Attributes

double xFactor
double yFactor
int yThreshold
int vThreshold
int orangeCount
int noOrangeCount
int noRedCount
int noBlueCount
int noGoalCount
int closestBottom
Vector2< int > firstRed
Vector2< int > closestRed
Vector2< int > lastRed
Vector2< int > firstBlue
Vector2< int > closestBlue
Vector2< int > lastBlue
Vector2< int > firstFlag
Vector2< int > lastFlag
bool goalAtBorder
int longestBallRun
Vector2< int > ballCandidate
CameraMatrix cmTricot
CameraMatrix prevCameraMatrix
CameraMatrix prevCmTricot
ColorCorrector colorCorrector
GT2004BeaconDetector beaconDetector
GT2004GoalRecognizer goalRecognizer
GT2004BallSpecialist ballSpecialist
GT2004EdgeSpecialist edgeSpecialist
ImageInfo imageInfo
double angleBetweenDirectionOfViewAndGround
int numberOfScannedPixels
Matrix2x2< double > rotation2x2

Detailed Description

The lines image processor recognizes characteristic lines in the image. Four types of lines are distinguished: edges between the skyblue goal and the field, edges between the yellow goal and the field, edges between the border and the field, and edges between the field lines and the field.

The module scans vertical and horizontal lines in the image from top to bottom and from left to right. As the green of the field is very dark, all edges are characterized by a big difference of the y-channel of adjacent pixels. An increase in the y-channel followed by a decrease is an indication for an edge.

The projection of the pixels on the field plane is used to determine their relative position to the robot.

Author:
Matthias Juengel

Thomas Röfer

Definition at line 48 of file GT2004ImageProcessor.h.


Constructor & Destructor Documentation

GT2004ImageProcessor::GT2004ImageProcessor ( const ImageProcessorInterfaces interfaces  ) 

Constructor.

Parameters:
interfaces The paramters of the GT2004ImageProcessor module.

Definition at line 31 of file GT2004ImageProcessor.cpp.

References GT2004BeaconDetector::analyzeColorTable(), beaconDetector, pi, rotation2x2, vThreshold, and yThreshold.


Member Function Documentation

double GT2004ImageProcessor::calcEdgeAngle ( const Vector2< int > &  pointInImage,
const Vector2< int > &  pointOnField,
double  scanAngle,
const RingBuffer< const unsigned char *, 7 > &  pixelBuffer,
const bool  againstScanline = false,
int  channel = 0 
) const [private]

The function calculates the angle of an edge at an edge point.

Parameters:
pointInImage The edge point in image coordinates.
pointOnField The edge point in field coordinates.
scanAngle The angle of the scan line the point was found on.
pixelBuffer The pixels on the scan line around the edge point.
againstScanline The flag if bright to dark is detected against the direction of the scanline.
channel The channel the gradient is calculated in.
Returns:
The angle in relative robot field coordinates.

Definition at line 1397 of file GT2004ImageProcessor.cpp.

References Vector2< V >::abs(), Vector2< V >::angle(), ARROW, Geometry::calculatePointOnField(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, getCoords(), Image::image, ImageProcessorInterfaces::image, normalize(), pi, pi2, pi_2, Drawings::pink, prevCameraMatrix, Drawings::red, rotation2x2, LinesPercept::UNDEF, Vector2< V >::x, and Vector2< V >::y.

Referenced by scan().

void GT2004ImageProcessor::clusterRobots ( const unsigned char *  bottomPoint,
bool  redFound,
bool  blueFound 
) [private]

The function clusters points of red and blue robots.

Parameters:
bottomPoint The bottom point of the current scan column.
redFound Has a red robot point been found? In that case, the last entry in the lines percept is that point.
blueFound Has a blue robot point been found? In that case, the last entry in the lines percept is that point.

Definition at line 1229 of file GT2004ImageProcessor.cpp.

References Vector2< V >::abs(), PlayersPercept::addBluePlayer(), PlayersPercept::addRedPlayer(), LinesPercept::blueRobot, Geometry::calculatePointOnField(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, closestBlue, closestRed, distance(), firstBlue, firstRed, getCoords(), ImageProcessorInterfaces::image, int(), lastBlue, lastRed, ImageProcessorInterfaces::linesPercept, noBlueCount, noRedCount, LinesPercept::numberOfPoints, ImageProcessorInterfaces::playersPercept, LinesPercept::points, prevCameraMatrix, LinesPercept::redRobot, Vector2< V >::x, and Vector2< V >::y.

GT2004ImageProcessor::DECLARE_DEBUG_COLOR_CLASS_IMAGE ( segmentedImage1   )  [private]

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE ( imageProcessorGradients   )  [private]

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE ( imageProcessorBall   )  [private]

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE ( imageProcessorGeneral   )  [private]

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE ( imageProcessorPlayers   )  [private]

void GT2004ImageProcessor::execute (  )  [virtual]

Executes the module

Implements Module.

Definition at line 48 of file GT2004ImageProcessor.cpp.

References Goal::angle, Flag::angle, angleBetweenDirectionOfViewAndGround, ARROW, ballCandidate, ImageProcessorInterfaces::ballPercept, ballSpecialist, beaconDetector, Drawings::blue, Geometry::calculateHorizon(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, LandmarksPercept::cameraOffset, cmTricot, Goal::color, ImageProcessorInterfaces::colorTable, Geometry::Line::direction, edgeSpecialist, ImageProcessorInterfaces::edgesPercept, GT2004GoalRecognizer::execute(), GT2004BeaconDetector::execute(), filterPercepts(), LandmarksPercept::flags, CameraInfo::focalLength, CameraMatrix::frameNumber, Image::frameNumber, GT2004EdgeSpecialist::getEdgesPercept(), Geometry::getIntersectionPointsOfLineAndRectangle(), getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), goalRecognizer, LandmarksPercept::goals, ImageInfo::horizon, ImageInfo::horizonEnd, ImageInfo::horizonInImage, ImageInfo::horizonStart, idText, ImageProcessorInterfaces::image, imageInfo, INIT_DEBUG_IMAGE, Pose3D::invert(), ImageProcessorInterfaces::landmarksPercept, ImageProcessorInterfaces::linesPercept, ColorCorrector::load(), longestBallRun, ImageInfo::maxImageCoordinates, RobotDimensions::motionCycleTime, normalize(), Geometry::Line::normalizeDirection(), LandmarksPercept::numberOfFlags, LandmarksPercept::numberOfGoals, numberOfScannedPixels, ImageProcessorInterfaces::obstaclesPercept, CameraInfo::opticalCenter, OUTPUT, pi, Flag::pinkAboveSkyblue, ImageProcessorInterfaces::playersPercept, prevCameraMatrix, prevCmTricot, Drawings::ps_solid, Drawings::red, GT2004EdgeSpecialist::reset(), EdgesPercept::reset(), ObstaclesPercept::reset(), PlayersPercept::reset(), BallPercept::reset(), LinesPercept::reset(), LandmarksPercept::reset(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Pose3D::rotation, scanColumns(), scanRows(), GT2004BallSpecialist::searchBall(), sqr, text, toDegrees(), Pose3D::translation, Flag::type, ImageInfo::vertLine, Vector2< V >::x, Vector3< V >::x, xFactor, Vector2< V >::y, Vector3< V >::y, yellow, Flag::yellowAbovePink, yFactor, and Vector3< V >::z.

Referenced by BB2004Calibrator::evolve().

void GT2004ImageProcessor::filterLinesPercept ( LinesPercept percept,
int  type,
const CameraMatrix cameraMatrix,
const CameraMatrix prevCameraMatrix,
const Image image 
) [private]

The function filters the line-percepts, i.e. it removes potential misreadings, for the given line-type.

Definition at line 1497 of file GT2004ImageProcessor.cpp.

References Vector2< V >::angle(), normalize(), LinesPercept::numberOfPoints, and LinesPercept::points.

Referenced by filterPercepts().

void GT2004ImageProcessor::filterPercepts (  )  [private]

The function filters the percepts, i.e. it removes potential misreadings.

Definition at line 1295 of file GT2004ImageProcessor.cpp.

References PlayersPercept::bluePlayers, LinesPercept::border, ImageProcessorInterfaces::cameraMatrix, LinesPercept::field, filterLinesPercept(), ImageProcessorInterfaces::image, ImageProcessorInterfaces::linesPercept, PlayersPercept::numberOfBluePlayers, LinesPercept::numberOfLineTypes, LinesPercept::numberOfPoints, PlayersPercept::numberOfRedPlayers, pi, ImageProcessorInterfaces::playersPercept, prevCameraMatrix, and PlayersPercept::redPlayers.

Referenced by execute().

Vector2<int> GT2004ImageProcessor::getCoords ( const unsigned char *  p  )  const [inline, private]

The function converts an address to pixel coordinates.

Parameters:
p An address in image.image.
Returns:
The x- and y-coordinates of the corresponding pixel.

Definition at line 174 of file GT2004ImageProcessor.h.

References cameraResolutionWidth_ERS7, Image::image, and ImageProcessorInterfaces::image.

Referenced by calcEdgeAngle(), clusterRobots(), plot(), and scan().

bool GT2004ImageProcessor::handleMessage ( InMessage message  )  [virtual]

Handles an incoming message

Parameters:
message The message

Reimplemented from Module.

Definition at line 1476 of file GT2004ImageProcessor.cpp.

References GT2004BeaconDetector::analyzeColorTable(), beaconDetector, InMessage::getMessageID(), and idColorTable64.

void GT2004ImageProcessor::plot ( const unsigned char *  p,
Drawings::Color  color 
) [private]

Definition at line 1459 of file GT2004ImageProcessor.cpp.

References getCoords(), last, LINE, lineColor, Drawings::numberOfColors, Drawings::ps_solid, Vector2< V >::x, and Vector2< V >::y.

void GT2004ImageProcessor::scan ( const Vector2< int > &  start,
const Vector2< int > &  end,
bool  vertical,
bool  noLines 
) [private]

The function scans a line for line points.

Parameters:
start The start point of the line.
end The end point of the line.
vertical Vertical lines are scanned for more information.
noLines Should the line not be scanned for points on field lines or borders?

Definition at line 509 of file GT2004ImageProcessor.cpp.

References abs(), LinesPercept::add(), ballCandidate, blue, Player::blue, LinesPercept::blueRobot, LinesPercept::border, calcEdgeAngle(), Geometry::calculateLineSize(), Geometry::calculatePointOnField(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, GT2004EdgeSpecialist::checkPoint(), closestBottom, cmTricot, COLOR_CLASS, ColorClasses::colorClassToDrawingsColor(), colorCorrector, ColorCorrector::correct(), DEBUG_IMAGE_SET_PIXEL_BLACK, DEBUG_IMAGE_SET_PIXEL_GREEN, DEBUG_IMAGE_SET_PIXEL_PINK, DEBUG_IMAGE_SET_PIXEL_RED, DEBUG_IMAGE_SET_PIXEL_YELLOW, dist(), distance(), DOT, edgeSpecialist, LinesPercept::field, firstBlue, firstRed, getCoords(), getPlayer(), Geometry::getSizeByDistance(), Player::getTeamColor(), goalAtBorder, gray, Drawings::gray, green, Image::image, ImageProcessorInterfaces::image, int(), CameraMatrix::isValid, lastBlue, lastRed, LINE, lineColor, ImageProcessorInterfaces::linesPercept, longestBallRun, noColor, noOrangeCount, Drawings::numberOfColors, LinesPercept::numberOfLineTypes, LinesPercept::numberOfPoints, numberOfScannedPixels, orange, orangeCount, Drawings::pink, pink, PLOT, prevCameraMatrix, prevCmTricot, Drawings::ps_solid, Drawings::red, red, Player::red, LinesPercept::redRobot, GT2004EdgeSpecialist::resetLine(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, sgn, CameraInfo::simulated, skyblue, LinesPercept::skyblueGoal, sqr, Pose3D::translation, LinesPercept::UNDEF, vThreshold, Drawings::white, white, Vector2< V >::x, Vector2< V >::y, yellow, LinesPercept::yellowGoal, yThreshold, and Vector3< V >::z.

Referenced by scanColumns(), and scanRows().

void GT2004ImageProcessor::scanColumns (  )  [private]

The function scans columns for line points.

Definition at line 340 of file GT2004ImageProcessor.cpp.

References Geometry::Line::base, Image::cameraInfo, closestBottom, Geometry::Line::direction, Geometry::getIntersectionOfLines(), Geometry::getIntersectionPointsOfLineAndRectangle(), goalAtBorder, ImageInfo::horizon, ImageProcessorInterfaces::image, imageInfo, int(), ImageInfo::maxImageCoordinates, noBlueCount, noRedCount, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, scan(), ImageInfo::vertLine, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().

void GT2004ImageProcessor::scanRows (  )  [private]

The function scans rows for line points.

Definition at line 471 of file GT2004ImageProcessor.cpp.

References Geometry::Line::base, Geometry::Line::direction, Geometry::getIntersectionPointsOfLineAndRectangle(), Drawings::green, ImageInfo::horizon, imageInfo, LINE, ImageInfo::maxImageCoordinates, Drawings::ps_solid, scan(), ImageInfo::vertLine, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().


Member Data Documentation

double GT2004ImageProcessor::angleBetweenDirectionOfViewAndGround [private]

Definition at line 187 of file GT2004ImageProcessor.h.

Referenced by execute().

Vector2<int> GT2004ImageProcessor::ballCandidate [private]

Definition at line 86 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

GT2004BallSpecialist GT2004ImageProcessor::ballSpecialist [private]

The ball specialist.

Definition at line 98 of file GT2004ImageProcessor.h.

Referenced by execute().

GT2004BeaconDetector GT2004ImageProcessor::beaconDetector [private]

The beacon detector

Definition at line 94 of file GT2004ImageProcessor.h.

Referenced by execute(), GT2004ImageProcessor(), and handleMessage().

Vector2<int> GT2004ImageProcessor::closestBlue [private]

Closest blue robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots().

int GT2004ImageProcessor::closestBottom [private]

Closest bottom point on the grid.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by scan(), and scanColumns().

Vector2<int> GT2004ImageProcessor::closestRed [private]

Closest red robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots().

CameraMatrix GT2004ImageProcessor::cmTricot [private]

Camera matrix without tricot height.

Definition at line 88 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

ColorCorrector GT2004ImageProcessor::colorCorrector [private]

The color correction tool.

Definition at line 92 of file GT2004ImageProcessor.h.

Referenced by scan().

GT2004EdgeSpecialist GT2004ImageProcessor::edgeSpecialist [private]

The edge specialist.

Definition at line 100 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

Vector2<int> GT2004ImageProcessor::firstBlue [private]

First blue robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scan().

Vector2<int> GT2004ImageProcessor::firstFlag [private]

First flag point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Vector2<int> GT2004ImageProcessor::firstRed [private]

First red robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scan().

bool GT2004ImageProcessor::goalAtBorder [private]

Is the first goal point at the image border?

Definition at line 84 of file GT2004ImageProcessor.h.

Referenced by scan(), and scanColumns().

GT2004GoalRecognizer GT2004ImageProcessor::goalRecognizer [private]

The goal recognizer.

Definition at line 96 of file GT2004ImageProcessor.h.

Referenced by execute().

ImageInfo GT2004ImageProcessor::imageInfo [private]

Additional information about the current image

Definition at line 102 of file GT2004ImageProcessor.h.

Referenced by execute(), scanColumns(), and scanRows().

const unsigned char* GT2004ImageProcessor::last [private]

Definition at line 182 of file GT2004ImageProcessor.h.

Referenced by plot().

Vector2<int> GT2004ImageProcessor::lastBlue [private]

Last blue robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scan().

Vector2<int> GT2004ImageProcessor::lastFlag [private]

Last flag point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Vector2<int> GT2004ImageProcessor::lastRed [private]

Last red robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scan().

Drawings::Color GT2004ImageProcessor::lineColor [private]

Definition at line 183 of file GT2004ImageProcessor.h.

Referenced by plot(), and scan().

int GT2004ImageProcessor::longestBallRun [private]

Definition at line 85 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

int GT2004ImageProcessor::noBlueCount [private]

Number of columns without a blue robot point.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scanColumns().

int GT2004ImageProcessor::noGoalCount [private]

Number of columns without a opponent goal seen.

Definition at line 70 of file GT2004ImageProcessor.h.

int GT2004ImageProcessor::noOrangeCount [private]

Number of columns without a ball point.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by scan().

int GT2004ImageProcessor::noRedCount [private]

Number of columns without a red robot point.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by clusterRobots(), and scanColumns().

int GT2004ImageProcessor::numberOfScannedPixels [private]

Definition at line 189 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

int GT2004ImageProcessor::orangeCount [private]

Number of columns with ball points.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by scan().

CameraMatrix GT2004ImageProcessor::prevCameraMatrix [private]

The camera matrix of the previous image.

Definition at line 88 of file GT2004ImageProcessor.h.

Referenced by calcEdgeAngle(), clusterRobots(), execute(), filterPercepts(), and scan().

CameraMatrix GT2004ImageProcessor::prevCmTricot [private]

The tricot matrix of the previous image.

Definition at line 88 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

Matrix2x2<double> GT2004ImageProcessor::rotation2x2 [private]

Definition at line 191 of file GT2004ImageProcessor.h.

Referenced by calcEdgeAngle(), and GT2004ImageProcessor().

int GT2004ImageProcessor::vThreshold [private]

Brightness decrease threshold.

Definition at line 69 of file GT2004ImageProcessor.h.

Referenced by GT2004ImageProcessor(), and scan().

double GT2004ImageProcessor::xFactor [private]

Factor to convert the pixel coordinate space to the anglular coordinate space.

Definition at line 66 of file GT2004ImageProcessor.h.

Referenced by execute().

double GT2004ImageProcessor::yFactor [private]

Factor to convert the pixel coordinate space to the anglular coordinate space.

Definition at line 66 of file GT2004ImageProcessor.h.

Referenced by execute().

int GT2004ImageProcessor::yThreshold [private]

Brightness increase threshold.

Definition at line 68 of file GT2004ImageProcessor.h.

Referenced by GT2004ImageProcessor(), and scan().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:34:47 2006 for DT2005.panorama by  doxygen 1.4.7