Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
icl::cv::FloodFiller Class Reference

Utility class for image flood filling. More...

#include <FloodFiller.h>

List of all members.

Classes

struct  DefaultCriterion
 predefined criterion for simple reference-value based filling for 1-channel images More...
struct  ReferenceColorCriterion
 predefined criterion for simple reference-value based filling for 3-channel images More...
struct  Result
 result structure, returned by the 'apply' methods More...

Public Member Functions

const Resultapply (const core::ImgBase *image, const utils::Point &seed, double referenceValue, double threshold)
 flood-fills the given grayscale image starting from given seed point.
const ResultapplyColor (const core::ImgBase *image, const utils::Point &seed, double refR, double refG, double refB, double threshold)
 flood-fills the given 3-channel image starting from the given seed point
template<class T , class Criterion >
const ResultapplyGeneric (const core::Img< T > &image, const utils::Point &seed, Criterion crit)
 generic grayscale image floodfilling using an arbitrary filling criterion
template<class T , class Criterion3Channels >
const ResultapplyColorGeneric (const core::Img< T > &image, const utils::Point &seed, Criterion3Channels crit)
 generic floodfilling algorithm for 3-channel color images

Public Attributes

struct icl::cv::FloodFiller::Result result

Private Member Functions

utils::Rect prepare (const utils::Size &imageSize, const utils::Point &seed)
 internal utility method

Private Attributes

std::vector< utils::PointfuturePoints
 internal list of to-be-processed points

Detailed Description

Utility class for image flood filling.

The flood filler implements a generic flood filling algorithm. Starting with a seed region that contains just a single point, the flood filler will collect all adjacent pixels of this region recursively that meet a certain criterion. The criterion is the template parameter of the FloodFiller's icl::FloodFiller::applyGeneric template method. For convenience, the most common criterions are pre-coded and directly usable by calling the non-template methods icl::FloodFiller::apply and icl::FloodFiller::applyColor.

Color and GrayScale images

The flood filler provides separate implementations for 1- and 3-channel images. The 3-channel image methods have the *Color-ending: icl::FloodFiller::applyColor and icl::FloodFiller::applyColorGeneric

Neighbourhood

The floodfilling algorithm uses the 8-Pixel neighbourhood of each pixel.

Algorithm

The floodfilling algorithm is implemented in an iterative manner. It uses a mask, which is initialized with zero and set to 1 for already processed pixels. In addition, a to-be-processed-pixels queue is used. In order to speed up the queue implementation, a static and large enough array two pointers n (next to-be-processed point) and e (end of to-be-processed-points) are used. At start, only the seed point is put into the queue. Now while there are pixels in the queue, each of the 8 neighbours, that have not been processed earlier and that match the filling criterion are filled and put into the queue.


Member Function Documentation

const Result& icl::cv::FloodFiller::apply ( const core::ImgBase image,
const utils::Point seed,
double  referenceValue,
double  threshold 
)

flood-fills the given grayscale image starting from given seed point.

Image pixels are filled if their pixel value difference to the given referenceValue is less then the given threshold

const Result& icl::cv::FloodFiller::applyColor ( const core::ImgBase image,
const utils::Point seed,
double  refR,
double  refG,
double  refB,
double  threshold 
)

flood-fills the given 3-channel image starting from the given seed point

Here, the fill-criterion is the euclidian distance to the given (refR,refG,regB) reference color, which must be less than the given threshold

template<class T , class Criterion3Channels >
const Result& icl::cv::FloodFiller::applyColorGeneric ( const core::Img< T > &  image,
const utils::Point seed,
Criterion3Channels  crit 
) [inline]

generic floodfilling algorithm for 3-channel color images

the criterion function or functor gets all 3-channel pixel values as arguments. Take a look at the icl::Floodfiller::ReferenceColorCriterion class template for more details.

template<class T , class Criterion >
const Result& icl::cv::FloodFiller::applyGeneric ( const core::Img< T > &  image,
const utils::Point seed,
Criterion  crit 
) [inline]

generic grayscale image floodfilling using an arbitrary filling criterion

The criterion-function or functor is evaluated by giving it pixel values Take a look at the icl::FloodFiller::DefaultCriterion class for more details.

utils::Rect icl::cv::FloodFiller::prepare ( const utils::Size imageSize,
const utils::Point seed 
) [private]

internal utility method


Member Data Documentation

internal list of to-be-processed points


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines