ROI Class Reference

Region of interest. More...

#include <fvutils/base/roi.h>

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.
hint_t get_hint () const
 Get hint.
void set_hint (hint_t hint)
 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
hint_t hint
 ROI hint.
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 53 of file roi.h.


Constructor & Destructor Documentation

ROI::ROI (  ) 

Constructor.

Definition at line 46 of file roi.cpp.

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

Referenced by full_image().

ROI::ROI ( const ROI roi  ) 

Copy constructor.

Parameters:
roi reference to ROI to copy

Definition at line 80 of file roi.cpp.

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

ROI::ROI ( const ROI roi  ) 

Copy constructor.

Parameters:
roi pointer to ROI to copy

Definition at line 97 of file roi.cpp.

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

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_x Upper left corner of ROI X coordinate
start_y Upper left corner of ROI y coordinate
width Width of extent of ROI
height height of extent of ROI
image_width width of full image this ROI belongs to
image_height height of full image this ROI belongs to

Definition at line 61 of file roi.cpp.

References line_step, num_hint_points, pixel_step, start, fawkes::point_t::x, and fawkes::point_t::y.


Member Function Documentation

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

Check if this ROI contains the given coordinates.

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

Definition at line 293 of file roi.cpp.

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

Referenced by FieldDrawer::draw_field().

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

Extend ROI to include given pixel.

Parameters:
x x coordinate of pixel to include
y y coordinate of pixel to include

Definition at line 357 of file roi.cpp.

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

ROI * 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:
width image width
height image height
Returns:
full image ROI

Definition at line 549 of file roi.cpp.

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

unsigned int ROI::get_height (  )  const

Get height of ROI.

Returns:
height

Definition at line 168 of file roi.cpp.

References height.

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

References hint.

unsigned int 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 212 of file roi.cpp.

References image_height.

unsigned int 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 190 of file roi.cpp.

References image_width.

unsigned int ROI::get_line_step (  )  const

Get linestep.

Returns:
line step
See also:
setLineStep()

Definition at line 235 of file roi.cpp.

References line_step.

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

References num_hint_points.

unsigned int ROI::get_pixel_step (  )  const

Get pixel step.

Returns:
pixel step.
See also:
setPixelStep()

Definition at line 258 of file roi.cpp.

References pixel_step.

unsigned char * 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:
buffer buffer
Returns:
pointer into buffer where the ROI starts

Definition at line 508 of file roi.cpp.

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

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

unsigned int ROI::get_width (  )  const

Get width of ROI.

Returns:
width

Definition at line 148 of file roi.cpp.

References width.

void ROI::grow ( unsigned int  margin  ) 

Grow this ROI by a given margin.

Parameters:
margin margin to grow by

Definition at line 373 of file roi.cpp.

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

bool 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:
roi ROI
margin margin
Returns:
true if this ROI is a neigbour of the given ROI, false otherwise

Definition at line 334 of file roi.cpp.

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

bool 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:
x x coordinate in image
y y coordinate in image
margin margin
Returns:
true if this ROI is a neigbour of the given pixel, false otherwise

Definition at line 317 of file roi.cpp.

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

Referenced by neighbours().

bool 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:
roi ROI to compare to
Returns:
true, if ROIs are not similar, false otherwise

Definition at line 474 of file roi.cpp.

References num_hint_points.

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

Merge two ROIs.

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

Parameters:
roi ROI to include
Returns:
this instance

Definition at line 409 of file roi.cpp.

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

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

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

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

Definition at line 428 of file roi.cpp.

References num_hint_points.

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

Assign the given ROI data to this ROI.

Parameters:
roi ROI to copy
Returns:
this instance

Definition at line 485 of file roi.cpp.

References 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 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:
roi ROI to compare to
Returns:
true, if ROIs are similar, false otherwise

Definition at line 452 of file roi.cpp.

References 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 ROI::operator> ( const ROI roi  )  const

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

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

Definition at line 439 of file roi.cpp.

References num_hint_points.

void ROI::set_height ( unsigned int  height  ) 

Set height of ROI.

Parameters:
height new height

Definition at line 158 of file roi.cpp.

Referenced by GradientClassifier::classify().

void ROI::set_hint ( hint_t  hint  ) 

Set hint.

Parameters:
hint new hint
See also:
getHint()

Definition at line 281 of file roi.cpp.

void ROI::set_image_height ( unsigned int  image_height  ) 

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

Parameters:
image_height full height of image.

Definition at line 201 of file roi.cpp.

Referenced by ScanlineLineGrid::set_roi().

void ROI::set_image_width ( unsigned int  image_width  ) 

Set full image width.

Set the width of the image that contains this ROI.

Parameters:
image_width full width of image.

Definition at line 179 of file roi.cpp.

Referenced by ScanlineLineGrid::set_roi().

void 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:
step new line step

Definition at line 224 of file roi.cpp.

References line_step.

void 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:
step new pixel step.

Definition at line 247 of file roi.cpp.

References pixel_step.

Referenced by GradientClassifier::classify().

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

Set upper left corner.

Parameters:
x x coordinate in image
y y coordinate in image

Definition at line 127 of file roi.cpp.

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

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

Set upper left corner of ROI.

Parameters:
p point

Definition at line 115 of file roi.cpp.

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

Referenced by GradientClassifier::classify().

void ROI::set_width ( unsigned int  width  ) 

Set width of ROI.

Parameters:
width new width

Definition at line 138 of file roi.cpp.

Referenced by GradientClassifier::classify().


Member Data Documentation

unsigned int ROI::num_hint_points

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

Definition at line 130 of file roi.h.

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


The documentation for this class was generated from the following files:
  • src/firevision/fvutils/base/roi.h
  • src/firevision/fvutils/base/roi.cpp