[ VIGRA Homepage |
Class Index |
Function Index |
File Index |
Main Page ]
|
CrackContourCirculator Class Template Reference
|
 |
Circulator that walks around a given region.
More...
#include "vigra/contourcirculator.hxx"
template<class IMAGEITERATOR>
class vigra::CrackContourCirculator< IMAGEITERATOR >
Circulator that walks around a given region.
The circulator follows the crack contour of a given region. Here, a region is an 8-connected component of pixels with the same value, such as the regions in a label image. The crack contour is located between the inside and outside pixels, that is "on the crack" between the region and the background. Thus, the circulator moves from pixel corner to pixel corner. By definition, the first corner (where the circulator was initialized) gets the coordinate (0,0), and calls to *circulator
return the distance of the current corner to the initial one.
The circulator can be used to calculate the area of a region (in pixels):
ImageIterator region_anchor = ...;
int area = 0;
CrackContourCirculator<ImageIterator> crack(region_anchor);
CrackContourCirculator<ImageIterator> crackend(crack);
do
{
area += crack.diff().x * crack.pos().y -
crack.diff().y * crack.pos().x;
}
while(++crack != crackend);
area /= 2;
std::cout << "Area of region " << *region_anchor << ": " << area << std::endl;
#include "vigra/contourcirculator.hxx"
Namespace: vigra
Member Typedef Documentation
typedef forward_circulator_tag iterator_category
|
|
|
the circulator's pointer type (return type of operator-> ) |
|
the circulator's reference type (return type of *circ ) |
|
the circulator's value type |
Constructor & Destructor Documentation
|
Initialize the circulator for a given region.
The image iterator in_the_region must refer to a boundary pixel of the region to be analysed. The direction code dir must point to a pixel outside the region (the default assumes that the pixel left of the given region pixel belongs to the background). The first corner of the crack contour is the corner to the right of this direction (i.e. the north west corner of the region pixel, if the direction was West). |
Member Function Documentation
Diff2D const& diff |
( |
|
) |
const [inline] |
|
|
Get the offset from the current corner of the contour to the next one. |
bool operator!= |
( |
CrackContourCirculator< IMAGEITERATOR > const & |
o |
) |
const [inline] |
|
CrackContourCirculator operator++ |
( |
int |
|
) |
[inline] |
|
|
Move to the next crack corner of the contour (post-increment). |
CrackContourCirculator& operator++ |
( |
|
) |
[inline] |
|
|
Move to the next crack corner of the contour (pre-increment). |
pointer operator-> |
( |
|
) |
const [inline] |
|
|
Access member of the current coordinate. |
bool operator== |
( |
CrackContourCirculator< IMAGEITERATOR > const & |
o |
) |
const [inline] |
|
IMAGEITERATOR outerPixel |
( |
|
) |
const [inline] |
|
|
Access pixel to the right of the crack edge (outside of the region bounded by the crack contour we walk on). Note that after operator++, the iterator can still point to the same pixel (looking from another direction now). |
|
Get the coordinate of the current corner (relative to the first corner). |
The documentation for this class was generated from the following file: