firevision::Bulb Class Reference

Bulb mirror lookup table. More...

#include <models/mirror/bulb.h>

Inheritance diagram for firevision::Bulb:
Inheritance graph
[legend]

List of all members.

Classes

struct  bulb_file_header_t
 bulb file header. More...

Public Member Functions

 Bulb (const char *filename)
 Constructor.
 Bulb (const char *filename, const char *lut_id, bool destroy_on_delete=false)
 Constructor.
 Bulb (unsigned int width, unsigned int height)
 Constructor.
 Bulb (unsigned int width, unsigned int height, const char *lut_id, bool destroy_on_delete=false)
 Constructor.
 Bulb (const Bulb &bulb)
 Copy constructor.
virtual ~Bulb ()
 Destructor.
virtual void warp2unwarp (unsigned int warp_x, unsigned int warp_y, unsigned int *unwarp_x, unsigned int *unwarp_y)
 Transform warped to unwarped point.
virtual void unwarp2warp (unsigned int unwarp_x, unsigned int unwarp_y, unsigned int *warp_x, unsigned int *warp_y)
 Transform unwarped to warped point.
virtual const char * getName ()
 Get name of model.
virtual bool isValid ()
 Check if a valid LUT has been loaded.
virtual void setWorldPoint (unsigned int image_x, unsigned int image_y, float world_r, float world_phi)
 Set a world point mapping.
virtual fawkes::polar_coord_2d_t getWorldPointRelative (unsigned int image_x, unsigned int image_y) const
 Get relative coordinate based on image coordinates.
virtual fawkes::cart_coord_2d_t getWorldPointGlobal (unsigned int image_x, unsigned int image_y, float pose_x, float pose_y, float pose_ori) const
 Get global coordinate based on image coordinates.
virtual void reset ()
 Reset model.
virtual fawkes::point_t getCenter () const
 Get the image pixel that is the center of the omni-camera.
virtual void setCenter (unsigned int image_x, unsigned int image_y)
 Set center of omni-camera to given image pixel.
virtual void setOrientation (float angle)
 Set orientation of the omni-camera device.
virtual float getOrientation () const
 Get orientation of the omni-camera.
virtual bool isValidPoint (unsigned int image_x, unsigned int image_y) const
 Check if the given point is valid.
bool isNonZero (unsigned int image_x, unsigned int image_y) const
 Check if pixel maps to valid world point.
unsigned int numNonZero () const
 Get number of non-zero entries.
float getAngle (unsigned int image_x, unsigned int image_y) const
 Angle between direction to point and "to the right".
float getDistanceInImage (unsigned int image_p1_x, unsigned int image_p1_y, unsigned int image_p2_x, unsigned int image_p2_y)
 Euklidean distance between to image points.
float convertAngleI2W (float angle_in_image) const
 convertAngleI2W
void load (const char *filename)
 Load LUT from file.
void save (const char *filename)
 Save LUT from file.

Static Public Member Functions

static std::string composeFilename (const char *format)
 Compose a filename matching the given format.

Friends

class BulbGenerator

Detailed Description

Bulb mirror lookup table.

This mirror model is based on a LUT that will map image pixels to radial coordinates in relative radial coordinates.

Author:
Tim Niemueller
Martin Heracles

Definition at line 38 of file bulb.h.


Constructor & Destructor Documentation

firevision::Bulb::Bulb ( const char *  filename  ) 

Constructor.

Load bulb LUT from file.

Parameters:
filename filename of bulb file to load.

Definition at line 62 of file bulb.cpp.

References load().

firevision::Bulb::Bulb ( const char *  filename,
const char *  lut_id,
bool  destroy_on_delete = false 
)

Constructor.

Load bulb LUT from file and expose LUT via shared memory.

Parameters:
filename filename of bulb file to load.
lut_id LUT ID
destroy_on_delete destroy LUT on delete
See also:
SharedMemoryLookupTable

Definition at line 76 of file bulb.cpp.

References load().

firevision::Bulb::Bulb ( unsigned int  width,
unsigned int  height 
)

Constructor.

Create new empty bulb LUT.

Parameters:
width width of LUT
height height of LUT

Definition at line 121 of file bulb.cpp.

firevision::Bulb::Bulb ( unsigned int  width,
unsigned int  height,
const char *  lut_id,
bool  destroy_on_delete = false 
)

Constructor.

Create new empty bulb LUT and expose LUT via shared memory.

Parameters:
width width of LUT
height height of LUT
lut_id LUT ID
destroy_on_delete destroy LUT on delete
See also:
SharedMemoryLookupTable

Definition at line 97 of file bulb.cpp.

firevision::Bulb::Bulb ( const Bulb bulb  ) 

Copy constructor.

Parameters:
bulb bulb LUT to copy

Definition at line 141 of file bulb.cpp.

firevision::Bulb::~Bulb (  )  [virtual]

Destructor.

Erases LUT memory.

Definition at line 194 of file bulb.cpp.


Member Function Documentation

string firevision::Bulb::composeFilename ( const char *  format  )  [static]

Compose a filename matching the given format.

In the format h is replaced by the hostname.

Parameters:
format format of file name
Returns:
filename based on the given format

Definition at line 666 of file bulb.cpp.

float firevision::Bulb::convertAngleI2W ( float  angle_in_image  )  const

convertAngleI2W

Returns:
If you have a (ball-) direction in the omni-image, at which direction is the ball in the world, relative to the robot?
Parameters:
angle_in_image angle to be converted

Definition at line 609 of file bulb.cpp.

float firevision::Bulb::getAngle ( unsigned int  image_x,
unsigned int  image_y 
) const

Angle between direction to point and "to the right".

Parameters:
image_x x coordinate in image
image_y y coordinate in image
Returns:
angle between direction "to point (px, py)" and direction "to the right", with respect to center point. (Angle is in radians; clockwise is positive, counter-clockwise is negative.)

Definition at line 575 of file bulb.cpp.

point_t firevision::Bulb::getCenter (  )  const [virtual]

Get the image pixel that is the center of the omni-camera.

Returns:
pixel coordinates of mirror center in image.

Implements firevision::MirrorModel.

Definition at line 474 of file bulb.cpp.

References fawkes::point_t::x, and fawkes::point_t::y.

float firevision::Bulb::getDistanceInImage ( unsigned int  image_p1_x,
unsigned int  image_p1_y,
unsigned int  image_p2_x,
unsigned int  image_p2_y 
)

Euklidean distance between to image points.

Returns:
the (euklidian) distance between two image points
Parameters:
image_p1_x x coordinate in image of point 1
image_p1_y y coordinate in image of point 1
image_p2_x x coordinate in image of point 2
image_p2_y y coordinate in image of point 2

Definition at line 591 of file bulb.cpp.

Referenced by setWorldPoint().

const char * firevision::Bulb::getName (  )  [virtual]

Get name of model.

Returns:
name of model

Implements firevision::MirrorModel.

Definition at line 348 of file bulb.cpp.

float firevision::Bulb::getOrientation (  )  const [virtual]

Get orientation of the omni-camera.

Returns:
angle to forward direction.

Implements firevision::MirrorModel.

Definition at line 518 of file bulb.cpp.

cart_coord_2d_t firevision::Bulb::getWorldPointGlobal ( unsigned int  image_x,
unsigned int  image_y,
float  pose_x,
float  pose_y,
float  pose_ori 
) const [virtual]

Get global coordinate based on image coordinates.

Parameters:
image_x x coordinate in image in pixels
image_y y coordinate in image in pixels
pose_x robot pose global x coordinate
pose_y robot pose global y coordinate
pose_ori robot pose global orientation
Returns:
cartesian coordinates relative to the base system in metric global system

Implements firevision::MirrorModel.

Definition at line 383 of file bulb.cpp.

References getWorldPointRelative(), fawkes::polar_coord_2d_t::phi, fawkes::polar_coord_2d_t::r, fawkes::cart_coord_2d_t::x, and fawkes::cart_coord_2d_t::y.

polar_coord_2d_t firevision::Bulb::getWorldPointRelative ( unsigned int  image_x,
unsigned int  image_y 
) const [virtual]

Get relative coordinate based on image coordinates.

Parameters:
image_x x coordinate in image in pixels
image_y y coordinate in image in pixels
Returns:
polar coordinates relative to the base system in metric local system

Implements firevision::MirrorModel.

Definition at line 364 of file bulb.cpp.

References fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.

Referenced by getWorldPointGlobal().

bool firevision::Bulb::isNonZero ( unsigned int  image_x,
unsigned int  image_y 
) const

Check if pixel maps to valid world point.

Parameters:
image_x x coordinate in image
image_y y coordinate in image
Returns:
true, iff image pixel (imagePointX, imagePointY) is not zero (checks distances "r" only, not the angles "phi") i.e. if it maps to a real-world position

Definition at line 539 of file bulb.cpp.

Referenced by isValidPoint().

bool firevision::Bulb::isValid (  )  [virtual]

Check if a valid LUT has been loaded.

Returns:
true if a valid LUT has been loaded and can be used, false otherwise

Definition at line 357 of file bulb.cpp.

bool firevision::Bulb::isValidPoint ( unsigned int  image_x,
unsigned int  image_y 
) const [virtual]

Check if the given point is valid.

Parameters:
image_x x coordinate of queried pixel in image
image_y y coordinate of queried pixel in image
Returns:
true, if pixel is valid, false otherwise.

Implements firevision::MirrorModel.

Definition at line 525 of file bulb.cpp.

References isNonZero().

void firevision::Bulb::load ( const char *  filename  ) 
unsigned int firevision::Bulb::numNonZero (  )  const

Get number of non-zero entries.

Returns:
number of non-zero entries.

Definition at line 553 of file bulb.cpp.

void firevision::Bulb::reset (  )  [virtual]

Reset model.

This will reset mirror model.

Implements firevision::MirrorModel.

Definition at line 467 of file bulb.cpp.

void firevision::Bulb::save ( const char *  filename  ) 
void firevision::Bulb::setCenter ( unsigned int  image_x,
unsigned int  image_y 
) [virtual]

Set center of omni-camera to given image pixel.

Parameters:
image_x x coordinate in image in pixels
image_y y coordinate in image in pixels

Implements firevision::MirrorModel.

Definition at line 486 of file bulb.cpp.

void firevision::Bulb::setOrientation ( float  angle  )  [virtual]

Set orientation of the omni-camera device.

Parameters:
angle angle to the forward direction.

Implements firevision::MirrorModel.

Definition at line 504 of file bulb.cpp.

void firevision::Bulb::setWorldPoint ( unsigned int  image_x,
unsigned int  image_y,
float  world_r,
float  world_phi 
) [virtual]

Set a world point mapping.

This modifies the mapping in the LUT. An exception is thrown if the coordinates are out of range or the distance is zero.

Parameters:
image_x x coordinate of point in image in pixels
image_y y coordinate of point in image in pixels
world_r distance to real object from camera center in meters
world_phi angle to real object

Definition at line 435 of file bulb.cpp.

References getDistanceInImage(), fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.

void firevision::Bulb::unwarp2warp ( unsigned int  unwarp_x,
unsigned int  unwarp_y,
unsigned int *  warp_x,
unsigned int *  warp_y 
) [virtual]

Transform unwarped to warped point.

Given a point in the unwarped image it returns the coordinates of the corresponding pixel in the warped image Useful for: You want to generate the unwarped image and ask the model for every point of the unwarped image which warped pixel to copy

Parameters:
unwarp_x unwarped x coordinate
unwarp_y unwarped y coordinate
warp_x contains the warped x coordinate upon return
warp_y contains the warped y coordinate upon return

Implements firevision::MirrorModel.

Definition at line 340 of file bulb.cpp.

void firevision::Bulb::warp2unwarp ( unsigned int  warp_x,
unsigned int  warp_y,
unsigned int *  unwarp_x,
unsigned int *  unwarp_y 
) [virtual]

Transform warped to unwarped point.

Given a point in the warped image it returns the coordinates of the corresponding pixel in the unwarped image Useful for: You found the ball center in the image and want to get the position this pixel would have in an unwarped image

Parameters:
warp_x warped x coordinate
warp_y warped y coordinate
unwarp_x contains unwarped x coordinate upon return
unwarp_y contains unwarped y coordinate upon return

Implements firevision::MirrorModel.

Definition at line 323 of file bulb.cpp.


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

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1