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

GT2004ImageProcessor Class Reference

The lines image processor recognizes characteristic lines in the image. More...

#include <GT2004ImageProcessor.h>

Inheritance diagram for GT2004ImageProcessor:

Inheritance graph
[legend]
Collaboration diagram for GT2004ImageProcessor:

Collaboration graph
[legend]
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)
 Constructor.

virtual void execute ()
 Executes the module.

virtual bool handleMessage (InMessage &message)
 Handles an incoming message.


Private Member Functions

void scanColumns ()
 The function scans columns for line points.

void scanRows ()
 The function scans rows for line points.

void scan (const Vector2< int > &start, const Vector2< int > &end, bool vertical, bool noLines)
 The function scans a line for line points.

void clusterRobots (const unsigned char *bottomPoint, bool redFound, bool blueFound)
 The function clusters points of red and blue robots.

void filterPercepts ()
 The function filters the percepts, i.e.

void filterLinesPercept (LinesPercept &percept, int type, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const Image &image)
 The function filters the line-percepts, i.e.

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
 The function calculates the angle of an edge at an edge point.

Vector2< int > getCoords (const unsigned char *p) const
 The function converts an address to pixel coordinates.

 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
 Factor to convert the pixel coordinate space to the anglular coordinate space.

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

int yThreshold
 Brightness increase threshold.

int vThreshold
 Brightness decrease threshold.

int orangeCount
 Number of columns with ball points.

int noOrangeCount
 Number of columns without a ball point.

int noRedCount
 Number of columns without a red robot point.

int noBlueCount
 Number of columns without a blue robot point.

int noGoalCount
 Number of columns without a opponent goal seen.

int closestBottom
 Closest bottom point on the grid.

Vector2< int > firstRed
 First red robot point in a cluster.

Vector2< int > closestRed
 Closest red robot point in a cluster.

Vector2< int > lastRed
 Last red robot point in a cluster.

Vector2< int > firstBlue
 First blue robot point in a cluster.

Vector2< int > closestBlue
 Closest blue robot point in a cluster.

Vector2< int > lastBlue
 Last blue robot point in a cluster.

Vector2< int > firstFlag
 First flag point in a cluster.

Vector2< int > lastFlag
 Last flag point in a cluster.

bool goalAtBorder
 Is the first goal point at the image border?

int longestBallRun
Vector2< int > ballCandidate
CameraMatrix cmTricot
 Camera matrix without tricot height.

CameraMatrix prevCameraMatrix
 The camera matrix of the previous image.

CameraMatrix prevCmTricot
 The tricot matrix of the previous image.

ColorCorrector colorCorrector
 The color correction tool.

GT2004BeaconDetector beaconDetector
 The beacon detector.

GT2004GoalRecognizer goalRecognizer
 The goal recognizer.

GT2004BallSpecialist ballSpecialist
 The ball specialist.

GT2004EdgeSpecialist edgeSpecialist
 The edge specialist.

ImageInfo imageInfo
 Additional information about the current image.

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 24 of file GT2004ImageProcessor.cpp.

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

Here is the call graph for this function:


Member Function Documentation

void GT2004ImageProcessor::execute  )  [virtual]
 

Executes the module.

Implements Module.

Definition at line 41 of file GT2004ImageProcessor.cpp.

References angleBetweenDirectionOfViewAndGround, ARROW, ballCandidate, ballSpecialist, beaconDetector, Geometry::calculateHorizon(), Image::cameraInfo, LandmarksPercept::cameraOffset, cmTricot, DEBUG_DRAWING_FINISHED, Geometry::Line::direction, edgeSpecialist, GT2004GoalRecognizer::execute(), GT2004BeaconDetector::execute(), filterPercepts(), CameraInfo::focalLength, CameraMatrix::frameNumber, Image::frameNumber, GENERATE_DEBUG_IMAGE, ColorTable::generateColorClassImage(), GT2004EdgeSpecialist::getEdgesPercept(), Geometry::getIntersectionPointsOfLineAndRectangle(), getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), goalRecognizer, ImageInfo::horizon, ImageInfo::horizonEnd, ImageInfo::horizonInImage, ImageInfo::horizonStart, imageInfo, INIT_DEBUG_IMAGE, LINE, ColorCorrector::load(), longestBallRun, ImageInfo::maxImageCoordinates, RobotDimensions::motionCycleTime, normalize(), Vector2< V >::normalize(), Geometry::Line::normalizeDirection(), numberOfScannedPixels, CameraInfo::opticalCenter, pi, prevCmTricot, GT2004EdgeSpecialist::reset(), EdgesPercept::reset(), ObstaclesPercept::reset(), PlayersPercept::reset(), BallPercept::reset(), LinesPercept::reset(), LandmarksPercept::reset(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Pose3D::rotation, scanColumns(), scanRows(), GT2004BallSpecialist::searchBall(), SEND_DEBUG_COLOR_CLASS_IMAGE, SEND_DEBUG_IMAGE, sqr, toDegrees(), Pose3D::translation, ImageInfo::vertLine, Vector2< int >::x, Vector2< V >::x, Vector2< double >::x, Vector3< V >::x, xFactor, Vector2< int >::y, Vector2< V >::y, Vector2< double >::y, Vector3< V >::y, yFactor, Vector3< V >::z, and Vector3< double >::z.

Referenced by BB2004Calibrator::evolve().

Here is the call graph for this function:

bool GT2004ImageProcessor::handleMessage InMessage message  )  [virtual]
 

Handles an incoming message.

Parameters:
message The message

Reimplemented from Module.

Definition at line 1412 of file GT2004ImageProcessor.cpp.

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

Here is the call graph for this function:

void GT2004ImageProcessor::scanColumns  )  [private]
 

The function scans columns for line points.

Definition at line 288 of file GT2004ImageProcessor.cpp.

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

Referenced by execute().

Here is the call graph for this function:

void GT2004ImageProcessor::scanRows  )  [private]
 

The function scans rows for line points.

Definition at line 411 of file GT2004ImageProcessor.cpp.

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

Referenced by execute().

Here is the call graph for this function:

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 449 of file GT2004ImageProcessor.cpp.

References Vector2< V >::abs(), ObstaclesPercept::add(), LinesPercept::add(), RingBuffer< V, n >::add(), Vector2< V >::angle(), angleBetweenDirectionOfViewAndGround, ballCandidate, calcEdgeAngle(), Geometry::calculateLineSize(), Geometry::calculatePointOnField(), Image::cameraInfo, GT2004EdgeSpecialist::checkPoint(), closestBottom, clusterRobots(), cmTricot, COLOR_CLASS, colorClass, 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, DOT, edgeSpecialist, firstBlue, firstRed, getCoords(), RingBuffer< V, n >::getNumberOfEntries(), getPlayer(), Geometry::getSizeByDistance(), Player::getTeamColor(), goalAtBorder, Image::image, RingBuffer< V, n >::init(), CameraMatrix::isValid, lastBlue, lastRed, LINE, lineColor, longestBallRun, noColor, noOrangeCount, LinesPercept::numberOfPoints, numberOfScannedPixels, orangeCount, PLOT, point, prevCmTricot, GT2004EdgeSpecialist::resetLine(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, sgn, sqr, Pose3D::translation, vThreshold, Vector2< V >::x, Vector2< V >::y, yThreshold, and Vector3< double >::z.

Referenced by scanColumns(), and scanRows().

Here is the call graph for this function:

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 1165 of file GT2004ImageProcessor.cpp.

References Vector2< V >::abs(), Vector2< int >::abs(), PlayersPercept::addBluePlayer(), PlayersPercept::addRedPlayer(), Geometry::calculatePointOnField(), Image::cameraInfo, closestBlue, closestRed, SinglePlayerPercept::direction, firstBlue, firstRed, getCoords(), lastBlue, lastRed, noBlueCount, noRedCount, LinesPercept::numberOfPoints, SinglePlayerPercept::offset, LinesPercept::points, SinglePlayerPercept::validity, Vector2< double >::x, Vector2< int >::x, Vector2< V >::x, Vector2< double >::y, Vector2< int >::y, and Vector2< V >::y.

Referenced by scan(), and scanColumns().

Here is the call graph for this function:

void GT2004ImageProcessor::filterPercepts  )  [private]
 

The function filters the percepts, i.e.

it removes potential misreadings.

Definition at line 1231 of file GT2004ImageProcessor.cpp.

References Vector2< double >::abs(), PlayersPercept::bluePlayers, filterLinesPercept(), PlayersPercept::numberOfBluePlayers, LinesPercept::numberOfPoints, PlayersPercept::numberOfRedPlayers, SinglePlayerPercept::offset, pi, PlayersPercept::redPlayers, Vector2< double >::x, and Vector2< double >::y.

Referenced by execute().

Here is the call graph for this function:

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 1433 of file GT2004ImageProcessor.cpp.

References normalize(), LinesPercept::numberOfPoints, and LinesPercept::points.

Referenced by filterPercepts().

Here is the call graph for this function:

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 1333 of file GT2004ImageProcessor.cpp.

References Vector2< V >::abs(), Vector2< V >::angle(), ARROW, Geometry::calculatePointOnField(), Image::cameraInfo, getCoords(), Image::image, normalize(), pi, pi2, pi_2, point, rotation2x2, Vector2< V >::x, Vector2< int >::x, Vector2< V >::y, and Vector2< int >::y.

Referenced by scan().

Here is the call graph for this function:

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, and Image::image.

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

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

Definition at line 1395 of file GT2004ImageProcessor.cpp.

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

Here is the call graph for this function:

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE imageProcessorPlayers   )  [private]
 

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE imageProcessorGeneral   )  [private]
 

GT2004ImageProcessor::DECLARE_DEBUG_COLOR_CLASS_IMAGE segmentedImage1   )  [private]
 

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE imageProcessorBall   )  [private]
 

GT2004ImageProcessor::DECLARE_DEBUG_IMAGE imageProcessorGradients   )  [private]
 


Member Data Documentation

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().

int GT2004ImageProcessor::vThreshold [private]
 

Brightness decrease threshold.

Definition at line 69 of file GT2004ImageProcessor.h.

Referenced by GT2004ImageProcessor(), and scan().

int GT2004ImageProcessor::orangeCount [private]
 

Number of columns with ball points.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by scan().

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::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::closestBottom [private]
 

Closest bottom point on the grid.

Definition at line 70 of file GT2004ImageProcessor.h.

Referenced by scan(), and scanColumns().

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().

Vector2<int> GT2004ImageProcessor::closestRed [private]
 

Closest red robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots().

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().

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::closestBlue [private]
 

Closest blue robot point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Referenced by clusterRobots().

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::firstFlag [private]
 

First flag point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

Vector2<int> GT2004ImageProcessor::lastFlag [private]
 

Last flag point in a cluster.

Definition at line 76 of file GT2004ImageProcessor.h.

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().

int GT2004ImageProcessor::longestBallRun [private]
 

Definition at line 85 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

Vector2<int> GT2004ImageProcessor::ballCandidate [private]
 

Definition at line 86 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

CameraMatrix GT2004ImageProcessor::cmTricot [private]
 

Camera matrix without tricot height.

Definition at line 88 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

CameraMatrix GT2004ImageProcessor::prevCameraMatrix [private]
 

The camera matrix of the previous image.

Definition at line 88 of file GT2004ImageProcessor.h.

CameraMatrix GT2004ImageProcessor::prevCmTricot [private]
 

The tricot matrix of the previous image.

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.

GT2004BeaconDetector GT2004ImageProcessor::beaconDetector [private]
 

The beacon detector.

Definition at line 94 of file GT2004ImageProcessor.h.

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

GT2004GoalRecognizer GT2004ImageProcessor::goalRecognizer [private]
 

The goal recognizer.

Definition at line 96 of file GT2004ImageProcessor.h.

Referenced by execute().

GT2004BallSpecialist GT2004ImageProcessor::ballSpecialist [private]
 

The ball specialist.

Definition at line 98 of file GT2004ImageProcessor.h.

Referenced by execute().

GT2004EdgeSpecialist GT2004ImageProcessor::edgeSpecialist [private]
 

The edge specialist.

Definition at line 100 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

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.

Drawings::Color GT2004ImageProcessor::lineColor [private]
 

Definition at line 183 of file GT2004ImageProcessor.h.

Referenced by plot(), and scan().

double GT2004ImageProcessor::angleBetweenDirectionOfViewAndGround [private]
 

Definition at line 187 of file GT2004ImageProcessor.h.

Referenced by execute(), and scan().

int GT2004ImageProcessor::numberOfScannedPixels [private]
 

Definition at line 189 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().


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