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 54 of file roi.h.

Constructor & Destructor Documentation

◆ ROI() [1/4]

firevision::ROI::ROI ( )

Constructor.

Definition at line 47 of file roi.cpp.

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

Referenced by full_image(), and intersect().

◆ ROI() [2/4]

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

Copy constructor.

Parameters
roireference to ROI to copy

Definition at line 84 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 101 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 62 of file roi.cpp.

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

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

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

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

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

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

References height, image_height, image_width, line_step, pixel_step, ROI(), start, width, fawkes::upoint_t::x, and fawkes::upoint_t::y.

◆ get_height()

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

Get height of ROI.

Returns
height

Definition at line 167 of file roi.cpp.

References height.

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

References hint.

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

References image_height.

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

References image_width.

◆ get_line_step()

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

Get linestep.

Returns
line step
See also
setLineStep()

Definition at line 228 of file roi.cpp.

References line_step.

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

References num_hint_points.

◆ get_pixel_step()

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

Get pixel step.

Returns
pixel step.
See also
setPixelStep()

Definition at line 249 of file roi.cpp.

References pixel_step.

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

References line_step, pixel_step, start, fawkes::upoint_t::x, and fawkes::upoint_t::y.

Referenced by firevision::FilterShapeRemover::apply(), firevision::HtLinesModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::RhtCircleModel::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 149 of file roi.cpp.

References width.

◆ grow()

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

Grow this ROI by a given margin.

Parameters
marginmargin to grow by

Definition at line 393 of file roi.cpp.

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

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

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

◆ neighbours() [1/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 347 of file roi.cpp.

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

◆ neighbours() [2/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 331 of file roi.cpp.

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

Referenced by neighbours().

◆ 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 492 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 427 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 453 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 502 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 476 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 464 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 158 of file roi.cpp.

References height.

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

References hint.

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

References image_height.

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

References image_width.

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

References line_step.

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

References pixel_step.

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

References start, 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 130 of file roi.cpp.

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

◆ set_width()

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

Set width of ROI.

Parameters
widthnew width

Definition at line 140 of file roi.cpp.

References width.

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

Member Data Documentation

◆ color

◆ height

unsigned int firevision::ROI::height

ROI height.

Definition at line 119 of file roi.h.

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

◆ hint

unsigned int firevision::ROI::hint

◆ image_height

◆ image_width

◆ line_step

unsigned int firevision::ROI::line_step

line step

Definition at line 125 of file roi.h.

Referenced by firevision::FilterColorThreshold::apply(), firevision::FilterCompare::apply(), firevision::FilterDifference::apply(), firevision::FilterGauss::apply(), firevision::FilterHipass::apply(), firevision::FilterHSearch::apply(), firevision::FilterHVSearch::apply(), firevision::FilterInvert::apply(), firevision::FilterLaplace::apply(), firevision::FilterMax::apply(), firevision::FilterMedian::apply(), firevision::FilterMin::apply(), firevision::FilterDilation::apply(), firevision::FilterErosion::apply(), firevision::FilterOr::apply(), firevision::FilterRectify::apply(), firevision::FilterSegment::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterScanlineSegmentation::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterSharpen::apply(), firevision::FilterSobel::apply(), firevision::FilterSum::apply(), firevision::FilterThreshold::apply(), firevision::FilterUnwarp::apply(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), full_image(), get_line_step(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), get_roi_buffer_start(), operator=(), operator==(), firevision::HtLinesModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::RhtCircleModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), set_line_step(), and firevision::Shrinker::shrink().

◆ 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 135 of file roi.h.

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

◆ pixel_step

◆ start

fawkes::upoint_t firevision::ROI::start

ROI start.

Definition at line 115 of file roi.h.

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

◆ width

unsigned int firevision::ROI::width

ROI width.

Definition at line 117 of file roi.h.

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


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