latest version v1.9 - last update 10 Apr 2010 |
This is the implementation of the mean shift segmentation algorithm. More...
#include <ltiMeanShiftSegmentation.h>
Classes | |
struct | luvPixel |
like rgbPixel for RGB-ColorSpace, is luvPixel for LUV-ColorSpace More... | |
class | parameters |
the parameters for the class meanShiftSegmentation More... | |
Public Member Functions | |
meanShiftSegmentation () | |
meanShiftSegmentation (const parameters &par) | |
meanShiftSegmentation (const meanShiftSegmentation &other) | |
virtual | ~meanShiftSegmentation () |
virtual const char * | getTypeName () const |
bool | apply (const lti::image &src, lti::image &dest) |
bool | apply (const lti::image &src, lti::imatrix &dest) |
bool | apply (const lti::image &src, lti::imatrix &labels, lti::palette &colorMap) |
bool | apply (const lti::channel8 &chnl1, const lti::channel8 &chnl2, const lti::channel8 &chnl3, lti::imatrix &dest) |
bool | apply (const lti::image &src, lti::image &destFiltered, lti::image &destSegmented, lti::imatrix &destLabels, lti::palette &destColorMap) |
bool | filter (const lti::image &src, lti::image &dest) |
bool | filter (lti::image &srcdest) |
meanShiftSegmentation & | copy (const meanShiftSegmentation &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
This is the implementation of the mean shift segmentation algorithm.
It is described in
D. Comaniciu, P. Meer, "Mean Shift: A Robust Approach toward Feature Space Analysis" appeared in IEEE Trans. Pattern Analysis Machine Intell. Vol. 24, No. 5, 603-619, 2002 (original link here )
http://www.caip.rutgers.edu/~comanici/Papers/MsRobustApproach.pdf
The code here is based on the code of the original authors, modified extensively for the use with the LTI-Lib. It has changed a lot since then to provide more functionality and configuration options.
There are two implementations available:
The classic implementation is selected setting the parameter parameters::classicAlgorithm to true
. It is based on an old code example published by Comaniciu and colleagues a few years ago. This implementation was not as good as the newer version, but was already available in the LTI-Lib. Since several applications were adapted to use that mean-shift version, the default behaviour of this functors has not been changed.
The new implementation is an adaption of Comaniciu and Meer's EDISON code (http://www.caip.rutgers.edu/riul/research/robust.html). It can be selected setting parameters::classicAlgorithm to false
. Decisive for the result of the new implementation is the choice of the parameters parameters::sigmaR, parameters::sigmaS, parameters::maxNeighbourColorDistance, and the parameters::speedup.
lti::meanShiftSegmentation::meanShiftSegmentation | ( | ) |
default constructor
lti::meanShiftSegmentation::meanShiftSegmentation | ( | const parameters & | par | ) |
default constructor
lti::meanShiftSegmentation::meanShiftSegmentation | ( | const meanShiftSegmentation & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::meanShiftSegmentation::~meanShiftSegmentation | ( | ) | [virtual] |
destructor
bool lti::meanShiftSegmentation::apply | ( | const lti::image & | src, | |
lti::image & | destFiltered, | |||
lti::image & | destSegmented, | |||
lti::imatrix & | destLabels, | |||
lti::palette & | destColorMap | |||
) |
Apply the mean shift segmentation algorithm to the given image.
This image will be internally transformed into the Luv color space, as proposed by Comaniciu et.al. in their original paper.
src | image with the source data. | |
destFiltered | the meanshift filtered image (not available for classic algorithm) | |
destSegmented | the segmented image | |
destLabels | label associating each pixel to a mode and thus a color to each pixel | |
destColorMap | the colors of the found modes |
bool lti::meanShiftSegmentation::apply | ( | const lti::channel8 & | chnl1, | |
const lti::channel8 & | chnl2, | |||
const lti::channel8 & | chnl3, | |||
lti::imatrix & | dest | |||
) |
Apply the mean shift segmentation algorithm to a color image, which has been already split into three channels.
The algorithm will work with these channels without converting them into the Luv color space. This allows the use of the mean shift segmentation in other color spaces than Luv.
chnl1 | first channel of the source color image. | |
chnl2 | second channel of the source color image. | |
chnl3 | third channel of the source color image. | |
dest | imatrix where the result (region-labels) will be left. |
bool lti::meanShiftSegmentation::apply | ( | const lti::image & | src, | |
lti::imatrix & | labels, | |||
lti::palette & | colorMap | |||
) |
Apply the mean shift segmentation algorithm to the given image.
This image will be internally transformed into the Luv color space, as proposed by Comaniciu et.al. in their original paper.
src | image with the source data. | |
labels | imatrix where the result (region-labels) will be left. | |
colorMap | the color palette used |
bool lti::meanShiftSegmentation::apply | ( | const lti::image & | src, | |
lti::imatrix & | dest | |||
) |
Apply the mean shift segmentation algorithm to the given image.
This image will be internally transformed into the Luv color space, as proposed by Comaniciu et.al. in their original paper.
src | image with the source data. | |
dest | imatrix where the result (region-labels) will be left. |
bool lti::meanShiftSegmentation::apply | ( | const lti::image & | src, | |
lti::image & | dest | |||
) |
Apply the mean shift segmentation algorithm to the given image.
This image will be internally transformed into the Luv color space, as proposed by Comaniciu et.al. in their original paper.
src | image with the source data. | |
dest | image where the result (segmented image) will be left. |
virtual functor* lti::meanShiftSegmentation::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::segmentation.
meanShiftSegmentation& lti::meanShiftSegmentation::copy | ( | const meanShiftSegmentation & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::segmentation.
bool lti::meanShiftSegmentation::filter | ( | lti::image & | srcdest | ) |
bool lti::meanShiftSegmentation::filter | ( | const lti::image & | src, | |
lti::image & | dest | |||
) |
const parameters& lti::meanShiftSegmentation::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::meanShiftSegmentation::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("meanShiftSegmentation")
Reimplemented from lti::segmentation.