Fawkes API  Fawkes Development Version
firevision::MirrorCalibTool::CartesianImage Class Reference

Wraps an image so that access to (0, 0) is mapped to the middle of the image and so on. More...

List of all members.

Public Member Functions

 CartesianImage (const StepResult &res, PolarAngle phi, PixelPoint center, const unsigned char *mask=0)
 Constructor.
 CartesianImage (const StepResult &res, PolarAngle phi, const unsigned char *mask=0)
 Constructor.
 CartesianImage (const unsigned char *buf, int width, int height, PolarAngle phi, const PixelPoint &center)
 Constructor.
 CartesianImage (unsigned char *buf, int width, int height, PolarAngle phi, const PixelPoint &center)
 Constructor.
 CartesianImage (const unsigned char *buf, int width, int height, PolarAngle phi)
 Constructor.
 CartesianImage (unsigned char *buf, int width, int height, PolarAngle phi)
 Constructor.
unsigned char * buf ()
 Get Buffer.
const unsigned char * mask () const
 Mask.
const unsigned char * buf () const
 Buffer.
const PixelPointcenter () const
 Center of buffer.
const int width () const
 Width of buffer.
const int height () const
 Height of buffer.
const PolarAngle phi () const
 Phi angle.
PixelPoint to_pixel (const CartesianPoint &p) const
 Converts a cartesian point to a pixel point.
CartesianPoint to_cartesian (const PixelPoint &p) const
 Converts a pixel point to a cartesian point.
bool contains (const PixelPoint &p) const
 Indicates whether the image contains a pixel point.
bool contains (const CartesianPoint &p) const
 Indicates whether the image contains a cartesian point.
unsigned char get (const CartesianPoint &p) const
 Get luminance at a given point.
int max_x () const
 Get Maximum cartesian X coordinate of the image.
int max_y () const
 Get Maximum cartesian Y coordinate of the image.
PolarRadius max_radius () const
 Maximum polar radius of the image.
void set_color (const PixelPoint &p, unsigned char luma, unsigned char chrominance)
 Sets the luminance Y and chrominance U at a given pixel point.
void set_color (const CartesianPoint &p, unsigned char luma, unsigned char chrominance)
 Sets the luminance Y and chrominance U at a given cartesian point.
float bright_fraction (const CartesianPoint &from, const CartesianPoint &to) const
 Get relative amount of bright pixels.
bool is_line (const CartesianPoint &p, int length) const
 Indicates whether at pixel point p there is a highlighted line.
void highlight_line (const CartesianPoint &p, int length)
 Highlightes a line at pixel point p.
void draw_line (const PixelPoint &p, const PixelPoint &q)
 Draws a line from p to q.
void draw_line (const CartesianPoint &p, const CartesianPoint &q)
 Draws a line from p to q.
void highlight_pixel (const PixelPoint &p)
 Highlights a pixel, i.e.
void highlight_point (const CartesianPoint &p)
 Highlights a point, i.e.

Detailed Description

Wraps an image so that access to (0, 0) is mapped to the middle of the image and so on.

The result is a cartesian coordinate system with X and Y axis.


Constructor & Destructor Documentation

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const StepResult res,
PolarAngle  phi,
PixelPoint  center,
const unsigned char *  mask = 0 
) [inline]

Constructor.

Parameters:
resThe step result that contains the base image.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.
maskThe mask that indicates which pixels should be ignored.

Definition at line 336 of file mirror_calib.cpp.

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const StepResult res,
PolarAngle  phi,
const unsigned char *  mask = 0 
) [inline]

Constructor.

Parameters:
resThe step result that contains the base image.
phiThe angle by which the image is rotated counter-clockwise.
maskThe mask that indicates which pixels should be ignored.

Definition at line 353 of file mirror_calib.cpp.

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi,
const PixelPoint center 
) [inline]

Constructor.

Parameters:
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.

Definition at line 372 of file mirror_calib.cpp.

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi,
const PixelPoint center 
) [inline]

Constructor.

Parameters:
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.
centerThe center of the image from the robot's point of view; i.e. the center of the cone mirror.

Definition at line 393 of file mirror_calib.cpp.

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( const unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi 
) [inline]

Constructor.

Parameters:
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.

Definition at line 412 of file mirror_calib.cpp.

firevision::MirrorCalibTool::CartesianImage::CartesianImage ( unsigned char *  buf,
int  width,
int  height,
PolarAngle  phi 
) [inline]

Constructor.

Parameters:
bufThe base YUV buffer.
widthImage width.
heightImage height.
phiThe angle by which the image is rotated counter-clockwise.

Definition at line 430 of file mirror_calib.cpp.


Member Function Documentation

float firevision::MirrorCalibTool::CartesianImage::bright_fraction ( const CartesianPoint from,
const CartesianPoint to 
) const [inline]

Get relative amount of bright pixels.

Parameters:
fromOne point of the rectangle.
toOpposite point of the rectangle.
Returns:
relative amount of BRIGHT pixels in the rectangle denoted by the bottom-left (x1, y1) and the top-right (x2, y2).

Definition at line 588 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

unsigned char* firevision::MirrorCalibTool::CartesianImage::buf ( ) [inline]

Get Buffer.

Returns:
buffer

Definition at line 446 of file mirror_calib.cpp.

const unsigned char* firevision::MirrorCalibTool::CartesianImage::buf ( ) const [inline]

Buffer.

Returns:
const buffer

Definition at line 454 of file mirror_calib.cpp.

const PixelPoint& firevision::MirrorCalibTool::CartesianImage::center ( ) const [inline]

Center of buffer.

Returns:
center point of buffer

Definition at line 458 of file mirror_calib.cpp.

bool firevision::MirrorCalibTool::CartesianImage::contains ( const PixelPoint p) const [inline]

Indicates whether the image contains a pixel point.

Parameters:
pThe point.
Returns:
true if pixel point is in image, false otherwise

Definition at line 499 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_crosshair().

bool firevision::MirrorCalibTool::CartesianImage::contains ( const CartesianPoint p) const [inline]

Indicates whether the image contains a cartesian point.

Parameters:
pThe point.
Returns:
true if cartesian point is in image, false otherwise

Definition at line 509 of file mirror_calib.cpp.

void firevision::MirrorCalibTool::CartesianImage::draw_line ( const PixelPoint p,
const PixelPoint q 
) [inline]

Draws a line from p to q.

Parameters:
pFirst point of the line.
qFirst point of the line.

Definition at line 649 of file mirror_calib.cpp.

void firevision::MirrorCalibTool::CartesianImage::draw_line ( const CartesianPoint p,
const CartesianPoint q 
) [inline]

Draws a line from p to q.

Parameters:
pFirst point of the line.
qFirst point of the line.

Definition at line 659 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, firevision::MirrorCalibTool::Point::y, firevision::MirrorCalibTool::Point::length(), firevision::MirrorCalibTool::Point::atan(), and fawkes::set_color().

unsigned char firevision::MirrorCalibTool::CartesianImage::get ( const CartesianPoint p) const [inline]

Get luminance at a given point.

Parameters:
pThe point.
Returns:
luminance at given point

Definition at line 519 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, firevision::MirrorCalibTool::Point::y, firevision::YUV_t_struct::Y, firevision::YUV_t_struct::U, and firevision::YUV_t_struct::V.

const int firevision::MirrorCalibTool::CartesianImage::height ( ) const [inline]

Height of buffer.

Returns:
height of buffer

Definition at line 466 of file mirror_calib.cpp.

void firevision::MirrorCalibTool::CartesianImage::highlight_line ( const CartesianPoint p,
int  length 
) [inline]

Highlightes a line at pixel point p.

Parameters:
pThe center point of the line.
lengthThe length of the line.

Definition at line 636 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::atan(), fawkes::deg2rad(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

void firevision::MirrorCalibTool::CartesianImage::highlight_pixel ( const PixelPoint p) [inline]

Highlights a pixel, i.e.

sets the luminance and chrominance to MARK_LUMA and MARK_CHROMINANCE.

Parameters:
pThe pixel.

Definition at line 676 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, firevision::MirrorCalibTool::Point::y, and fawkes::set_color().

Referenced by firevision::MirrorCalibTool::next_step().

void firevision::MirrorCalibTool::CartesianImage::highlight_point ( const CartesianPoint p) [inline]

Highlights a point, i.e.

sets the luminance and chrominance to MARK_LUMA and MARK_CHROMINANCE.

Parameters:
pThe point.

Definition at line 693 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, firevision::MirrorCalibTool::Point::y, and fawkes::set_color().

Referenced by firevision::MirrorCalibTool::next_step().

bool firevision::MirrorCalibTool::CartesianImage::is_line ( const CartesianPoint p,
int  length 
) const [inline]

Indicates whether at pixel point p there is a highlighted line.

Parameters:
pThe assumed center point of the line.
lengthThe length of the line
Returns:
true if pixel belongs to line, false otherwise

Definition at line 618 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::atan(), fawkes::deg2rad(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

const unsigned char* firevision::MirrorCalibTool::CartesianImage::mask ( ) const [inline]

Mask.

Returns:
mask

Definition at line 450 of file mirror_calib.cpp.

PolarRadius firevision::MirrorCalibTool::CartesianImage::max_radius ( ) const [inline]

Maximum polar radius of the image.

Returns:
Maximum polar radius of the image.

Definition at line 550 of file mirror_calib.cpp.

Referenced by firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_crosshair().

int firevision::MirrorCalibTool::CartesianImage::max_x ( ) const [inline]

Get Maximum cartesian X coordinate of the image.

Returns:
Maximum cartesian X coordinate of the image.

Definition at line 542 of file mirror_calib.cpp.

int firevision::MirrorCalibTool::CartesianImage::max_y ( ) const [inline]

Get Maximum cartesian Y coordinate of the image.

Returns:
Maximum cartesian Y coordinate of the image.

Definition at line 546 of file mirror_calib.cpp.

const PolarAngle firevision::MirrorCalibTool::CartesianImage::phi ( ) const [inline]

Phi angle.

Returns:
Phi angle

Definition at line 470 of file mirror_calib.cpp.

void firevision::MirrorCalibTool::CartesianImage::set_color ( const PixelPoint p,
unsigned char  luma,
unsigned char  chrominance 
) [inline]

Sets the luminance Y and chrominance U at a given pixel point.

Parameters:
pThe point whose luminance Y and chrominance U is changed.
lumaThe luminance Y.
chrominanceThe chrominance U.

Definition at line 559 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::draw_line(), and firevision::MirrorCalibTool::draw_crosshair().

void firevision::MirrorCalibTool::CartesianImage::set_color ( const CartesianPoint p,
unsigned char  luma,
unsigned char  chrominance 
) [inline]

Sets the luminance Y and chrominance U at a given cartesian point.

Parameters:
pThe point whose luminance Y and chrominance U is changed.
lumaThe luminance Y.
chrominanceThe chrominance U.

Definition at line 575 of file mirror_calib.cpp.

References fawkes::set_color().

CartesianPoint firevision::MirrorCalibTool::CartesianImage::to_cartesian ( const PixelPoint p) const [inline]

Converts a pixel point to a cartesian point.

Parameters:
pThe point.
Returns:
converted point

Definition at line 488 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::Point::x, firevision::MirrorCalibTool::Point::y, and firevision::MirrorCalibTool::CartesianPoint::rotate().

PixelPoint firevision::MirrorCalibTool::CartesianImage::to_pixel ( const CartesianPoint p) const [inline]

Converts a cartesian point to a pixel point.

Parameters:
pThe point.
Returns:
converted point

Definition at line 477 of file mirror_calib.cpp.

References firevision::MirrorCalibTool::CartesianPoint::rotate(), firevision::MirrorCalibTool::Point::x, and firevision::MirrorCalibTool::Point::y.

Referenced by firevision::MirrorCalibTool::ConvexPolygon::contains(), and firevision::MirrorCalibTool::next_step().

const int firevision::MirrorCalibTool::CartesianImage::width ( ) const [inline]

Width of buffer.

Returns:
width of buffer

Definition at line 462 of file mirror_calib.cpp.


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