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

SlamBorderFinder Class Reference

#include <SlamBorderFinder.h>

Collaboration diagram for SlamBorderFinder:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { maxNumberOfLines = 6, maxNumberOfLinePoints = 60, pointsNeededForLine = 3 }

Public Member Functions

 SlamBorderFinder (const ColorCorrector &colorCorrector, const ColorTable &colorTable)
 ~SlamBorderFinder (void)
void considerLinePoint (Vector2< int > &pointOnLine, Vector2< double > &normalToLine)
 Add a new LinePont for later consideration.

void execute (LinesPercept &linesPercept, const CameraMatrix &cameraMatrix, const Image &image, const ImageInfo &imageInfo, const RobotPose &robotPose)
 Calculates lines and crossings out of the given LinePoints.

void reset ()
 Resets the lineFinder.

int getNumberOfLines ()
 Returns the number of found lines.

void getLine (int number, Vector2< int > &pointOnLine, Vector2< double > &normalToLine)
 Returns the line by number.


Private Member Functions

void findLineFragments ()
 Calculates line fragments out of the given LinePoints.

void findLines (LinesPercept &linesPercept, const CameraMatrix &cameraMatrix, const Image &image, const ImageInfo &imageInfo)
 Calculates lines out of the previously calculated line fragments.

void findIntersections (LinesPercept &linesPercept, const CameraMatrix &cameraMatrix, const Image &image, const RobotPose &robotPose, const ImageInfo &imageInfo)
 Calculates crossings out of the previously calculated lines.

void addCrossingsPercept (const Vector2< double > &intersectionInImage, const Vector2< int > &intersectionOnField, int lineNumber1, int lineNumber2, LinesPercept &linesPercept, const Image &image, const ImageInfo &imageInfo, const CameraMatrix &cameraMatrix, const RobotPose &robotPose)
 Adds the crossing to the linesPercept including some characteristics found by additional scanning.

void calculateDirectionAwayFromBorder (LinesPercept &linesPercept, const Image &image, const ImageInfo &imageInfo, const CameraMatrix &cameraMatrix, const RobotPose &robotPose)
 Calculates the direction away from the border.

bool linesPerpendicularOnField (int lineNumber1, int lineNumber2, const CameraMatrix &cameraMatrix, const Image &image)
 Very rough calculation if lines are perpendicular on the field (used for validating crossings).

bool calculateLineOnField (int lineNumber, Vector2< double > &base, Vector2< double > &direction, const CameraMatrix &cameraMatrix, const Image &image)
 Calculates the projected line on the field.

bool calculateLineOnField (const Vector2< int > &baseInImage, const Vector2< double > &directionInImage, Vector2< double > &baseOnField, Vector2< double > &directionOnField, const CameraMatrix &cameraMatrix, const Image &image)
 Calculates the projected line on the field.

void doVerificationScan (const Vector2< double > &crossingPoint, const Vector2< double > &directionToScanAt, const Vector2< double > &scanningDirection, int lineSize, LinesPercept::CrossingCharacteristic &result, const CameraMatrix &cameraMatrix, const Image &image)
 Calculates the projected line on the field.


Private Attributes

int numberOfLines
LineFragmentlines
int numberOfLineFragments
bool lineFragmentAlreadyConsidered [maxNumberOfLines *2]
LineFragmentlineFragments
const ColorCorrectorcolorCorrector
const ColorTablecolorTable
LinePoint linePoints [maxNumberOfLinePoints]
int numberOfLinePoints
double normDistance
double normProjection
double normProjectionPerpendicularToHorizon

Member Enumeration Documentation

anonymous enum
 

Enumeration values:
maxNumberOfLines 
maxNumberOfLinePoints 
pointsNeededForLine 

Definition at line 76 of file SlamBorderFinder.h.


Constructor & Destructor Documentation

SlamBorderFinder::SlamBorderFinder const ColorCorrector colorCorrector,
const ColorTable colorTable
 

Definition at line 12 of file SlamBorderFinder.cpp.

SlamBorderFinder::~SlamBorderFinder void   ) 
 

Definition at line 20 of file SlamBorderFinder.cpp.


Member Function Documentation

void SlamBorderFinder::considerLinePoint Vector2< int > &  pointOnLine,
Vector2< double > &  normalToLine
 

Add a new LinePont for later consideration.

Parameters:
pointOnLine Image coordinates of the point.
normalToLine Normal vector to the line (indicated by the gradient).

Definition at line 31 of file SlamBorderFinder.cpp.

References SlamBorderFinder::LinePoint::belongsToLineNo, SlamBorderFinder::LinePoint::normalToLine, and SlamBorderFinder::LinePoint::pointOnLine.

Referenced by SlamImageProcessor::scan().

void SlamBorderFinder::execute LinesPercept linesPercept,
const CameraMatrix cameraMatrix,
const Image image,
const ImageInfo imageInfo,
const RobotPose robotPose
 

Calculates lines and crossings out of the given LinePoints.

Parameters:
linesPercept The LinesPercept, where the found information is stored.
cameraMatrix The CameraMatrix.
image The Image.
imageInfo The ImageInfo.
robotPose The RobotPose.

Definition at line 47 of file SlamBorderFinder.cpp.

References calculateDirectionAwayFromBorder(), DEBUG_DRAWING_FINISHED, findIntersections(), findLineFragments(), findLines(), and NDECLARE_DEBUGDRAWING.

Referenced by SlamImageProcessor::execute().

Here is the call graph for this function:

void SlamBorderFinder::reset  ) 
 

Resets the lineFinder.

Definition at line 24 of file SlamBorderFinder.cpp.

Referenced by SlamImageProcessor::execute().

int SlamBorderFinder::getNumberOfLines  ) 
 

Returns the number of found lines.

Definition at line 767 of file SlamBorderFinder.cpp.

void SlamBorderFinder::getLine int  number,
Vector2< int > &  pointOnLine,
Vector2< double > &  normalToLine
 

Returns the line by number.

Parameters:
number The number of the line to return.
pointOnLine The base of the line.
normalToLine The normal of the line.

Definition at line 772 of file SlamBorderFinder.cpp.

References SlamBorderFinder::LineFragment::base, SlamBorderFinder::LineFragment::normal, Vector2< double >::x, Vector2< int >::x, Vector2< V >::x, Vector2< double >::y, Vector2< int >::y, and Vector2< V >::y.

Referenced by findLines().

void SlamBorderFinder::findLineFragments  )  [private]
 

Calculates line fragments out of the given LinePoints.

Definition at line 68 of file SlamBorderFinder.cpp.

References SlamBorderFinder::LineFragment::averageStep, SlamBorderFinder::LineFragment::base, SlamBorderFinder::LinePoint::belongsToLineNo, SlamBorderFinder::LineFragment::end, SlamBorderFinder::LineFragment::lineFragmentAlreadyConsidered, SlamBorderFinder::LineFragment::normal, Vector2< V >::normalize(), SlamBorderFinder::LinePoint::normalToLine, pi_4, Vector2< V >::rotateLeft(), SlamBorderFinder::LineFragment::start, Vector2< double >::x, Vector2< V >::x, and Vector2< V >::y.

Referenced by execute().

Here is the call graph for this function:

void SlamBorderFinder::findLines LinesPercept linesPercept,
const CameraMatrix cameraMatrix,
const Image image,
const ImageInfo imageInfo
[private]
 

Calculates lines out of the previously calculated line fragments.

Parameters:
linesPercept The LinesPercept.
cameraMatrix The CameraMatrix.
image The Image.
imageInfo The ImageInfo.

Definition at line 229 of file SlamBorderFinder.cpp.

References SlamBorderFinder::LineFragment::averageStep, SlamBorderFinder::LineFragment::base, Image::cameraInfo, Geometry::Line::direction, SlamBorderFinder::LineFragment::end, Geometry::getIntersectionPointsOfLineAndRectangle(), getLine(), ImageInfo::horizon, SlamBorderFinder::LineFragment::lineFragmentAlreadyConsidered, max, SlamBorderFinder::LineFragment::normal, Vector2< double >::normalize(), Vector2< V >::normalize(), pi_4, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< double >::rotateLeft(), SlamBorderFinder::LineFragment::start, Vector2< int >::x, Vector2< V >::x, Vector2< double >::x, Vector2< int >::y, and Vector2< V >::y.

Referenced by execute().

Here is the call graph for this function:

void SlamBorderFinder::findIntersections LinesPercept linesPercept,
const CameraMatrix cameraMatrix,
const Image image,
const RobotPose robotPose,
const ImageInfo imageInfo
[private]
 

Calculates crossings out of the previously calculated lines.

Parameters:
linesPercept The LinesPercept.
cameraMatrix The CameraMatrix.
image The Image.
robotPose The RobotPose.
imageInfo The ImageInfo.

Definition at line 384 of file SlamBorderFinder.cpp.

References Vector2< V >::abs(), SlamBorderFinder::LineFragment::base, Geometry::calculatePointOnField(), Image::cameraInfo, direction, Geometry::getIntersectionOfLines(), linesPerpendicularOnField(), SlamBorderFinder::LineFragment::normal, Vector2< double >::normalize(), Geometry::relative2FieldCoord(), Vector2< double >::rotateLeft(), Vector2< double >::x, Vector2< V >::x, Vector2< double >::y, Vector2< int >::y, and Vector2< V >::y.

Referenced by execute().

Here is the call graph for this function:

void SlamBorderFinder::addCrossingsPercept const Vector2< double > &  intersectionInImage,
const Vector2< int > &  intersectionOnField,
int  lineNumber1,
int  lineNumber2,
LinesPercept linesPercept,
const Image image,
const ImageInfo imageInfo,
const CameraMatrix cameraMatrix,
const RobotPose robotPose
[private]
 

Adds the crossing to the linesPercept including some characteristics found by additional scanning.

Parameters:
intersectionInImage The intersection in the image.
intersectionOnField The intersection on the field.
int The first line involved in this crossing.
int The second line involved in this crossing.
linesPercept The LinesPercept.
image The Image.
imageInfo The ImageInfo.
cameraMatrix The CameraMatrix.
robotPose The RobotPose.

Definition at line 432 of file SlamBorderFinder.cpp.

References Vector2< V >::abs(), calculateLineOnField(), Geometry::calculateLineSize(), Image::cameraInfo, doVerificationScan(), LinesPercept::lineCrossings, LinesPercept::maxNumberOfLineCrossings, SlamBorderFinder::LineFragment::normal, Vector2< V >::normalize(), LinesPercept::numberOfLineCrossings, pi2, pi_2, pi_4, Geometry::relative2FieldCoord(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::rotateRight(), Vector2< V >::x, and Vector2< V >::y.

Here is the call graph for this function:

void SlamBorderFinder::calculateDirectionAwayFromBorder LinesPercept linesPercept,
const Image image,
const ImageInfo imageInfo,
const CameraMatrix cameraMatrix,
const RobotPose robotPose
[private]
 

Calculates the direction away from the border.

Parameters:
linesPercept The LinesPercept.
image The Image.
imageInfo The ImageInfo.
cameraMatrix The CameraMatrix.
robotPose The RobotPose.

Definition at line 667 of file SlamBorderFinder.cpp.

References Vector2< V >::abs(), calculateLineOnField(), NARROW, Vector2< V >::normalize(), Geometry::relative2FieldCoord(), Vector2< V >::rotateRight(), Pose2D::translation, Vector2< double >::x, Vector2< V >::x, Vector2< double >::y, and Vector2< V >::y.

Referenced by execute().

Here is the call graph for this function:

bool SlamBorderFinder::linesPerpendicularOnField int  lineNumber1,
int  lineNumber2,
const CameraMatrix cameraMatrix,
const Image image
[private]
 

Very rough calculation if lines are perpendicular on the field (used for validating crossings).

Parameters:
lineNumber1 Number of the 1st line.
lineNumber2 Number of the 2nd line.
cameraMatrix The CameraMatrix.
image The Image.
Returns:
True if the lines are perpendicular.

Definition at line 781 of file SlamBorderFinder.cpp.

References calculateLineOnField().

Referenced by findIntersections().

Here is the call graph for this function:

bool SlamBorderFinder::calculateLineOnField int  lineNumber,
Vector2< double > &  base,
Vector2< double > &  direction,
const CameraMatrix cameraMatrix,
const Image image
[private]
 

Calculates the projected line on the field.

Parameters:
lineNumber Number of the line to be projected on the field.
base The resulting base.
direction The resulting direction.
cameraMatrix The CameraMatrix.
image The Image.
Returns:
true if calculation was successful.

Definition at line 795 of file SlamBorderFinder.cpp.

References SlamBorderFinder::LineFragment::base, Geometry::calculatePointOnField(), Image::cameraInfo, SlamBorderFinder::LineFragment::normal, Vector2< double >::normalize(), Vector2< double >::x, Vector2< V >::x, Vector2< V >::y, Vector2< double >::y, and Vector2< int >::y.

Referenced by addCrossingsPercept(), calculateDirectionAwayFromBorder(), and linesPerpendicularOnField().

Here is the call graph for this function:

bool SlamBorderFinder::calculateLineOnField const Vector2< int > &  baseInImage,
const Vector2< double > &  directionInImage,
Vector2< double > &  baseOnField,
Vector2< double > &  directionOnField,
const CameraMatrix cameraMatrix,
const Image image
[private]
 

Calculates the projected line on the field.

Parameters:
baseInImage The base in the image.
directionInImage The direction in the image.
baseOnField The resulting base.
directionOnField The resulting direction.
cameraMatrix The CameraMatrix.
image The Image.
Returns:
true if calculation was successful.

Definition at line 813 of file SlamBorderFinder.cpp.

References Geometry::calculatePointOnField(), Image::cameraInfo, Vector2< V >::normalize(), Vector2< V >::x, and Vector2< V >::y.

Here is the call graph for this function:

void SlamBorderFinder::doVerificationScan const Vector2< double > &  crossingPoint,
const Vector2< double > &  directionToScanAt,
const Vector2< double > &  scanningDirection,
int  lineSize,
LinesPercept::CrossingCharacteristic result,
const CameraMatrix cameraMatrix,
const Image image
[private]
 

Calculates the projected line on the field.

Parameters:
crossingPoint The crossingPoint in the image.
directionToScanAt The direction in the image, on which side of the crossingPoint should be scanned.
scanningDirection The direction of the scan line (not always perpendicular because of perspectival distortion).
lineSize The size of a line at this position in the image.
result The result of the scan.
cameraMatrix The CameraMatrix.
image The Image.

Definition at line 830 of file SlamBorderFinder.cpp.

References Image::cameraInfo, COLOR_CLASS, ColorCorrector::correct(), BresenhamLineScan::getNext(), Image::image, max, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, and Vector2< V >::y.

Referenced by addCrossingsPercept().

Here is the call graph for this function:


Member Data Documentation

int SlamBorderFinder::numberOfLines [private]
 

Definition at line 237 of file SlamBorderFinder.h.

LineFragment* SlamBorderFinder::lines [private]
 

Definition at line 239 of file SlamBorderFinder.h.

int SlamBorderFinder::numberOfLineFragments [private]
 

Definition at line 244 of file SlamBorderFinder.h.

bool SlamBorderFinder::lineFragmentAlreadyConsidered[maxNumberOfLines*2] [private]
 

Definition at line 245 of file SlamBorderFinder.h.

LineFragment* SlamBorderFinder::lineFragments [private]
 

Definition at line 247 of file SlamBorderFinder.h.

const ColorCorrector& SlamBorderFinder::colorCorrector [private]
 

Definition at line 250 of file SlamBorderFinder.h.

const ColorTable& SlamBorderFinder::colorTable [private]
 

Definition at line 251 of file SlamBorderFinder.h.

LinePoint SlamBorderFinder::linePoints[maxNumberOfLinePoints] [private]
 

Definition at line 252 of file SlamBorderFinder.h.

int SlamBorderFinder::numberOfLinePoints [private]
 

Definition at line 253 of file SlamBorderFinder.h.

double SlamBorderFinder::normDistance [private]
 

Definition at line 254 of file SlamBorderFinder.h.

double SlamBorderFinder::normProjection [private]
 

Definition at line 255 of file SlamBorderFinder.h.

double SlamBorderFinder::normProjectionPerpendicularToHorizon [private]
 

Definition at line 256 of file SlamBorderFinder.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:20:46 2006 for GT2005 by doxygen 1.3.6