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

# SlamBeaconDetector Class Reference

A class for detecting beacons in images. More...

`#include <SlamBeaconDetector.h>`

Collaboration diagram for SlamBeaconDetector:

[legend]
List of all members.

## Public Types
enum | { edgeThresholdU = 13, edgeThresholdV = 15 }
## Public Member Functions
| SlamBeaconDetector (const Image &image, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const ImageInfo &imageInf, const ColorTable &colorTable, const ColorCorrector &colorCorrector, const RobotPose &robotPose, LandmarksPercept &landmarksPercept, SpecialPercept &specialPercept)
| Constructor.
void | execute ()
| Executes the beacon detection.
void | analyzeColorTable ()
| Gains information about pink from the current color table.
## Public Attributes
double | direction
int | directionCount
## Private Types
enum | { lowReliability = 1, mediumReliability = 4, highReliability = 6 }
## Private Member Functions
double | FindSimilarFlag (SpecialFlag &)
bool | addCandidate (const Run &pinkRun)
| Adds a pink run to the list of candidates.
void | scanForPink (const Vector2< int > &start, const Vector2< int > &end)
| Scans along a line.
bool | scanForBeaconPart (const Vector2< int > &start, const Vector2< int > &end, Vector2< int > &position, Vector2< int > &edge, colorClass &color)
| Scans for one other beacon part.
void | clusterPinkBeaconParts ()
| Clusters the pink elements to find the pink beacon parts.
void | findSpecial (const Vector2< int > &center, const double pinkRunWidth)
| Tries to find a special landmark.
void | characterizeNewFlag (const Vector2< int > &center)
| Tries to characterize the surroundings of this flag.
SlamFlagLocator::flagCharacteristics | scanForFlagCharacterization (const Vector2< int > &start, const Vector2< double > &direction)
| scan-method for characterizeNewFlag
void | analyzeBeacon (const Vector2< double > &left, const Vector2< int > &center, const double pinkRunWidth)
| Tries to detect a beacon near a pink part.
int | scanForBeaconEdges (const Vector2< int > &position, const double pinkRunWidth, Flag::FlagType &flagType, Vector2< int > &topEdge, Vector2< int > &bottomEdge)
| Looks for the vertical edges and the color type of a beacon.
## Private Attributes
int | frameCount
int | numFlags
SpecialFlag | specialFlags [NUM_SPECIAL_FLAGS]
const SUSANEdgeDetectionLite | edgeDetectionU
| Edge detection operators (U and V components) used to find the boundaries of flags.
const SUSANEdgeDetectionLite | edgeDetectionV
const Image & | image
| The image.
const CameraMatrix & | cameraMatrix
| The camera matrix.
const CameraMatrix & | prevCameraMatrix
| The previous camera matrix.
const ImageInfo & | imageInf
| Additional Image information.
const ColorTable & | colorTable
| The color table.
const RobotPose & | robotPose
LandmarksPercept & | landmarksPercept
| The landmarks percept.
SpecialPercept & | specialPercept
| The special percept.
int | numOfBeaconCandidates
| The number of possible beacons.
int | numOfClusteredBeaconCandidates
| The number of possible beacons after clustering.
Run | beaconCandidates [MAX_NUMBER_OF_PINK_RUNS]
| The list of candidates.
TransformedRun | transformedCandidates [MAX_NUMBER_OF_PINK_RUNS]
| A buffer for transformed candidates.
const double | horizontalBaseOffset
| The base offset for horizontal scan lines.
const int | numOfHorizontalScanLineAbove
| The number of horizontal scan lines above the horizon.
const int | numOfHorizontalScanLineBelow
| The number of horizontal scan lines below the horizon.
const double | horizontalOffsetModifier
| The growth factor of the distance between two scan lines.
const int | clusteringDistanceTolerance
| The maximum distance between the merged runs.
const int | minPinkRunLength
| The minimum length of a pink run.
const double | clusteringAspectRatio
| The maximum vertical distance of scanlines to be clustered, over the estimated merged horizontal distance (half beacon aspect ratio should be 1:1).
const double | projectionAspectRatio
| The minimum value for the ratio of the 2 dimensions of the pink part of the beacon, to be used for projection on the unknown colored part.
const int | edgeScanDepth
| The maximum number of pixels which are examined after an edge response has been found for determining the color beyond the edge.
unsigned char | minPinkUValue
| The minimum U channel value of a pink pixel.
const double | minFlagConfidence
| A confidence threshold used to determine if a target beacon, whose type is not completely clear, can be accepted or not.
SlamFlagSpecialist | flagSpecialist
| A flag specialist.
const ColorCorrector & | colorCorrector
| The color corrector.

## Detailed Description

A class for detecting beacons in images.

Definition at line 45 of file SlamBeaconDetector.h.

## Member Enumeration Documentation

anonymous enum

  | Enumeration values:
  edgeThresholdU |
  edgeThresholdV |
Definition at line 49 of file SlamBeaconDetector.h.

anonymous enum`[private]`

  | Enumeration values:
  lowReliability |
  mediumReliability |
  highReliability |
Definition at line 170 of file SlamBeaconDetector.h.

## Constructor & Destructor Documentation

SlamBeaconDetector::SlamBeaconDetector | ( | const Image & | image,
|  | const CameraMatrix & | cameraMatrix,
|  | const CameraMatrix & | prevCameraMatrix,
|  | const ImageInfo & | imageInf,
|  | const ColorTable & | colorTable,
|  | const ColorCorrector & | colorCorrector,
|  | const RobotPose & | robotPose,
|  | LandmarksPercept & | landmarksPercept,
|  | SpecialPercept & | specialPercept
| ) |

| Constructor. Definition at line 37 of file SlamBeaconDetector.cpp. References numFlags.

## Member Function Documentation

void SlamBeaconDetector::execute | ( |  | ) |

| Executes the beacon detection. Definition at line 73 of file SlamBeaconDetector.cpp. References ARROW, Geometry::Line::base, Image::cameraInfo, CIRCLE, clusterPinkBeaconParts(), SpecialFlag::direction, Geometry::Line::direction, SlamFlagSpecialist::getFlagPercept(), Geometry::getIntersectionPointsOfLineAndRectangle(), ImageInfo::horizon, SlamFlagSpecialist::init(), LINE, ImageInfo::maxImageCoordinates, NDECLARE_DEBUGDRAWING, numFlags, numOfClusteredBeaconCandidates, scanForPink(), slamPercept, specialFlags, Pose2D::translation, ImageInfo::vertLine, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, and Vector2< double >::y. Referenced by SlamImageProcessor::execute().

Here is the call graph for this function:

void SlamBeaconDetector::analyzeColorTable | ( |  | ) |

| Gains information about pink from the current color table. Definition at line 1376 of file SlamBeaconDetector.cpp. References Vector3< V >::y. Referenced by SlamImageProcessor::handleMessage(), and SlamImageProcessor::SlamImageProcessor().

double SlamBeaconDetector::FindSimilarFlag | ( | SpecialFlag & |  | ) | `[private]`

| Definition at line 442 of file SlamBeaconDetector.cpp. References NUM_SECTORS, numFlags, SpecialFlag::sectors, and specialFlags. Referenced by findSpecial().

bool SlamBeaconDetector::addCandidate | ( | const Run & | pinkRun | ) | `[private]`

  | Adds a pink run to the list of candidates. Parameters:
  pinkRun | A pink run
Returns: true, if the run has been appended Definition at line 232 of file SlamBeaconDetector.cpp. References Run::end, MAX_NUMBER_OF_PINK_RUNS, Run::scanLineStart, and Run::start. Referenced by scanForPink().

void SlamBeaconDetector::scanForPink | ( | const Vector2< int > & | start,
|  | const Vector2< int > & | end
| ) | `[private]`

| Scans along a line. Definition at line 160 of file SlamBeaconDetector.cpp. References addCandidate(), COLOR_CLASS, ColorCorrector::correct(), Run::end, BresenhamLineScan::getNext(), Image::image, BresenhamLineScan::init(), Run::length, LINE, BresenhamLineScan::numberOfPixels, Run::scanLineStart, Run::start, U(), V(), Vector2< int >::x, Vector2< V >::x, Vector2< int >::y, Vector2< V >::y, and Y(). Referenced by execute().

Here is the call graph for this function:

bool SlamBeaconDetector::scanForBeaconPart | ( | const Vector2< int > & | start,
|  | const Vector2< int > & | end,
|  | Vector2< int > & | position,
|  | Vector2< int > & | edge,
|  | colorClass & | color
| ) | `[private]`

| Scans for one other beacon part. Definition at line 1330 of file SlamBeaconDetector.cpp. References COLOR_CLASS, ColorCorrector::correct(), DOT, BresenhamLineScan::getNext(), Image::image, BresenhamLineScan::init(), SUSANEdgeDetectionLite::isEdgePoint(), noColor, BresenhamLineScan::numberOfPixels, Vector2< V >::x, and Vector2< V >::y. Referenced by scanForBeaconEdges().

Here is the call graph for this function:

void SlamBeaconDetector::clusterPinkBeaconParts | ( |  | ) | `[private]`

| Clusters the pink elements to find the pink beacon parts. Definition at line 252 of file SlamBeaconDetector.cpp. References Vector2< double >::angle(), Geometry::Line::direction, TransformedRun::end, ImageInfo::horizon, LINE, Run::scanLineStart, TransformedRun::start, TransformedRun::transform(), Matrix2x2< V >::transpose(), Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, Vector2< double >::y, and Vector2< int >::y. Referenced by execute().

Here is the call graph for this function:

void SlamBeaconDetector::findSpecial | ( | const Vector2< int > & | center,
|  | const double | pinkRunWidth
| ) | `[private]`

| Tries to find a special landmark. Definition at line 475 of file SlamBeaconDetector.cpp. References Vector2< double >::angle(), Geometry::calculateAnglesForPoint(), Image::cameraInfo, CIRCLE, COLOR_CLASS, ColorCorrector::correct(), SpecialFlag::direction, Geometry::Line::direction, SpecialFlag::directionCount, FindSimilarFlag(), Pose2D::getAngle(), BresenhamLineScan::getNext(), ImageInfo::horizon, idText, Image::image, SpecialFlag::index, BresenhamLineScan::init(), LINE, min, MIN_SIMILARITY, noColor, NUM_SECTORS, NUM_SPECIAL_FLAGS, numFlags, numOfColors, OUTPUT, pi2, pi_2, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, SpecialFlag::sectors, slamPercept, specialFlags, Pose2D::translation, Vector2< V >::x, Vector2< double >::y, and Vector2< V >::y. Referenced by analyzeBeacon().

Here is the call graph for this function:

void SlamBeaconDetector::characterizeNewFlag | ( | const Vector2< int > & | center | ) | `[private]`

| Tries to characterize the surroundings of this flag. Definition at line 661 of file SlamBeaconDetector.cpp. References Geometry::calculateAnglesForPoint(), Image::cameraInfo, Geometry::Line::direction, ImageInfo::horizon, Vector2< double >::rotateRight(), scanForFlagCharacterization(), slamPercept, and Vector2< V >::x. Referenced by analyzeBeacon().

Here is the call graph for this function:

SlamFlagLocator::flagCharacteristics SlamBeaconDetector::scanForFlagCharacterization | ( | const Vector2< int > & | start,
|  | const Vector2< double > & | direction
| ) | `[private]`

| scan-method for characterizeNewFlag Definition at line 680 of file SlamBeaconDetector.cpp. References Image::cameraInfo, COLOR_CLASS, ColorCorrector::correct(), DEBUG_RESPONSE, BresenhamLineScan::getNext(), Image::image, NLINE, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, and Vector2< double >::y. Referenced by characterizeNewFlag().

Here is the call graph for this function:

void SlamBeaconDetector::analyzeBeacon | ( | const Vector2< double > & | left,
|  | const Vector2< int > & | center,
|  | const double | pinkRunWidth
| ) | `[private]`

| Tries to detect a beacon near a pink part. Definition at line 880 of file SlamBeaconDetector.cpp. References Vector2< double >::angle(), characterizeNewFlag(), Geometry::Line::direction, DOT, findSpecial(), Flag::FlagType, ImageInfo::horizon, ImageInfo::maxImageCoordinates, numOfClusteredBeaconCandidates, scanForBeaconEdges(), SlamFlagSpecialist::searchFlags(), Vector2< V >::x, and Vector2< V >::y.

Here is the call graph for this function:

int SlamBeaconDetector::scanForBeaconEdges | ( | const Vector2< int > & | position,
|  | const double | pinkRunWidth,
|  | Flag::FlagType & | flagType,
|  | Vector2< int > & | topEdge,
|  | Vector2< int > & | bottomEdge
| ) | `[private]`

| Looks for the vertical edges and the color type of a beacon. Definition at line 985 of file SlamBeaconDetector.cpp. References Vector2< V >::abs(), Vector2< double >::angle(), Geometry::Line::base, Geometry::clipPointInsideRectange(), COLOR_CLASS, ColorCorrector::correct(), Geometry::Line::direction, DOT, Flag::FlagType, Geometry::getIntersectionPointsOfLineAndRectangle(), ImageInfo::horizon, Image::image, ImageInfo::maxImageCoordinates, noColor, scanForBeaconPart(), SlamFlagSpecialist::searchFlags(), ImageInfo::vertLine, Vector2< V >::x, Vector2< double >::x, Vector2< V >::y, and Vector2< double >::y. Referenced by analyzeBeacon().

Here is the call graph for this function:

## Member Data Documentation

double SlamBeaconDetector::direction

| Definition at line 67 of file SlamBeaconDetector.h.

int SlamBeaconDetector::directionCount

| Definition at line 68 of file SlamBeaconDetector.h.

int SlamBeaconDetector::frameCount`[private]`

| Definition at line 71 of file SlamBeaconDetector.h.

int SlamBeaconDetector::numFlags`[private]`

| Definition at line 73 of file SlamBeaconDetector.h. Referenced by execute(), FindSimilarFlag(), findSpecial(), and SlamBeaconDetector().

SpecialFlag SlamBeaconDetector::specialFlags[NUM_SPECIAL_FLAGS]`[private]`

| Definition at line 74 of file SlamBeaconDetector.h. Referenced by execute(), FindSimilarFlag(), and findSpecial().

const SUSANEdgeDetectionLite SlamBeaconDetector::edgeDetectionU`[private]`

| Edge detection operators (U and V components) used to find the boundaries of flags. Definition at line 77 of file SlamBeaconDetector.h.

const SUSANEdgeDetectionLite SlamBeaconDetector::edgeDetectionV`[private]`

| Definition at line 78 of file SlamBeaconDetector.h.

const Image& SlamBeaconDetector::image`[private]`

| The image. Definition at line 81 of file SlamBeaconDetector.h.

const CameraMatrix& SlamBeaconDetector::cameraMatrix`[private]`

| The camera matrix. Definition at line 83 of file SlamBeaconDetector.h.

const CameraMatrix& SlamBeaconDetector::prevCameraMatrix`[private]`

| The previous camera matrix. Definition at line 85 of file SlamBeaconDetector.h.

const ImageInfo& SlamBeaconDetector::imageInf`[private]`

| Additional Image information. Definition at line 87 of file SlamBeaconDetector.h.

const ColorTable& SlamBeaconDetector::colorTable`[private]`

| The color table. Definition at line 89 of file SlamBeaconDetector.h.

const RobotPose& SlamBeaconDetector::robotPose`[private]`

| Definition at line 91 of file SlamBeaconDetector.h.

LandmarksPercept& SlamBeaconDetector::landmarksPercept`[private]`

| The landmarks percept. Definition at line 94 of file SlamBeaconDetector.h.

SpecialPercept& SlamBeaconDetector::specialPercept`[private]`

| The special percept. Definition at line 96 of file SlamBeaconDetector.h.

int SlamBeaconDetector::numOfBeaconCandidates`[private]`

| The number of possible beacons. Definition at line 98 of file SlamBeaconDetector.h.

int SlamBeaconDetector::numOfClusteredBeaconCandidates`[private]`

| The number of possible beacons after clustering. Definition at line 100 of file SlamBeaconDetector.h. Referenced by analyzeBeacon(), and execute().

Run SlamBeaconDetector::beaconCandidates[MAX_NUMBER_OF_PINK_RUNS]`[private]`

| The list of candidates. Definition at line 102 of file SlamBeaconDetector.h.

TransformedRun SlamBeaconDetector::transformedCandidates[MAX_NUMBER_OF_PINK_RUNS]`[private]`

| A buffer for transformed candidates. Definition at line 104 of file SlamBeaconDetector.h.

const double SlamBeaconDetector::horizontalBaseOffset`[private]`

| The base offset for horizontal scan lines. Definition at line 106 of file SlamBeaconDetector.h.

const int SlamBeaconDetector::numOfHorizontalScanLineAbove`[private]`

| The number of horizontal scan lines above the horizon. Definition at line 108 of file SlamBeaconDetector.h.

const int SlamBeaconDetector::numOfHorizontalScanLineBelow`[private]`

| The number of horizontal scan lines below the horizon. Definition at line 110 of file SlamBeaconDetector.h.

const double SlamBeaconDetector::horizontalOffsetModifier`[private]`

| The growth factor of the distance between two scan lines. Definition at line 112 of file SlamBeaconDetector.h.

const int SlamBeaconDetector::clusteringDistanceTolerance`[private]`

| The maximum distance between the merged runs. Definition at line 114 of file SlamBeaconDetector.h.

const int SlamBeaconDetector::minPinkRunLength`[private]`

| The minimum length of a pink run. Definition at line 116 of file SlamBeaconDetector.h.

const double SlamBeaconDetector::clusteringAspectRatio`[private]`

| The maximum vertical distance of scanlines to be clustered, over the estimated merged horizontal distance (half beacon aspect ratio should be 1:1). Definition at line 119 of file SlamBeaconDetector.h.

const double SlamBeaconDetector::projectionAspectRatio`[private]`

| The minimum value for the ratio of the 2 dimensions of the pink part of the beacon, to be used for projection on the unknown colored part. Definition at line 122 of file SlamBeaconDetector.h.

const int SlamBeaconDetector::edgeScanDepth`[private]`

| The maximum number of pixels which are examined after an edge response has been found for determining the color beyond the edge. Definition at line 125 of file SlamBeaconDetector.h.

unsigned char SlamBeaconDetector::minPinkUValue`[private]`

| The minimum U channel value of a pink pixel. Definition at line 127 of file SlamBeaconDetector.h.

const double SlamBeaconDetector::minFlagConfidence`[private]`

| A confidence threshold used to determine if a target beacon, whose type is not completely clear, can be accepted or not. Definition at line 130 of file SlamBeaconDetector.h.

SlamFlagSpecialist SlamBeaconDetector::flagSpecialist`[private]`

| A flag specialist. Definition at line 132 of file SlamBeaconDetector.h.

const ColorCorrector& SlamBeaconDetector::colorCorrector`[private]`

| The color corrector. Definition at line 134 of file SlamBeaconDetector.h.

The documentation for this class was generated from the following files:

- Modules/ImageProcessor/SlamImageProcessor/SlamBeaconDetector.h
- Modules/ImageProcessor/SlamImageProcessor/SlamBeaconDetector.cpp