Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
firevision::ROI Class Reference

Region of interest. More...

#include <>>

List of all members.

Public Member Functions

 ROI ()
 Constructor.
 ROI (const ROI &roi)
 Copy constructor.
 ROI (const ROI *roi)
 Copy constructor.
 ROI (unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, unsigned int image_width, unsigned int image_height)
 Constructor.
void set_start (fawkes::point_t p)
 Set upper left corner of ROI.
void set_start (unsigned int x, unsigned int y)
 Set upper left corner.
void set_width (unsigned int width)
 Set width of ROI.
unsigned int get_width () const
 Get width of ROI.
void set_height (unsigned int height)
 Set height of ROI.
unsigned int get_height () const
 Get height of ROI.
void set_image_width (unsigned int image_width)
 Set full image width.
unsigned int get_image_width () const
 Get full image width.
void set_image_height (unsigned int image_height)
 Set full image height Set the height of the image that contains this ROI.
unsigned int get_image_height () const
 Get full image height.
void set_line_step (unsigned int step)
 Set linestep.
unsigned int get_line_step () const
 Get linestep.
void set_pixel_step (unsigned int step)
 Set pixel step.
unsigned int get_pixel_step () const
 Get pixel step.
unsigned int get_hint () const
 Get hint.
void set_hint (unsigned int)
 Set hint.
bool contains (unsigned int x, unsigned int y)
 Check if this ROI contains the given coordinates.
bool neighbours (unsigned int x, unsigned int y, unsigned int margin) const
 Check if this ROI neighbours a pixel.
bool neighbours (ROI *roi, unsigned int margin) const
 Check if this ROI neighbours another ROI.
void extend (unsigned int x, unsigned int y)
 Extend ROI to include given pixel.
ROIoperator+= (ROI &roi)
 Merge two ROIs.
void grow (unsigned int margin)
 Grow this ROI by a given margin.
bool operator< (const ROI &roi) const
 Check if this ROI contains less hint points than the given ROI.
bool operator> (const ROI &roi) const
 Check if this ROI contains more hint points than the given ROI.
bool operator== (const ROI &roi) const
 Check if this ROI marks the same region for the same object and an image of the same base size and step parameters like the given ROI.
bool operator!= (const ROI &roi) const
 Check if this ROI does not mark the same region for the same object and an image of the same base size and step parameters like the given ROI.
ROIoperator= (const ROI &roi)
 Assign the given ROI data to this ROI.
unsigned int get_num_hint_points () const
 Gives an estimate of the number of points in this ROI that are classified to the given hint It is: num_hint_points <= total_num_of_scanline_points If you call contains and the point is actually included in this ROI this number is incremented.
unsigned char * get_roi_buffer_start (unsigned char *buffer) const
 Get ROI buffer start.

Static Public Member Functions

static ROIfull_image (unsigned int width, unsigned int height)
 Get full image ROI for given size.

Public Attributes

fawkes::point_t start
 ROI start.
unsigned int width
 ROI width.
unsigned int height
 ROI height.
unsigned int image_width
 width of image that contains this ROI
unsigned int image_height
 height of image that contains this ROI
unsigned int line_step
 line step
unsigned int pixel_step
 pixel step
unsigned int hint
 ROI hint.
color_t color
 ROI primary color.
unsigned int num_hint_points
 Minimum estimate of points in ROI that are attributed to the ROI hint.

Detailed Description

Region of interest.

The ROI class is central to FireVision. All image processing is concentrated on the pre-classified interesting parts of the image, denoted by the regions of interest (ROIs).

A ROI is a rectangular area of the image. Its start is denoted by the upper left corner of this rectangle and the size is given by its width and height.

Author:
Tim Niemueller

Definition at line 58 of file roi.h.


Constructor & Destructor Documentation

firevision::ROI::ROI ( )

Constructor.

Definition at line 51 of file roi.cpp.

firevision::ROI::ROI ( const ROI roi)

Copy constructor.

Parameters:
roireference to ROI to copy

Definition at line 87 of file roi.cpp.

References color, height, hint, image_height, image_width, line_step, num_hint_points, pixel_step, start, and width.

firevision::ROI::ROI ( const ROI roi)

Copy constructor.

Parameters:
roipointer to ROI to copy

Definition at line 105 of file roi.cpp.

References color, height, hint, image_height, image_width, line_step, num_hint_points, pixel_step, start, and width.

firevision::ROI::ROI ( unsigned int  start_x,
unsigned int  start_y,
unsigned int  width,
unsigned int  height,
unsigned int  image_width,
unsigned int  image_height 
)

Constructor.

Parameters:
start_xUpper left corner of ROI X coordinate
start_yUpper left corner of ROI y coordinate
widthWidth of extent of ROI
heightheight of extent of ROI
image_widthwidth of full image this ROI belongs to
image_heightheight of full image this ROI belongs to

Definition at line 67 of file roi.cpp.


Member Function Documentation

bool firevision::ROI::contains ( unsigned int  x,
unsigned int  y 
)

Check if this ROI contains the given coordinates.

Parameters:
xx coordinate in image
yy coordinate in image
Returns:
true if this ROI contains the given point, false otherwise

Definition at line 302 of file roi.cpp.

Referenced by firevision::FieldDrawer::draw_field().

void firevision::ROI::extend ( unsigned int  x,
unsigned int  y 
)

Extend ROI to include given pixel.

Parameters:
xx coordinate of pixel to include
yy coordinate of pixel to include

Definition at line 366 of file roi.cpp.

ROI * firevision::ROI::full_image ( unsigned int  width,
unsigned int  height 
)
static

Get full image ROI for given size.

Shortcut to get a full size ROI. This ROI is a static member so this method is not thread-safe or reentrant. It is also only valid until the next call to full_image() with different parameters. Line step is assumed to be the image width, the pixel step is assumed to be one. So this is only useful for b/w or planar images.

Parameters:
widthimage width
heightimage height
Returns:
full image ROI

Definition at line 560 of file roi.cpp.

unsigned int firevision::ROI::get_height ( ) const

Get height of ROI.

Returns:
height

Definition at line 177 of file roi.cpp.

unsigned int firevision::ROI::get_hint ( ) const

Get hint.

The hint gives an intuition what is in the ROI. In most cases this will depend on the color that the classifier used.

Returns:
hint

Definition at line 279 of file roi.cpp.

unsigned int firevision::ROI::get_image_height ( ) const

Get full image height.

Get the height of the image that contains this ROI.

Returns:
full height of image.

Definition at line 221 of file roi.cpp.

unsigned int firevision::ROI::get_image_width ( ) const

Get full image width.

Get the width of the image that contains this ROI.

Returns:
full width of image.

Definition at line 199 of file roi.cpp.

unsigned int firevision::ROI::get_line_step ( ) const

Get linestep.

Returns:
line step
See also:
setLineStep()

Definition at line 244 of file roi.cpp.

unsigned int firevision::ROI::get_num_hint_points ( ) const

Gives an estimate of the number of points in this ROI that are classified to the given hint It is: num_hint_points <= total_num_of_scanline_points If you call contains and the point is actually included in this ROI this number is incremented.

So you need to make sure to only call contains() for a point of the given hint class. This should always be the case anyway. If you extend the region by one very point the number will be incremented by one although the region may grow by more than just one point of the hint class. If you merge to ROIs by using the += operator this region adds the number of hint points of the region being merged to its own number. The region may grow by more than this number of points though.

Returns:
an estimate of the number of points of the hint class

Definition at line 543 of file roi.cpp.

unsigned int firevision::ROI::get_pixel_step ( ) const

Get pixel step.

Returns:
pixel step.
See also:
setPixelStep()

Definition at line 267 of file roi.cpp.

unsigned char * firevision::ROI::get_roi_buffer_start ( unsigned char *  buffer) const

Get ROI buffer start.

This uses the ROI's step and start data to calculate where the ROI starts in the given buffer.

Parameters:
bufferbuffer
Returns:
pointer into buffer where the ROI starts

Definition at line 519 of file roi.cpp.

Referenced by firevision::FilterShapeRemover::apply(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), and firevision::Shrinker::shrink().

unsigned int firevision::ROI::get_width ( ) const

Get width of ROI.

Returns:
width

Definition at line 157 of file roi.cpp.

void firevision::ROI::grow ( unsigned int  margin)

Grow this ROI by a given margin.

Parameters:
marginmargin to grow by

Definition at line 382 of file roi.cpp.

bool firevision::ROI::neighbours ( unsigned int  x,
unsigned int  y,
unsigned int  margin 
) const

Check if this ROI neighbours a pixel.

This checks if the given pixel is close to this ROI considered with the given margin.

Parameters:
xx coordinate in image
yy coordinate in image
marginmargin
Returns:
true if this ROI is a neigbour of the given pixel, false otherwise

Definition at line 326 of file roi.cpp.

Referenced by neighbours().

bool firevision::ROI::neighbours ( ROI roi,
unsigned int  margin 
) const

Check if this ROI neighbours another ROI.

This checks if the given ROI is close to this ROI considered with the given margin.

Parameters:
roiROI
marginmargin
Returns:
true if this ROI is a neigbour of the given ROI, false otherwise

Definition at line 343 of file roi.cpp.

References height, neighbours(), start, width, fawkes::point_t::x, and fawkes::point_t::y.

bool firevision::ROI::operator!= ( const ROI roi) const

Check if this ROI does not mark the same region for the same object and an image of the same base size and step parameters like the given ROI.

Parameters:
roiROI to compare to
Returns:
true, if ROIs are not similar, false otherwise

Definition at line 484 of file roi.cpp.

References num_hint_points.

ROI & firevision::ROI::operator+= ( ROI roi)

Merge two ROIs.

This ROI will be extended in any direction necessary to fully include the given ROI.

Parameters:
roiROI to include
Returns:
this instance

Definition at line 418 of file roi.cpp.

References height, num_hint_points, start, width, fawkes::point_t::x, and fawkes::point_t::y.

bool firevision::ROI::operator< ( const ROI roi) const

Check if this ROI contains less hint points than the given ROI.

Parameters:
roiROI to compare to.
Returns:
true, if the this ROI is smaller, false otherwise

Definition at line 437 of file roi.cpp.

References color, and num_hint_points.

ROI & firevision::ROI::operator= ( const ROI roi)

Assign the given ROI data to this ROI.

Parameters:
roiROI to copy
Returns:
this instance

Definition at line 495 of file roi.cpp.

References color, height, hint, image_height, image_width, line_step, num_hint_points, pixel_step, start, width, fawkes::point_t::x, and fawkes::point_t::y.

bool firevision::ROI::operator== ( const ROI roi) const

Check if this ROI marks the same region for the same object and an image of the same base size and step parameters like the given ROI.

Parameters:
roiROI to compare to
Returns:
true, if ROIs are similar, false otherwise

Definition at line 461 of file roi.cpp.

References color, height, hint, image_height, image_width, line_step, num_hint_points, pixel_step, start, width, fawkes::point_t::x, and fawkes::point_t::y.

bool firevision::ROI::operator> ( const ROI roi) const

Check if this ROI contains more hint points than the given ROI.

Parameters:
roiROI to compare to.
Returns:
true, if the this ROI is greater, false otherwise

Definition at line 448 of file roi.cpp.

References color, and num_hint_points.

void firevision::ROI::set_height ( unsigned int  height)

Set height of ROI.

Parameters:
heightnew height

Definition at line 167 of file roi.cpp.

Referenced by firevision::GradientClassifier::classify().

void firevision::ROI::set_hint ( unsigned int  hint)

Set hint.

Parameters:
hintnew hint
See also:
getHint()

Definition at line 290 of file roi.cpp.

void firevision::ROI::set_image_height ( unsigned int  image_height)

Set full image height Set the height of the image that contains this ROI.

Parameters:
image_heightfull height of image.

Definition at line 210 of file roi.cpp.

void firevision::ROI::set_image_width ( unsigned int  image_width)

Set full image width.

Set the width of the image that contains this ROI.

Parameters:
image_widthfull width of image.

Definition at line 188 of file roi.cpp.

Referenced by firevision::ScanlineLineGrid::set_roi().

void firevision::ROI::set_line_step ( unsigned int  step)

Set linestep.

The linestep is the offset in bytes from the beginning of one line in the buffer to the beginning of the next line.

Parameters:
stepnew line step

Definition at line 233 of file roi.cpp.

void firevision::ROI::set_pixel_step ( unsigned int  step)

Set pixel step.

The pixel step is the offset in bytes to get from one pixel to the next in the buffer.

Parameters:
stepnew pixel step.

Definition at line 256 of file roi.cpp.

Referenced by firevision::GradientClassifier::classify().

void firevision::ROI::set_start ( fawkes::point_t  p)

Set upper left corner of ROI.

Parameters:
ppoint

Definition at line 124 of file roi.cpp.

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

Referenced by firevision::GradientClassifier::classify().

void firevision::ROI::set_start ( unsigned int  x,
unsigned int  y 
)

Set upper left corner.

Parameters:
xx coordinate in image
yy coordinate in image

Definition at line 136 of file roi.cpp.

void firevision::ROI::set_width ( unsigned int  width)

Set width of ROI.

Parameters:
widthnew width

Definition at line 147 of file roi.cpp.

Referenced by firevision::GradientClassifier::classify().


Member Data Documentation

unsigned int firevision::ROI::height

ROI height.

Definition at line 122 of file roi.h.

Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMin::apply(), firevision::FilterMax::apply(), firevision::FilterInvert::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterRectify::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterMedian::apply(), firevision::FilterGauss::apply(), firevision::FilterOr::apply(), firevision::FilterHSearch::apply(), firevision::FilterSegment::apply(), firevision::FilterSharpen::apply(), firevision::FilterHipass::apply(), firevision::FilterSobel::apply(), firevision::FilterHVSearch::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::TriclopsStereoProcessor::calculate_disparity(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), neighbours(), operator+=(), operator=(), operator==(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::SquareShrinker::shrink(), firevision::Shrinker::shrink(), firevision::BorderShrinker::shrink(), and firevision::Filter::shrink_region().

unsigned int firevision::ROI::hint
unsigned int firevision::ROI::num_hint_points

Minimum estimate of points in ROI that are attributed to the ROI hint.

Definition at line 138 of file roi.h.

Referenced by firevision::FacesClassifier::classify(), firevision::SurfClassifier::classify(), operator!=(), operator+=(), operator<(), operator=(), operator==(), operator>(), and ROI().

unsigned int firevision::ROI::width

ROI width.

Definition at line 120 of file roi.h.

Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMin::apply(), firevision::FilterMax::apply(), firevision::FilterInvert::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterRectify::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterMedian::apply(), firevision::FilterGauss::apply(), firevision::FilterOr::apply(), firevision::FilterHSearch::apply(), firevision::FilterSegment::apply(), firevision::FilterSharpen::apply(), firevision::FilterHipass::apply(), firevision::FilterSobel::apply(), firevision::FilterHVSearch::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::TriclopsStereoProcessor::calculate_disparity(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), neighbours(), operator+=(), operator=(), operator==(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::SquareShrinker::shrink(), firevision::Shrinker::shrink(), firevision::BorderShrinker::shrink(), and firevision::Filter::shrink_region().


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