Fawkes API  Fawkes Development Version
firevision::CornerHorizon Class Reference

Cut of arbitrary scanline models at an artificial horizon. More...

#include <>>

Inheritance diagram for firevision::CornerHorizon:

Public Member Functions

 CornerHorizon (ScanlineModel *model, float field_length, float field_width, float field_border, unsigned int image_width, unsigned int image_height, float camera_height, float camera_ori, float horizontal_angle, float vertical_angle)
 Constructor. More...
 
virtual ~CornerHorizon ()
 Destructor. More...
 
fawkes::upoint_t operator* ()
 Get the current coordinate. More...
 
fawkes::upoint_toperator-> ()
 Get pointer to current point. More...
 
fawkes::upoint_toperator++ ()
 Postfix ++ operator. More...
 
fawkes::upoint_toperator++ (int)
 Prefix ++ operator. More...
 
bool finished ()
 Check if all desired points have been processed. More...
 
void reset ()
 Reset model. More...
 
const char * get_name ()
 Get name of scanline model. More...
 
unsigned int get_margin ()
 Get margin around points. More...
 
void set_robot_pose (float x, float y, float ori)
 Set the robot's pose. More...
 
void set_pan_tilt (float pan, float tilt)
 Set camera's pan/tilt values. More...
 
unsigned int getHorizon ()
 Get the horizon point. More...
 
- Public Member Functions inherited from firevision::ScanlineModel
virtual ~ScanlineModel ()
 Virtual empty destructor. More...
 
virtual void set_roi (ROI *roi=NULL)
 Set the region-of-interest. More...
 

Protected Member Functions

void calculate ()
 Calculate horizon point. More...
 

Detailed Description

Cut of arbitrary scanline models at an artificial horizon.

The artificial horizon is calculated by the highest corner that is visible in the image. From that the Y coordinate in the image is used and everything above that point is ignored from the scanline grid.

This class was written in a one-night hacking sensation at RoboLudens 2006 in Eindhoven. For that time it is pretty readable code and we are using it since then. Cool!

Author
Tim Niemueller
Stefan Schiffer
Christoph Mies

Definition at line 40 of file cornerhorizon.h.

Constructor & Destructor Documentation

◆ CornerHorizon()

firevision::CornerHorizon::CornerHorizon ( ScanlineModel model,
float  field_length,
float  field_width,
float  field_border,
unsigned int  image_width,
unsigned int  image_height,
float  camera_height,
float  camera_ori,
float  horizontal_angle,
float  vertical_angle 
)

Constructor.

Parameters
modelModel to apply the artificial horizon on. This model is deleted on the destruction of the CornerHorizon instance so you can forget about it in the using application.
field_lengthlength of soccer field
field_widthwidth of soccer field
field_bordersize of border around the field (i.e. distance between the outer white line and the physical field end)
image_widthimage width in pixels
image_heightimage height in pixels
camera_heightheight of camera above ground
camera_oriorientation of camera on the robot in degrees
horizontal_anglehorizontal viewing angle in degrees
vertical_anglevertical viewing angle in degrees

Definition at line 70 of file cornerhorizon.cpp.

References fawkes::deg2rad().

◆ ~CornerHorizon()

firevision::CornerHorizon::~CornerHorizon ( )
virtual

Destructor.

Not that this deletes the supplied model!

Definition at line 102 of file cornerhorizon.cpp.

Member Function Documentation

◆ calculate()

void firevision::CornerHorizon::calculate ( )
protected

Calculate horizon point.

Definition at line 124 of file cornerhorizon.cpp.

References fawkes::normalize_mirror_rad().

◆ finished()

bool firevision::CornerHorizon::finished ( )
virtual

Check if all desired points have been processed.

Returns
true if all pixels that the model defines have been iterated.

Implements firevision::ScanlineModel.

Definition at line 236 of file cornerhorizon.cpp.

◆ get_margin()

unsigned int firevision::CornerHorizon::get_margin ( )
virtual

Get margin around points.

Models that do not use margins shall return zero. It shall be guaranteed that in this margin region around a point there is no other point that has been or will be returned in a full iteration.

Returns
margin around a point.

Implements firevision::ScanlineModel.

Definition at line 259 of file cornerhorizon.cpp.

◆ get_name()

const char * firevision::CornerHorizon::get_name ( )
virtual

Get name of scanline model.

Returns
name of scanline model.

Implements firevision::ScanlineModel.

Definition at line 252 of file cornerhorizon.cpp.

◆ getHorizon()

unsigned int firevision::CornerHorizon::getHorizon ( )

Get the horizon point.

Returns
y coordinate of the horizon point.

Definition at line 269 of file cornerhorizon.cpp.

◆ operator*()

upoint_t firevision::CornerHorizon::operator* ( )
virtual

Get the current coordinate.

Returns
current point in image that is shall be processed.

Implements firevision::ScanlineModel.

Definition at line 109 of file cornerhorizon.cpp.

◆ operator++() [1/2]

upoint_t * firevision::CornerHorizon::operator++ ( )
virtual

Postfix ++ operator.

Advances to the next point and returns the new point.

Returns
pointer to new point

Implements firevision::ScanlineModel.

Definition at line 185 of file cornerhorizon.cpp.

◆ operator++() [2/2]

upoint_t * firevision::CornerHorizon::operator++ ( int  )
virtual

Prefix ++ operator.

Advances to the next point but returns the old point.

Returns
pointer to next point

Implements firevision::ScanlineModel.

Definition at line 213 of file cornerhorizon.cpp.

◆ operator->()

upoint_t * firevision::CornerHorizon::operator-> ( )
virtual

Get pointer to current point.

Returns
pointer to current point
See also
operator*()

Implements firevision::ScanlineModel.

Definition at line 116 of file cornerhorizon.cpp.

◆ reset()

void firevision::CornerHorizon::reset ( )
virtual

Reset model.

Resets the set of processed points.

Implements firevision::ScanlineModel.

Definition at line 243 of file cornerhorizon.cpp.

◆ set_pan_tilt()

void firevision::CornerHorizon::set_pan_tilt ( float  pan,
float  tilt 
)
virtual

Set camera's pan/tilt values.

Parameters
pancamera's current pan
tiltcamera's current tilt

Implements firevision::ScanlineModel.

Definition at line 285 of file cornerhorizon.cpp.

◆ set_robot_pose()

void firevision::CornerHorizon::set_robot_pose ( float  x,
float  y,
float  ori 
)
virtual

Set the robot's pose.

Parameters
xrobot's x coordinate on field in meters
yrobot's y coordinate on field in meters
orirobot's orientation. Looking towards the opponent goal is zero rad, with positive values pointing to the right, negative to the left.

Implements firevision::ScanlineModel.

Definition at line 276 of file cornerhorizon.cpp.


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