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

BoxSpecialist Class Reference

This class implements the landmark and goal detection algorithms of the RIP. More...

#include <BoxSpecialist.h>

Inheritance diagram for BoxSpecialist:

Inheritance graph
[legend]
Collaboration diagram for BoxSpecialist:

Collaboration graph
[legend]
List of all members.

Public Types

typedef Geometry::Line Line
typedef vector< list< RasterSpecialist::LinePair > > SVector

Public Member Functions

 BoxSpecialist (RasterImageProcessor &processor, RasterStrategy &strategy)
 Constructor.

virtual ~BoxSpecialist ()
 Destructor.

void invokeOnPostScan (int x, int y)
 Invokes the specialist in the second scan stage at position (x,y) (this member should be replaced later).

void executePostProcessing ()
 Executes the detection algorithm.

void invokeOnPreScan (int x, int y)
 Invokes the specialist in the first scan stage at position (x,y) (this member should be replaced later).

virtual int getType ()
 Getter for member type.

virtual void init ()
 Initializes the specialist.


Private Member Functions

void createBBox ()
 Creates the bounding box aligned to the horizon for each region.

bool searchGoal (SegmentInfo &goal)
 The goal detection algorithm.

bool searchLandmark (SegmentInfo &flag)
 The detection algorithm for landmarks.

void fitLandmark (SegmentInfo &flag)
 This function detects the accurate shape of a landmark.

void detectFreePartOfGoal ()
 Detects the free part of the goal and generates a percept.

void fusionGoal ()
 Fusions the regions that belong to the same goal.

void mergeBoxes (SegmentInfo &seg1, SegmentInfo &seg2)
 Merges two regions.

void countColors (SegmentInfo &si, list< LinePair > &segment)
 Counts the colors of segment si.

bool missingData (bool ulc, bool urc, bool brc, bool blc, int i)
 A small test for goals.

void calculateAnglesForPoint (const Vector2< double > &point, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< double > &angles)
bool calculatePointOnField (const double x, const double y, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &pointOnField)
void createValidities (SegmentInfo &info)
 Creates the validity values for the different kinds of objects.


Private Attributes

RasterStrategystrategy
 The strategy.

REdgeDetection edgeScanner
 The edge detector.

std::list< LinePairlst_pts
 List of LinePairs.

Geometry::Line horizon
 The calculated horizon.

Geometry::Line pHorizon
 The calculated perpendicular to the horizon.

int flagThreshold
 The threshold for edge-scans of the landmark detection.

int goalThreshold
 The threshold for edge-scans of the goal detection.

Vector2< int > left_border
 A temporary variable.

std::vector< list< LinePair > > segments_img
 The clustered runs.

std::vector< SegmentInfoinfos_img
 The calculated informations about the segments.

std::vector< Vector2< int > > bottomPoints
 The bottomPoints of the goal (edges from green to yellow or skyblue).


Detailed Description

This class implements the landmark and goal detection algorithms of the RIP.

Definition at line 27 of file BoxSpecialist.h.


Member Typedef Documentation

typedef Geometry::Line BoxSpecialist::Line
 

Definition at line 74 of file BoxSpecialist.h.

typedef vector<list<RasterSpecialist::LinePair> > BoxSpecialist::SVector
 

Definition at line 75 of file BoxSpecialist.h.


Constructor & Destructor Documentation

BoxSpecialist::BoxSpecialist RasterImageProcessor processor,
RasterStrategy strategy
 

Constructor.

Parameters:
processor Image processor interfaces.
strategy A strategy is needed for creation (this will change).

Definition at line 21 of file BoxSpecialist.cpp.

References edgeScanner, InFile::exists(), flagThreshold, getLocation(), goalThreshold, idText, OUTPUT, and strategy.

Here is the call graph for this function:

BoxSpecialist::~BoxSpecialist  )  [virtual]
 

Destructor.

Definition at line 46 of file BoxSpecialist.cpp.


Member Function Documentation

void BoxSpecialist::invokeOnPostScan int  x,
int  y
[virtual]
 

Invokes the specialist in the second scan stage at position (x,y) (this member should be replaced later).

Parameters:
x The x coordinate.
y The y coordinate.

Reimplemented from RasterSpecialist.

Definition at line 729 of file BoxSpecialist.cpp.

References bottomPoints.

Referenced by RDefaultStrategy::postScan().

void BoxSpecialist::executePostProcessing  )  [virtual]
 

Executes the detection algorithm.

Reimplemented from RasterSpecialist.

Definition at line 734 of file BoxSpecialist.cpp.

References Geometry::Line::base, ImageProcessorInterfaces::cameraMatrix, createBBox(), RasterSpecialist::createSegmentsFromLines2(), Geometry::Line::direction, edgeScanner, LandmarksPercept::estimateOffsetForFlags(), LandmarksPercept::estimateOffsetForGoals(), flagThreshold, RasterImageProcessor::getHorizon(), goalThreshold, infos_img, ImageProcessorInterfaces::landmarksPercept, LINE, lst_pts, pHorizon, Vector2< double >::rotateLeft(), searchGoal(), searchLandmark(), segments_img, REdgeDetection::threshold, Pose3D::translation, Vector3< double >::x, and Vector3< double >::y.

Referenced by RDefaultStrategy::postProcessing().

Here is the call graph for this function:

void BoxSpecialist::invokeOnPreScan int  x,
int  y
[virtual]
 

Invokes the specialist in the first scan stage at position (x,y) (this member should be replaced later).

Parameters:
x The x coordinate.
y The y coordinate.

Reimplemented from RasterSpecialist.

Definition at line 165 of file BoxSpecialist.cpp.

References edgeScanner, RasterSpecialist::getColor(), RasterStrategy::insideBox, left_border, LINE, lst_pts, REdgeDetection::scanEast(), REdgeDetection::scanWest(), and strategy.

Referenced by RDefaultStrategy::checkBox(), and RDefaultStrategy::preScan().

Here is the call graph for this function:

int BoxSpecialist::getType  )  [virtual]
 

Getter for member type.

Returns:
The type of the specialist.

Implements RasterSpecialist.

Definition at line 49 of file BoxSpecialist.cpp.

References __RBoxSpecialist.

void BoxSpecialist::init  )  [virtual]
 

Initializes the specialist.

Implements RasterSpecialist.

Definition at line 53 of file BoxSpecialist.cpp.

References bottomPoints, edgeScanner, infos_img, lst_pts, segments_img, and REdgeDetection::threshold.

Referenced by RDefaultStrategy::init().

void BoxSpecialist::createBBox  )  [private]
 

Creates the bounding box aligned to the horizon for each region.

Definition at line 63 of file BoxSpecialist.cpp.

References Geometry::Line::base, BoxSpecialist::SegmentInfo::bottomColor, BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::bottomRight, BoxSpecialist::Rectangle::center, countColors(), createValidities(), Geometry::Line::direction, RasterSpecialist::getColor(), RasterSpecialist::getDistanceToLine(), Geometry::getIntersectionOfLines(), infos_img, pHorizon, BoxSpecialist::SegmentInfo::rect, BoxSpecialist::SegmentInfo::segment, segments_img, BoxSpecialist::SegmentInfo::size, BoxSpecialist::SegmentInfo::topColor, BoxSpecialist::Rectangle::upperLeft, BoxSpecialist::Rectangle::upperRight, Vector2< V >::x, and Vector2< V >::y.

Referenced by executePostProcessing().

Here is the call graph for this function:

bool BoxSpecialist::searchGoal SegmentInfo goal  )  [private]
 

The goal detection algorithm.

If a goal was found, a percept will be gemerated.

Parameters:
goal SegmentInfo of a region that might be a goal.
Returns:
Returns if the related region is detected as a goal.

Definition at line 197 of file BoxSpecialist.cpp.

References Vector2< double >::abs(), Vector2< V >::abs(), LandmarksPercept::addGoal(), ConditionalBoundary::addX(), ConditionalBoundary::addY(), Geometry::Line::base, BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::bottomRight, calculateAnglesForPoint(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, BoxSpecialist::Rectangle::center, colorClass, Geometry::Line::direction, DOT, edgeScanner, Geometry::getDistanceToLine(), RasterSpecialist::getDistanceToLine(), Geometry::getIntersectionOfLines(), getPlayer(), Player::getTeamColor(), BoxSpecialist::SegmentInfo::goalValidity, ImageProcessorInterfaces::image, RasterSpecialist::Box::inside(), ImageProcessorInterfaces::landmarksPercept, LINE, north, pHorizon, BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::rect, REdgeDetection::scan(), BoxSpecialist::SegmentInfo::skyblue, BoxSpecialist::Rectangle::upperLeft, BoxSpecialist::Rectangle::upperRight, west, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, Vector2< double >::y, and BoxSpecialist::SegmentInfo::yellow.

Referenced by executePostProcessing(), and fusionGoal().

Here is the call graph for this function:

bool BoxSpecialist::searchLandmark SegmentInfo flag  )  [private]
 

The detection algorithm for landmarks.

If one is found a percept will be generated.

Parameters:
flag SegmentInfo of a region that might be a landmark.
Returns:
Returns if the related region is detected as a landmark.

Definition at line 469 of file BoxSpecialist.cpp.

References Vector2< V >::abs(), RasterImageProcessor::addFlag(), BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::bottomRight, BoxSpecialist::Rectangle::center, colorClass, REdgeDetection::colorScan(), Geometry::Line::direction, DOT, edgeScanner, noColor, north, pHorizon, BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::rect, REdgeDetection::scan(), REdgeDetection::setDirection(), REdgeDetection::skip(), BoxSpecialist::SegmentInfo::skyblue, BoxSpecialist::Rectangle::upperLeft, BoxSpecialist::Rectangle::upperRight, west, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, Vector2< double >::y, and BoxSpecialist::SegmentInfo::yellow.

Referenced by executePostProcessing().

Here is the call graph for this function:

void BoxSpecialist::fitLandmark SegmentInfo flag  )  [private]
 

This function detects the accurate shape of a landmark.

Parameters:
flag SegmentInfo of a region that was detected as a landmark.

Definition at line 678 of file BoxSpecialist.cpp.

References BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::center, Geometry::Line::direction, DOT, edgeScanner, north, pHorizon, BoxSpecialist::SegmentInfo::rect, REdgeDetection::scan(), REdgeDetection::skip(), BoxSpecialist::Rectangle::upperLeft, west, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, and Vector2< double >::y.

Here is the call graph for this function:

void BoxSpecialist::detectFreePartOfGoal  )  [private]
 

Detects the free part of the goal and generates a percept.

This function is not completed yet.

Definition at line 1108 of file BoxSpecialist.cpp.

References ObstaclesPercept::angleToFreePartOfGoal, ObstaclesPercept::angleToFreePartOfGoalWasDetermined, bottomPoints, Geometry::calculateAnglesForPoint(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, ObstaclesPercept::distanceToFreePartOfGoal, ImageProcessorInterfaces::image, LINE, ImageProcessorInterfaces::obstaclesPercept, pi, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Pose3D::translation, ObstaclesPercept::widthOfFreePartOfGoal, Vector3< double >::x, Vector2< V >::x, Vector2< V >::y, and Vector3< double >::y.

Here is the call graph for this function:

void BoxSpecialist::fusionGoal  )  [private]
 

Fusions the regions that belong to the same goal.

This function is not completed yet. But the algorithm is tested.

Definition at line 885 of file BoxSpecialist.cpp.

References LandmarksPercept::addGoal(), ConditionalBoundary::addX(), ConditionalBoundary::addY(), BoxSpecialist::SegmentInfo::bottomColor, BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::bottomRight, calculateAnglesForPoint(), Image::cameraInfo, ImageProcessorInterfaces::cameraMatrix, BoxSpecialist::Rectangle::center, colorClass, Geometry::getDistanceToLine(), getPlayer(), Player::getTeamColor(), BoxSpecialist::SegmentInfo::goalValidity, ImageProcessorInterfaces::image, infos_img, RasterSpecialist::Box::inside(), ImageProcessorInterfaces::landmarksPercept, LINE, mergeBoxes(), missingData(), BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::rect, searchGoal(), BoxSpecialist::SegmentInfo::skyblue, BoxSpecialist::Rectangle::upperLeft, BoxSpecialist::Rectangle::upperRight, Vector2< double >::x, Vector2< double >::y, and BoxSpecialist::SegmentInfo::yellow.

Here is the call graph for this function:

void BoxSpecialist::mergeBoxes SegmentInfo seg1,
SegmentInfo seg2
[private]
 

Merges two regions.

The result is stored in seg1.

Parameters:
seg1 The first region.
seg2 The second region.

Definition at line 809 of file BoxSpecialist.cpp.

References Geometry::Line::base, BoxSpecialist::Rectangle::bottomLeft, BoxSpecialist::Rectangle::bottomRight, BoxSpecialist::Rectangle::center, Geometry::Line::direction, Geometry::getDistanceToLine(), Geometry::getIntersectionOfLines(), pHorizon, BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::rect, BoxSpecialist::SegmentInfo::size, BoxSpecialist::SegmentInfo::skyblue, BoxSpecialist::Rectangle::upperLeft, BoxSpecialist::Rectangle::upperRight, and BoxSpecialist::SegmentInfo::yellow.

Referenced by fusionGoal().

Here is the call graph for this function:

void BoxSpecialist::countColors SegmentInfo si,
list< LinePair > &  segment
[private]
 

Counts the colors of segment si.

And stores the result in si.

Parameters:
si SegmentInfo of the region.
segment List of runs.

Definition at line 851 of file BoxSpecialist.cpp.

References max, min, BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::skyblue, and BoxSpecialist::SegmentInfo::yellow.

Referenced by createBBox().

bool BoxSpecialist::missingData bool  ulc,
bool  urc,
bool  brc,
bool  blc,
int  i
[inline, private]
 

A small test for goals.

Returns:
A validation value.

Definition at line 190 of file BoxSpecialist.cpp.

References segments_img.

Referenced by fusionGoal().

void BoxSpecialist::calculateAnglesForPoint const Vector2< double > &  point,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< double > &  angles
[private]
 

Definition at line 989 of file BoxSpecialist.cpp.

References point, sqr, Vector2< int >::x, and Vector2< int >::y.

Referenced by fusionGoal(), and searchGoal().

bool BoxSpecialist::calculatePointOnField const double  x,
const double  y,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  pointOnField
[private]
 

Definition at line 1017 of file BoxSpecialist.cpp.

References Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.

void BoxSpecialist::createValidities SegmentInfo info  )  [private]
 

Creates the validity values for the different kinds of objects.

The result is stored in info.

Parameters:
info The info represents a region.

Definition at line 1052 of file BoxSpecialist.cpp.

References BoxSpecialist::SegmentInfo::lmValiditySkyblue, BoxSpecialist::SegmentInfo::lmValidityYellow, BoxSpecialist::SegmentInfo::pink, BoxSpecialist::SegmentInfo::skyblue, and BoxSpecialist::SegmentInfo::yellow.

Referenced by createBBox().


Member Data Documentation

RasterStrategy* BoxSpecialist::strategy [private]
 

The strategy.

Definition at line 106 of file BoxSpecialist.h.

Referenced by BoxSpecialist(), and invokeOnPreScan().

REdgeDetection BoxSpecialist::edgeScanner [private]
 

The edge detector.

Definition at line 108 of file BoxSpecialist.h.

Referenced by BoxSpecialist(), executePostProcessing(), fitLandmark(), init(), invokeOnPreScan(), searchGoal(), and searchLandmark().

std::list<LinePair> BoxSpecialist::lst_pts [private]
 

List of LinePairs.

The input data of the detection algorithm.

Definition at line 110 of file BoxSpecialist.h.

Referenced by executePostProcessing(), init(), and invokeOnPreScan().

Geometry::Line BoxSpecialist::horizon [private]
 

The calculated horizon.

Definition at line 112 of file BoxSpecialist.h.

Geometry::Line BoxSpecialist::pHorizon [private]
 

The calculated perpendicular to the horizon.

Definition at line 114 of file BoxSpecialist.h.

Referenced by createBBox(), executePostProcessing(), fitLandmark(), mergeBoxes(), searchGoal(), and searchLandmark().

int BoxSpecialist::flagThreshold [private]
 

The threshold for edge-scans of the landmark detection.

Definition at line 116 of file BoxSpecialist.h.

Referenced by BoxSpecialist(), and executePostProcessing().

int BoxSpecialist::goalThreshold [private]
 

The threshold for edge-scans of the goal detection.

Definition at line 118 of file BoxSpecialist.h.

Referenced by BoxSpecialist(), and executePostProcessing().

Vector2<int> BoxSpecialist::left_border [private]
 

A temporary variable.

Definition at line 120 of file BoxSpecialist.h.

Referenced by invokeOnPreScan().

std::vector<list<LinePair> > BoxSpecialist::segments_img [private]
 

The clustered runs.

Definition at line 122 of file BoxSpecialist.h.

Referenced by createBBox(), executePostProcessing(), init(), and missingData().

std::vector<SegmentInfo> BoxSpecialist::infos_img [private]
 

The calculated informations about the segments.

Definition at line 124 of file BoxSpecialist.h.

Referenced by createBBox(), executePostProcessing(), fusionGoal(), and init().

std::vector<Vector2<int> > BoxSpecialist::bottomPoints [private]
 

The bottomPoints of the goal (edges from green to yellow or skyblue).

Definition at line 126 of file BoxSpecialist.h.

Referenced by detectFreePartOfGoal(), init(), and invokeOnPostScan().


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