[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| FindBoundingRectangle Class Reference Functors To Inspect Images |

Calculate the bounding rectangle of an ROI in an image. More...

`#include <vigra/inspectimage.hxx>`

List of all members.

## Public Types
typedef Diff2D | argument_type
typedef Rect2D | result_type
typedef Diff2D | value_type
## Public Member Functions
| FindBoundingRectangle ()
void | operator() (argument_type const &coord)
void | operator() (FindBoundingRectangle const &otherRegion)
result_type | operator() () const
void | reset ()
Size2D | size () const
## Public Attributes
Point2D | lowerRight
Point2D | upperLeft
bool | valid

## Detailed Description

Calculate the bounding rectangle of an ROI in an image.

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:

`FunctorTraits::isUnaryAnalyser` and `FunctorTraits::isInitializer` are true (`VigraTrueType`)

Usage:

#include <vigra/inspectimage.hxx>
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 the pixel's
        // coordinates. The image 'mask' determines the ROI.
        vigra::inspectImageIf(srcIterRange(Diff2D(0,0), (Diff2D)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

the functor's argument type

typedef Rect2D result_type

the functors result type

typedef Diff2D value_type

Deprecated:
  use argument_type

## Constructor & Destructor Documentation

FindBoundingRectangle | ( |  | ) |

init rectangle to invalid values

## Member Function Documentation

void reset | ( |  | ) |

(re-)init functor to find other bounds

void operator() | ( | argument_type const & | coord | ) |

update rectangle by including the coordinate coord

void operator() | ( | FindBoundingRectangle const & | otherRegion | ) |

update rectangle by merging it with another rectangle

Size2D size | ( |  | ) | const

Get size of current rectangle.

result_type operator() | ( |  | ) | const

Get current rectangle. `result_type::first` is the upper left corner of the rectangle, `result_type::second` the lower right.

## Member Data Documentation

Point2D upperLeft

Upper left of the region as seen so far

Point2D lowerRight

Lower right of the region as seen so far

bool valid

are the functors contents valid ?

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

- vigra/inspectimage.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.9.0 (Tue Nov 6 2012)