LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::regionGrowing Class Reference
[Segmentation Algorithms and related tools]

This class is used to segmentate an image with a regular background. More...

#include <ltiRegionGrowing.h>

Inheritance diagram for lti::regionGrowing:
Inheritance graph
[legend]
Collaboration diagram for lti::regionGrowing:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class regionGrowing. More...

Public Member Functions

 regionGrowing ()
 regionGrowing (const parameters &par)
 regionGrowing (const regionGrowing &other)
virtual ~regionGrowing ()
virtual const char * getTypeName () const
channel8apply (channel8 &srcdest) const
channelapply (channel &srcdest) const
imageapply (image &srcdest) const
channel8apply (const channel8 &src, channel8 &dest) const
channel8apply (const channel &src, channel8 &dest) const
channel8apply (const image &src, channel8 &dest) const
regionGrowingcopy (const regionGrowing &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

bool similar (const ubyte &neighbour, const ubyte &avrgAtSeed, const int &avrgThreshold) const
bool similar (const float &neighbour, const float &avrgAtSeed, const float &avrgThreshold) const
template<class T >
void mask (matrix< T > &img, const channel8 &msk, const T &background) const
channel8segmentate (const image &src, channel8 &dest) const
channel8segmentate (const channel &src, channel8 &dest) const

Detailed Description

This class is used to segmentate an image with a regular background.

It uses a set of seed pixels (given in the parameters) to start the region growing. To check the similarity, a comparition is done between the pixel value at the candidate position and the average value at the seed position. If the difference of these values is lower than a given threshold, the pixel will be considered as part of the growing region. It is possible to get automatically values for these thresholds if a known background region is given in the parameters.

Example:

 lti::loadBMP loader;

 lti::image img;     // the color image to be segmented
 lti::channel8 chnl; // the segmentation mask will be left here

 loader.load("img/leo040801_00_019.bmp",img); // read an image

 lti::regionGrowing segmenter;         // segmentation functor and
 lti::regionGrowing::parameters param; // its parameters

 param.useGaussKernel = true;            // use a gaussian kernel 5x5
 param.localStatisticsKernelSize = 5;
 param.localStatisticsKernelVariance = -1;

 param.mode = lti::regionGrowing::parameters::UseGivenThresholds;
 param.averageThresholds = trgbPixel<float>(0.05,0.05,0.05);
 param.edgesThreshold = 0.04;

 // do not use all corners as seed-points, just the three following...
 param.seedPoints.resize(3,tpoint<float>(0,0));
 param.seedPoints.at(1).y = 1.0f;
 param.seedPoints.at(2).x = 1.0f;
 param.seedPoints.at(2).y = 1.0f;

 // indicate the segmentation functor the user-parameters
 segmenter.setParameters(param);

 // segmentate the image and leave the segmentation in the channel
 segmenter.apply(img,chnl);

 view1.show(img);  // show original image
 view2.show(chnl); // show the segmentation mask

Constructor & Destructor Documentation

lti::regionGrowing::regionGrowing (  ) 

Default constructor.

lti::regionGrowing::regionGrowing ( const parameters par  ) 

Default constructor with parameters.

lti::regionGrowing::regionGrowing ( const regionGrowing other  ) 

Copy constructor.

Parameters:
other the object to be copied
virtual lti::regionGrowing::~regionGrowing (  )  [virtual]

Destructor.


Member Function Documentation

channel8& lti::regionGrowing::apply ( const image src,
channel8 dest 
) const

Operates on a copy of the given parameters.

Parameters:
src image with the source data.
dest channel8 where the segmentation mask will be left. This mask contains 0 for a background point and (usually) 255 for an object point.
Returns:
a reference to the dest.
channel8& lti::regionGrowing::apply ( const channel src,
channel8 dest 
) const

Operates on a copy of the given parameters.

Parameters:
src channel with the source data.
dest channel8 where the segmentation mask will be left. This mask contains 0 for a background point and (usually) 255 for an object point.
Returns:
a reference to the dest.
channel8& lti::regionGrowing::apply ( const channel8 src,
channel8 dest 
) const

Operates on a copy of the given parameters.

Parameters:
src channel8 with the source data.
dest channel8 where the segmentation mask will be left. This mask contains 0 for a background point and (usually) 255 for an object point.
Returns:
a reference to the dest.
image& lti::regionGrowing::apply ( image srcdest  )  const

Operates on the given parameter.

The background-pixels will be set to black, grey or white depending on the parameter "backgroundType".

Parameters:
srcdest image with the source data. The result will be left here too.
Returns:
a reference to the srcdest.
channel& lti::regionGrowing::apply ( channel srcdest  )  const

Operates on the given parameter.

The background-pixels will be set to 0, 0.5 or 1.0 depending on the parameter "backgroundType".

Parameters:
srcdest channel with the source data. The result will be left here too.
Returns:
a reference to the srcdest.
channel8& lti::regionGrowing::apply ( channel8 srcdest  )  const

Operates on the given parameter.

The background-pixels will be set to 0,128 or 255 depending on the parameter "backgroundType".

Parameters:
srcdest channel8 with the source data. The result will be left here too.
Returns:
a reference to the srcdest.
virtual functor* lti::regionGrowing::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from lti::segmentation.

regionGrowing& lti::regionGrowing::copy ( const regionGrowing other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::segmentation.

const parameters& lti::regionGrowing::getParameters (  )  const

Returns used parameters.

Reimplemented from lti::functor.

virtual const char* lti::regionGrowing::getTypeName (  )  const [virtual]

Returns the name of this type ("regionGrowing").

Reimplemented from lti::segmentation.

template<class T >
void lti::regionGrowing::mask ( matrix< T > &  img,
const channel8 msk,
const T &  background 
) const [inline, protected]

All pixels at img for which the mask is 0 will be set to the given value.

The mask and img MUST have the same size!

References lti::genericMatrix< T >::begin(), and lti::genericMatrix< T >::end().

channel8& lti::regionGrowing::segmentate ( const channel src,
channel8 dest 
) const [protected]

Operates on a copy of the given parameters.

Parameters:
src image with the source data.
dest the mask will be 0 for background pixels
Returns:
a reference to the dest.
channel8& lti::regionGrowing::segmentate ( const image src,
channel8 dest 
) const [protected]

Operates on a copy of the given parameters.

Parameters:
src image with the source data.
dest the mask will be 0 for background pixels
Returns:
a reference to the dest.
bool lti::regionGrowing::similar ( const float &  neighbour,
const float &  avrgAtSeed,
const float &  avrgThreshold 
) const [inline, protected]

The pixel at position "neighbour" will be compared with the average value corresponding to the position "seed".

The Codition for similarity proof if the absolute value of the difference between the channel value at "neighbour" and the local average on the "seed"-position is lower than the given avrgThreshold

bool lti::regionGrowing::similar ( const ubyte neighbour,
const ubyte avrgAtSeed,
const int &  avrgThreshold 
) const [inline, protected]

The pixel at position "neighbour" will be compared with the average value corresponding to the position "seed".

The Codition for similarity proof if the absolute value of the difference between the channel value at "neighbour" and the local average on the "seed"-position is lower than the given avrgThreshold

References lti::abs().


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

Generated on Sat Apr 10 15:27:46 2010 for LTI-Lib by Doxygen 1.6.1