Fawkes API  Fawkes Development Version
firevision::ROI Class Reference

Region of interest. More...

#include <>>

Public Member Functions

 ROI ()
 Constructor. More...
 
 ROI (const ROI &roi)
 Copy constructor. More...
 
 ROI (const ROI *roi)
 Copy constructor. More...
 
 ROI (unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, unsigned int image_width, unsigned int image_height)
 Constructor. More...
 
void set_start (fawkes::upoint_t p)
 Set upper left corner of ROI. More...
 
void set_start (unsigned int x, unsigned int y)
 Set upper left corner. More...
 
void set_width (unsigned int width)
 Set width of ROI. More...
 
unsigned int get_width () const
 Get width of ROI. More...
 
void set_height (unsigned int height)
 Set height of ROI. More...
 
unsigned int get_height () const
 Get height of ROI. More...
 
void set_image_width (unsigned int image_width)
 Set full image width. More...
 
unsigned int get_image_width () const
 Get full image width. More...
 
void set_image_height (unsigned int image_height)
 Set full image height Set the height of the image that contains this ROI. More...
 
unsigned int get_image_height () const
 Get full image height. More...
 
void set_line_step (unsigned int step)
 Set linestep. More...
 
unsigned int get_line_step () const
 Get linestep. More...
 
void set_pixel_step (unsigned int step)
 Set pixel step. More...
 
unsigned int get_pixel_step () const
 Get pixel step. More...
 
unsigned int get_hint () const
 Get hint. More...
 
void set_hint (unsigned int)
 Set hint. More...
 
bool contains (unsigned int x, unsigned int y)
 Check if this ROI contains the given coordinates. More...
 
ROI intersect (ROI const &roi) const
 Intersect this ROI with another. More...
 
bool neighbours (unsigned int x, unsigned int y, unsigned int margin) const
 Check if this ROI neighbours a pixel. More...
 
bool neighbours (ROI *roi, unsigned int margin) const
 Check if this ROI neighbours another ROI. More...
 
void extend (unsigned int x, unsigned int y)
 Extend ROI to include given pixel. More...
 
ROIoperator+= (ROI &roi)
 Merge two ROIs. More...
 
void grow (unsigned int margin)
 Grow this ROI by a given margin. More...
 
bool operator< (const ROI &roi) const
 Check if this ROI contains less hint points than the given ROI. More...
 
bool operator> (const ROI &roi) const
 Check if this ROI contains more hint points than the given ROI. More...
 
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. More...
 
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. More...
 
ROIoperator= (const ROI &roi)
 Assign the given ROI data to this ROI. More...
 
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. More...
 
unsigned char * get_roi_buffer_start (unsigned char *buffer) const
 Get ROI buffer start. More...
 

Static Public Member Functions

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

Public Attributes

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

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

◆ ROI() [1/4]

firevision::ROI::ROI ( )

Constructor.

Definition at line 51 of file roi.cpp.

◆ ROI() [2/4]

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.

◆ ROI() [3/4]

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.

◆ ROI() [4/4]

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

◆ contains()

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().

◆ extend()

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 403 of file roi.cpp.

◆ full_image()

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 597 of file roi.cpp.

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

◆ get_height()

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

Get height of ROI.

Returns
height

Definition at line 177 of file roi.cpp.

◆ get_hint()

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.

◆ get_image_height()

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.

◆ get_image_width()

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.

◆ get_line_step()

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

Get linestep.

Returns
line step
See also
setLineStep()

Definition at line 244 of file roi.cpp.

◆ get_num_hint_points()

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 580 of file roi.cpp.

◆ get_pixel_step()

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.

◆ get_roi_buffer_start()

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 556 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().

◆ get_width()

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

Get width of ROI.

Returns
width

Definition at line 157 of file roi.cpp.

◆ grow()

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

Grow this ROI by a given margin.

Parameters
marginmargin to grow by

Definition at line 419 of file roi.cpp.

◆ intersect()

ROI firevision::ROI::intersect ( ROI const &  roi) const

Intersect this ROI with another.

Parameters
roiThe other roi
Returns
A new ROI that covers the intersection of this and the other ROI. If there's no intersection, width = height = 0.

Definition at line 323 of file roi.cpp.

References height, start, width, fawkes::upoint_t::x, and fawkes::upoint_t::y.

◆ neighbours() [1/2]

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 363 of file roi.cpp.

Referenced by neighbours().

◆ neighbours() [2/2]

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 380 of file roi.cpp.

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

◆ operator!=()

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 521 of file roi.cpp.

References num_hint_points.

◆ operator+=()

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 455 of file roi.cpp.

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

◆ operator<()

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 474 of file roi.cpp.

References color, and num_hint_points.

◆ operator=()

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 532 of file roi.cpp.

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

◆ operator==()

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 498 of file roi.cpp.

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

◆ operator>()

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 485 of file roi.cpp.

References color, and num_hint_points.

◆ set_height()

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().

◆ set_hint()

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

Set hint.

Parameters
hintnew hint
See also
getHint()

Definition at line 290 of file roi.cpp.

◆ set_image_height()

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.

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

◆ set_image_width()

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().

◆ set_line_step()

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.

◆ set_pixel_step()

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().

◆ set_start() [1/2]

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

Set upper left corner of ROI.

Parameters
ppoint

Definition at line 124 of file roi.cpp.

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

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

◆ set_start() [2/2]

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.

◆ set_width()

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

◆ color

◆ height

unsigned int firevision::ROI::height

ROI height.

Definition at line 123 of file roi.h.

Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMax::apply(), firevision::FilterInvert::apply(), firevision::FilterMin::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterRectify::apply(), firevision::FilterMedian::apply(), firevision::FilterOr::apply(), firevision::FilterHipass::apply(), firevision::FilterGauss::apply(), firevision::FilterSegment::apply(), firevision::FilterSharpen::apply(), firevision::FilterHSearch::apply(), firevision::FilterSobel::apply(), firevision::FilterHVSearch::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::FilterColorThreshold::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(), intersect(), neighbours(), operator+=(), firevision::ScanlineLineGrid::operator->(), operator=(), operator==(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::ScanlineLineGrid::set_roi(), firevision::SquareShrinker::shrink(), firevision::Shrinker::shrink(), firevision::BorderShrinker::shrink(), firevision::Filter::shrink_region(), and firevision::FilterROIDraw::~FilterROIDraw().

◆ hint

unsigned int firevision::ROI::hint

◆ image_height

◆ image_width

◆ line_step

unsigned int firevision::ROI::line_step

◆ num_hint_points

unsigned int firevision::ROI::num_hint_points

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

Definition at line 139 of file roi.h.

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

◆ pixel_step

◆ start

fawkes::upoint_t firevision::ROI::start

ROI start.

Definition at line 119 of file roi.h.

Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMax::apply(), firevision::FilterInvert::apply(), firevision::FilterMin::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterRectify::apply(), firevision::FilterMedian::apply(), firevision::FilterOr::apply(), firevision::FilterHipass::apply(), firevision::FilterGauss::apply(), firevision::FilterSegment::apply(), firevision::FilterSharpen::apply(), firevision::FilterSobel::apply(), firevision::FilterHSearch::apply(), firevision::FilterHVSearch::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::FilterColorThreshold::apply(), firevision::TriclopsStereoProcessor::calculate_disparity(), firevision::GradientClassifier::classify(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), intersect(), neighbours(), operator+=(), firevision::ScanlineGrid::operator->(), firevision::ScanlineLineGrid::operator->(), operator=(), operator==(), firevision::ScanlineGrid::reset(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::ScanlineLineGrid::set_roi(), firevision::SquareShrinker::shrink(), firevision::BorderShrinker::shrink(), firevision::Filter::shrink_region(), and firevision::FilterROIDraw::~FilterROIDraw().

◆ width

unsigned int firevision::ROI::width

ROI width.

Definition at line 121 of file roi.h.

Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMax::apply(), firevision::FilterInvert::apply(), firevision::FilterMin::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterRectify::apply(), firevision::FilterMedian::apply(), firevision::FilterOr::apply(), firevision::FilterHipass::apply(), firevision::FilterGauss::apply(), firevision::FilterSegment::apply(), firevision::FilterSharpen::apply(), firevision::FilterHSearch::apply(), firevision::FilterSobel::apply(), firevision::FilterHVSearch::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::FilterColorThreshold::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(), intersect(), neighbours(), operator+=(), firevision::ScanlineLineGrid::operator->(), operator=(), operator==(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::ScanlineLineGrid::set_roi(), firevision::SquareShrinker::shrink(), firevision::Shrinker::shrink(), firevision::BorderShrinker::shrink(), firevision::Filter::shrink_region(), and firevision::FilterROIDraw::~FilterROIDraw().


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