latest version v1.9 - last update 10 Apr 2010 |
CWAGM Segmentation. More...
#include <ltiCWAGMSegmentation.h>
Classes | |
class | parameters |
the parameters for the class cwagmSegmentation More... | |
Public Member Functions | |
cwagmSegmentation () | |
cwagmSegmentation (const parameters &par) | |
cwagmSegmentation (const cwagmSegmentation &other) | |
virtual | ~cwagmSegmentation () |
virtual const char * | getTypeName () const |
bool | apply (const image &src, imatrix ®ions, ivector ®ionSizes) |
bool | apply (const image &src, image &preproc, imatrix ®ions, ivector ®ionSizes) |
bool | apply (const image &src, image &preproc, imatrix ®ions, ivector ®ionSizes, channel &gradMag, channel &gradArg) |
cwagmSegmentation & | copy (const cwagmSegmentation &other) |
cwagmSegmentation & | operator= (const cwagmSegmentation &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
Protected Member Functions | |
bool | preprocess (const image &src, image &dest) const |
bool | worker (const image &orig, const image &preproc, imatrix ®ions, ivector ®ionSizes, channel &gradM, channel &gradA, vector< float > &gradHisto, float &maxGrad) |
bool | enhanceContrast (image &src) const |
Protected Attributes | |
local functors | |
medianFilter | median |
watershedSegmentation | watershed |
splitImage * | splitter |
colorContrastGradient | colorContrast |
regionGraphColorHaris | haris |
CWAGM Segmentation.
CWAGM means Color Watershed - Adjacency Graph Merge. It is a segmentation algortihms based on low level information introduced in P. Alvarado "Segmentation of color images for interactive 3D object retrieval". Ph.D. Thesis. RWTH-Aachen, 2004. http://www.bth.rwth-aachen.de/job/disslist.pl
This watershed-based concept is based on the ideas of Haris et.al. for a segmentation concept of gray-valued image, extended to color images. It uses (optionally) a median filtering to reduce the noise in each color channel, computes an over-segmentation with the watershed transformation and merge the regions to minimize the mean square error of a piece-wise constant image approximation.
lti::cwagmSegmentation::cwagmSegmentation | ( | ) |
default constructor
lti::cwagmSegmentation::cwagmSegmentation | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::cwagmSegmentation::cwagmSegmentation | ( | const cwagmSegmentation & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::cwagmSegmentation::~cwagmSegmentation | ( | ) | [virtual] |
destructor
bool lti::cwagmSegmentation::apply | ( | const image & | src, | |
image & | preproc, | |||
imatrix & | regions, | |||
ivector & | regionSizes, | |||
channel & | gradMag, | |||
channel & | gradArg | |||
) |
Segmentate the image src and return many internal partial results that can be used in further processing units.
Note that there are several segmentation modes (like color ACA or mean-shift segmentation) which do not require the gradient computation. These modes will leave the given gradMag and gradArg untouched. This way, the gradients won't be unnecessarily computed and you can detect if they are computed or not: just give empty channels and if they are still empty after calling this method, you will have to compute them, if you need to.
src | image with the source data. | |
preproc | resulting preprocessed image. | |
regions | labeled mask as imatrix, where the result will be left. | |
regionSizes | sizes of each region in the regions mask. | |
gradMag | magnitude of the color gradient | |
gradArg | orientation of the color gradient |
operates on a copy of the given parameters.
src | image with the source data. | |
regions | labeled mask as imatrix, where the result will be left. | |
regionSizes | sizes of each region in the regions mask. |
virtual functor* lti::cwagmSegmentation::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::segmentation.
cwagmSegmentation& lti::cwagmSegmentation::copy | ( | const cwagmSegmentation & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::segmentation.
bool lti::cwagmSegmentation::enhanceContrast | ( | image & | src | ) | const [protected] |
The simplest contrast enhancement consists in mapping the input value range of each channel into 0 to 255, each channel independently of the others.
src MUST be connected. (see matrix<T>::mode())
const parameters& lti::cwagmSegmentation::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::cwagmSegmentation::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("cwagmSegmentation")
Reimplemented from lti::segmentation.
cwagmSegmentation& lti::cwagmSegmentation::operator= | ( | const cwagmSegmentation & | other | ) |
Preprocess Denoise and Enhance Contrast.
virtual bool lti::cwagmSegmentation::updateParameters | ( | ) | [virtual] |
Update functor's parameters.
Update the internal state of the functor according to the parameters. This special case the functor used to split the image into its color componentes is initialized here.
Reimplemented from lti::functor.
bool lti::cwagmSegmentation::worker | ( | const image & | orig, | |
const image & | preproc, | |||
imatrix & | regions, | |||
ivector & | regionSizes, | |||
channel & | gradM, | |||
channel & | gradA, | |||
vector< float > & | gradHisto, | |||
float & | maxGrad | |||
) | [protected] |
Split and merge with watersheds.
orig | original color image | |
preproc | preprocessed image | |
regions | labeld mask with initial partition | |
regionSizes | number of pixels per region | |
gradM | magnitude of the color gradient | |
gradA | orientation of the color gradient | |
gradHisto | histogram of the gradient values | |
maxGrad | maximum gradient value which is also the last value in the histogram. |
color contrast gradient functor used in edge detection
regionGraphColorHaris lti::cwagmSegmentation::haris [protected] |
Haris region merging method (well, my adaption of it).
medianFilter lti::cwagmSegmentation::median [protected] |
median filter
splitImage* lti::cwagmSegmentation::splitter [protected] |
pointer to splitter object
Watershed segmentation functor.