Bulb Class Reference
Bulb mirror lookup table. More...
#include <models/mirror/bulb.h>

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.
Definition at line 33 of file bulb.h.
Constructor & Destructor Documentation
| Bulb::Bulb | ( | const char * | filename | ) |
| 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 71 of file bulb.cpp.
References load().
| Bulb::Bulb | ( | unsigned int | width, | |
| unsigned int | height | |||
| ) |
| 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
| Bulb::Bulb | ( | const Bulb & | bulb | ) |
Member Function Documentation
| string Bulb::composeFilename | ( | const char * | format | ) | [static] |
| float Bulb::convertAngleI2W | ( | float | angle_in_image | ) | const |
| float 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.)
| point_t 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 MirrorModel.
Definition at line 469 of file bulb.cpp.
References fawkes::point_t::x, and fawkes::point_t::y.
| float 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 586 of file bulb.cpp.
Referenced by setWorldPoint().
| const char * Bulb::getName | ( | ) | [virtual] |
| float Bulb::getOrientation | ( | ) | const [virtual] |
| cart_coord_2d_t 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 MirrorModel.
Definition at line 378 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 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 MirrorModel.
Definition at line 359 of file bulb.cpp.
References fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.
Referenced by getWorldPointGlobal().
| bool 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 534 of file bulb.cpp.
Referenced by isValidPoint().
| bool Bulb::isValid | ( | ) | [virtual] |
| bool 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 MirrorModel.
Definition at line 520 of file bulb.cpp.
References isNonZero().
| void Bulb::load | ( | const char * | filename | ) |
Load LUT from file.
- Parameters:
-
filename name of LUT file
Definition at line 246 of file bulb.cpp.
References Bulb::bulb_file_header_t::center_x, Bulb::bulb_file_header_t::center_y, Bulb::bulb_file_header_t::dist_max, Bulb::bulb_file_header_t::dist_min, Bulb::bulb_file_header_t::height, Bulb::bulb_file_header_t::orientation, and Bulb::bulb_file_header_t::width.
Referenced by Bulb().
| unsigned int Bulb::numNonZero | ( | ) | const |
| void Bulb::reset | ( | ) | [virtual] |
| void Bulb::save | ( | const char * | filename | ) |
Save LUT from file.
- Parameters:
-
filename name of LUT file
Definition at line 282 of file bulb.cpp.
References Bulb::bulb_file_header_t::center_x, Bulb::bulb_file_header_t::center_y, Bulb::bulb_file_header_t::dist_max, Bulb::bulb_file_header_t::dist_min, Bulb::bulb_file_header_t::height, Bulb::bulb_file_header_t::orientation, and Bulb::bulb_file_header_t::width.
| void 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 MirrorModel.
| void Bulb::setOrientation | ( | float | angle | ) | [virtual] |
Set orientation of the omni-camera device.
- Parameters:
-
angle angle to the forward direction.
Implements MirrorModel.
| void 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 430 of file bulb.cpp.
References getDistanceInImage(), fawkes::polar_coord_2d_t::phi, and fawkes::polar_coord_2d_t::r.
| void 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 MirrorModel.
| void 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 MirrorModel.
The documentation for this class was generated from the following files:

