Fawkes API
Fawkes Development Version
|
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... | |
ROI & | operator+= (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... | |
ROI & | operator= (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 ROI * | full_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... | |
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.
firevision::ROI::ROI | ( | const ROI & | roi | ) |
Copy constructor.
roi | reference 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.
roi | pointer 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 | ||
) |
bool firevision::ROI::contains | ( | unsigned int | x, |
unsigned int | y | ||
) |
Check if this ROI contains the given coordinates.
x | x coordinate in image |
y | y coordinate in image |
Definition at line 302 of file roi.cpp.
Referenced by firevision::FieldDrawer::draw_field().
void firevision::ROI::extend | ( | unsigned int | x, |
unsigned int | y | ||
) |
|
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.
width | image width |
height | image height |
Definition at line 597 of file roi.cpp.
Referenced by firevision::MirrorCalibTool::abort().
unsigned int firevision::ROI::get_height | ( | ) | const |
unsigned int firevision::ROI::get_hint | ( | ) | const |
unsigned int firevision::ROI::get_image_height | ( | ) | const |
unsigned int firevision::ROI::get_image_width | ( | ) | const |
unsigned int firevision::ROI::get_line_step | ( | ) | const |
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.
unsigned int firevision::ROI::get_pixel_step | ( | ) | const |
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.
buffer | buffer |
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().
unsigned int firevision::ROI::get_width | ( | ) | const |
void firevision::ROI::grow | ( | unsigned int | margin | ) |
Intersect this ROI with another.
roi | The other roi |
Definition at line 323 of file roi.cpp.
References height, start, width, fawkes::upoint_t::x, and fawkes::upoint_t::y.
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.
x | x coordinate in image |
y | y coordinate in image |
margin | margin |
Definition at line 363 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.
roi | ROI |
margin | margin |
Definition at line 380 of file roi.cpp.
References height, neighbours(), start, width, fawkes::upoint_t::x, and fawkes::upoint_t::y.
bool firevision::ROI::operator!= | ( | const ROI & | roi | ) | const |
Merge two ROIs.
This ROI will be extended in any direction necessary to fully include the given ROI.
roi | ROI to include |
Definition at line 455 of file roi.cpp.
References height, num_hint_points, start, width, fawkes::upoint_t::x, and fawkes::upoint_t::y.
bool firevision::ROI::operator< | ( | const ROI & | roi | ) | const |
Assign the given ROI data to this ROI.
roi | ROI to copy |
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.
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.
roi | ROI to compare to |
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.
bool firevision::ROI::operator> | ( | const ROI & | roi | ) | const |
void firevision::ROI::set_height | ( | unsigned int | height | ) |
Set height of ROI.
height | new height |
Definition at line 167 of file roi.cpp.
Referenced by firevision::GradientClassifier::classify().
void firevision::ROI::set_hint | ( | unsigned int | hint | ) |
void firevision::ROI::set_image_height | ( | unsigned int | image_height | ) |
Set full image height Set the height of the image that contains this ROI.
image_height | full height of image. |
Definition at line 210 of file roi.cpp.
Referenced by firevision::ScanlineLineGrid::set_roi().
void firevision::ROI::set_image_width | ( | unsigned int | image_width | ) |
Set full image width.
Set the width of the image that contains this ROI.
image_width | full 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 | ) |
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.
step | new pixel step. |
Definition at line 256 of file roi.cpp.
Referenced by firevision::GradientClassifier::classify().
void firevision::ROI::set_start | ( | fawkes::upoint_t | p | ) |
Set upper left corner of ROI.
p | point |
Definition at line 124 of file roi.cpp.
References fawkes::upoint_t::x, and fawkes::upoint_t::y.
Referenced by firevision::GradientClassifier::classify().
void firevision::ROI::set_start | ( | unsigned int | x, |
unsigned int | y | ||
) |
void firevision::ROI::set_width | ( | unsigned int | width | ) |
Set width of ROI.
width | new width |
Definition at line 147 of file roi.cpp.
Referenced by firevision::GradientClassifier::classify().
color_t firevision::ROI::color |
ROI primary color.
Definition at line 136 of file roi.h.
Referenced by firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), operator<(), operator=(), operator==(), operator>(), ROI(), and firevision::FilterROIDraw::~FilterROIDraw().
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().
unsigned int firevision::ROI::hint |
ROI hint.
Definition at line 133 of file roi.h.
Referenced by firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), operator=(), operator==(), and ROI().
unsigned int firevision::ROI::image_height |
height of image that contains this ROI
Definition at line 127 of file roi.h.
Referenced by firevision::FilterDifference::apply(), firevision::FilterInvert::apply(), firevision::FilterSum::apply(), firevision::FilterMax::apply(), firevision::FilterMin::apply(), firevision::FilterCompare::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterRectify::apply(), firevision::FilterScanlineSegmentation::apply(), firevision::FilterGeodesicDilation::apply(), firevision::FilterGeodesicErosion::apply(), firevision::FilterColorThreshold::apply(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), firevision::ScanlineGrid::operator->(), firevision::ScanlineLineGrid::operator->(), operator=(), operator==(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::ScanlineLineGrid::set_roi(), firevision::BorderShrinker::shrink(), firevision::Filter::shrink_region(), and firevision::FilterROIDraw::~FilterROIDraw().
unsigned int firevision::ROI::image_width |
width of image that contains this ROI
Definition at line 125 of file roi.h.
Referenced by firevision::FilterDifference::apply(), firevision::FilterInvert::apply(), firevision::FilterSum::apply(), firevision::FilterMax::apply(), firevision::FilterMin::apply(), firevision::FilterCompare::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterRectify::apply(), firevision::FilterScanlineSegmentation::apply(), firevision::FilterGeodesicDilation::apply(), firevision::FilterGeodesicErosion::apply(), firevision::FilterColorThreshold::apply(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), firevision::ScanlineGrid::operator->(), firevision::ScanlineLineGrid::operator->(), operator=(), operator==(), ROI(), firevision::ScanlineGrid::set_roi(), firevision::ScanlineLineGrid::set_roi(), firevision::BorderShrinker::shrink(), firevision::Filter::shrink_region(), and firevision::FilterROIDraw::~FilterROIDraw().
unsigned int firevision::ROI::line_step |
line step
Definition at line 129 of file roi.h.
Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMin::apply(), firevision::FilterInvert::apply(), firevision::FilterMax::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterRectify::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterGauss::apply(), firevision::FilterMedian::apply(), firevision::FilterHipass::apply(), firevision::FilterOr::apply(), firevision::FilterHSearch::apply(), firevision::FilterSegment::apply(), firevision::FilterScanlineSegmentation::apply(), firevision::FilterSharpen::apply(), firevision::FilterSobel::apply(), firevision::FilterHVSearch::apply(), firevision::FilterShapeRemover::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::FilterColorThreshold::apply(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), operator=(), operator==(), firevision::RhtCircleModel::parseImage(), firevision::RcdCircleModel::parseImage(), firevision::HtLinesModel::parseImage(), firevision::RhtLinesModel::parseImage(), ROI(), firevision::Shrinker::shrink(), and firevision::FilterROIDraw::~FilterROIDraw().
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().
unsigned int firevision::ROI::pixel_step |
pixel step
Definition at line 131 of file roi.h.
Referenced by firevision::FilterErosion::apply(), firevision::FilterDifference::apply(), firevision::FilterMin::apply(), firevision::FilterInvert::apply(), firevision::FilterMax::apply(), firevision::FilterSum::apply(), firevision::FilterCompare::apply(), firevision::FilterDilation::apply(), firevision::FilterRectify::apply(), firevision::FilterColorSegmentation::apply(), firevision::FilterUnwarp::apply(), firevision::FilterSegment::apply(), firevision::FilterGauss::apply(), firevision::FilterOr::apply(), firevision::FilterMedian::apply(), firevision::FilterSobel::apply(), firevision::FilterHipass::apply(), firevision::FilterHSearch::apply(), firevision::FilterScanlineSegmentation::apply(), firevision::FilterSharpen::apply(), firevision::FilterHVSearch::apply(), firevision::FilterLaplace::apply(), firevision::FilterThreshold::apply(), firevision::FilterColorThreshold::apply(), firevision::GradientClassifier::classify(), firevision::MultiColorClassifier::classify(), firevision::SimpleColorClassifier::classify(), firevision::MultiColorClassifier::get_mass_point_of_color(), firevision::SimpleColorClassifier::get_mass_point_of_color(), operator=(), operator==(), ROI(), and firevision::FilterROIDraw::~FilterROIDraw().
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().
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().