[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
FindBoundingRectangle Class Reference | ![]() |
---|
Calculate the bounding rectangle of an ROI in an image. More...
#include "vigra/inspectimage.hxx"
Public Types | |
typedef Diff2D | argument_type |
typedef Rect2D | result_type |
typedef Diff2D | value_type |
Public Methods | |
FindBoundingRectangle () | |
void | reset () |
void | operator() (argument_type const &coord) |
void | operator() (FindBoundingRectangle const &otherRegion) |
Size2D | size () const |
result_type | operator() () const |
Public Attributes | |
Point2D | upperLeft |
Point2D | lowerRight |
bool | valid |
Detailed Description |
As always in VIGRA, roiRect.lowerRight
is just outside the rectangle. That is, the last pixel actually in the rectangle is roiRect.lowerRight - Diff2D(1,1)
. This Functor is often used in conjunction with ArrayOfRegionStatistics to find the bounding rectangles of all regions in a labeled image.
Traits defined:
Usage:
#include "vigra/inspectimage.hxx"
the functor's argument type
the functors result type
init rectangle to invalid values
Get current rectangle.
update rectangle by merging it with another rectangle
update rectangle by including the coordinate coord
(re-)init functor to find other bounds
Get size of current rectangle.
Lower right of the region as seen so far
Upper left of the region as seen so far
are the functors contents valid ?
© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
html generated using doxygen and Python
FunctorTraits::isUnaryAnalyser
and FunctorTraits::isInitializer
are true (VigraTrueType
)
Namespace: vigra
vigra::BImage img, mask;
...
vigra::FindBoundingRectangle roiRect; // init functor
// Diff2D is used as the iterator for the source image. This
// simulates an image where each pixel value equals that pixel's
// coordinates. Tha image 'mask' determines the ROI.
vigra::inspectImageIf(srcIterRange(Diff2D(0,0), img.size()),
srcImage(mask), roiRect);
cout << "Upper left of ROI: " <<
roiRect.upperLeft.x << ", " << roiRect.upperLeft.y << endl;
cout << "Lower right of ROI: " <<
roiRect.lowerRight.x << ", " << roiRect.lowerRight.y << endl;
Member Typedef Documentation
typedef Diff2D argument_type
typedef Rect2D result_type
typedef Diff2D value_type
Constructor & Destructor Documentation
FindBoundingRectangle
(
)
[inline]
Member Function Documentation
result_type operator()
(
)
const
[inline]
result_type::first
is the upper left corner of the rectangle, result_type::second
the lower right.
void operator()
(
FindBoundingRectangle const &
otherRegion
)
[inline]
void operator()
(
argument_type const &
coord
)
[inline]
void reset
(
)
[inline]
Size2D size
(
)
const
[inline]
Member Data Documentation
Point2D lowerRight
Point2D upperLeft
bool valid
The documentation for this class was generated from the following file:
Cognitive Systems Group,
University of Hamburg, Germany
VIGRA 1.3.3 (18 Aug 2005)