OTB
9.0.0
Orfeo Toolbox
|
#include <otbMeanShiftSmoothingImageFilter.h>
Public Types | |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef itk::SmartPointer< Self > | Pointer |
typedef double | RealType |
typedef MeanShiftSmoothingImageFilter | Self |
typedef itk::ImageToImageFilter< TInputImage, TOutputImage > | Superclass |
typedef TInputImage | InputImageType |
typedef InputImageType::Pointer | InputImagePointerType |
typedef InputImageType::PixelType | InputPixelType |
typedef InputImageType::IndexType | InputIndexType |
typedef InputImageType::SizeType | InputSizeType |
typedef InputImageType::IndexValueType | InputIndexValueType |
typedef InputImageType::PointType | PointType |
typedef InputImageType::RegionType | RegionType |
typedef InputImageType::SizeType | SizeType |
typedef TOutputImage | OutputImageType |
typedef OutputImageType::Pointer | OutputImagePointerType |
typedef OutputImageType::PixelType | OutputPixelType |
typedef OutputImageType::RegionType | OutputRegionType |
typedef TOutputIterationImage | OutputIterationImageType |
typedef unsigned long | LabelType |
typedef otb::Image< LabelType, InputImageType::ImageDimension > | OutputLabelImageType |
typedef otb::VectorImage< RealType, InputImageType::ImageDimension > | OutputSpatialImageType |
typedef OutputSpatialImageType::Pointer | OutputSpatialImagePointerType |
typedef OutputSpatialImageType::PixelType | OutputSpatialPixelType |
typedef TKernel | KernelType |
typedef itk::VariableLengthVector< RealType > | RealVector |
typedef otb::VectorImage< RealType, InputImageType::ImageDimension > | RealVectorImageType |
typedef otb::Image< unsigned short, InputImageType::ImageDimension > | ModeTableImageType |
static const unsigned int | ImageDimension = InputImageType::ImageDimension |
RealType | m_RangeBandwidth |
RealType | m_RangeBandwidthRamp |
RealType | m_SpatialBandwidth |
InputSizeType | m_SpatialRadius |
double | m_Threshold |
unsigned int | m_MaxIterationNumber |
KernelType | m_Kernel |
unsigned int | m_NumberOfComponentsPerPixel |
RealVectorImageType::Pointer | m_JointImage |
ModeTableImageType::Pointer | m_ModeTable |
bool | m_ModeSearch |
itk::VariableLengthVector< LabelType > | m_NumLabels |
unsigned int | m_ThreadIdNumberOfBits |
InputIndexType | m_GlobalShift |
virtual const char * | GetNameOfClass () const |
virtual ::itk::LightObject::Pointer | CreateAnother (void) const |
virtual void | SetSpatialBandwidth (RealType _arg) |
virtual const RealType & | GetSpatialBandwidth () const |
virtual void | SetRangeBandwidth (RealType _arg) |
virtual const RealType & | GetRangeBandwidth () const |
virtual void | SetRangeBandwidthRamp (RealType _arg) |
virtual const RealType & | GetRangeBandwidthRamp () const |
virtual const unsigned int & | GetMaxIterationNumber () const |
virtual void | SetMaxIterationNumber (unsigned int _arg) |
virtual const double & | GetThreshold () const |
virtual void | SetThreshold (double _arg) |
virtual void | SetModeSearch (bool _arg) |
virtual const bool & | GetModeSearch () const |
virtual void | SetGlobalShift (InputIndexType _arg) |
const OutputSpatialImageType * | GetSpatialOutput () const |
const OutputImageType * | GetRangeOutput () const |
const OutputIterationImageType * | GetIterationOutput () const |
const OutputLabelImageType * | GetLabelOutput () const |
OutputSpatialImageType * | GetSpatialOutput () |
OutputImageType * | GetRangeOutput () |
OutputIterationImageType * | GetIterationOutput () |
OutputLabelImageType * | GetLabelOutput () |
static Pointer | New () |
void | GenerateOutputInformation (void) override |
void | GenerateInputRequestedRegion () override |
void | BeforeThreadedGenerateData () override |
void | ThreadedGenerateData (const OutputRegionType &outputRegionForThread, itk::ThreadIdType threadId) override |
void | AfterThreadedGenerateData () override |
void | AllocateOutputs () override |
MeanShiftSmoothingImageFilter () | |
~MeanShiftSmoothingImageFilter () override | |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
virtual void | CalculateMeanShiftVector (const typename RealVectorImageType::Pointer inputImagePtr, const RealVector &jointPixel, const OutputRegionType &outputRegion, const RealVector &bandwidth, RealVector &meanShiftVector) |
MeanShiftSmoothingImageFilter (const Self &)=delete | |
void | operator= (const Self &)=delete |
Mean shift is an edge-preserving smoothing algorithm often used in image processing and segmentation. It will iteratively smooth a given pixel with its neighbors that are within a spatial distance (set using SetSpatialBandwidth()) and within a spectral range (set using SetRangeBandwidth()). The resulting filtered image can be retrieved by GetOutput() or GetRangeOutput(). Parameter SetRangeBandwidthRamp() allows linearly adapting the range bandwidth to the intensity of each channel if set greater than 0 (default value is 0).
There are additional output images, as explained below. Internally, the algorithm will iteratively update a pixel both in position and spectral value, with respect to its neighbors, until convergence to a local mode. The map of the distance traveled by pixels is obtained by GetSpatialOutput(). A map of detected local modes is also available in GetLabelOutput() if mode search is set to true (default set to false) and can be seen as a first segmentation of the input image, although usually highly oversegmented. Finally, GetIterationOutput() will return the number of algorithm iterations for each pixel.
The class template parameter TKernel allows one to choose how pixels in the spatial and spectral neighborhood of a given pixel participate in the smoothed result. By default, a uniform kernel is used (KernelUniform), giving an equal weight to all neighbor pixels. KernelGaussian can also be used, although the computation time is significantly higher. The TKernel class should define operator(), taking a squared norm as parameter and returning a real value between 0 and 1. It should also define GetRadius(), converting the spatial bandwidth parameter to the spatial radius defining how many pixels are in the processing window local to a pixel.
MeanShiftVector squared norm is compared with Threshold (set using Get/Set accessor) to define pixel convergence (1e-3 by default). MaxIterationNumber defines maximum iteration number for each pixel convergence (set using Get/Set accessor). Set to 4 by default. ModeSearch is a boolean value, to choose between optimized and non optimized algorithm. If set to true (by default), assign mode value to each pixel on a path covered in convergence steps.
For more information on mean shift techniques, one might consider reading the following article:
D. Comaniciu, P. Meer, "Mean Shift: A Robust Approach Toward Feature Space Analysis," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 24, no. 5, pp. 603-619, May, 2002 D. Comaniciu, P. Meer, "Robust analysis of feature spaces: color image segmentation," cvpr, p. 750, 1997 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'97), 1997 D. Comaniciu, P. Meer, "Mean Shift Analysis and Applications," iccv, p. 1197, Seventh International Conference on Computer Vision (ICCV'99) - Volume 2, 1999
Definition at line 467 of file otbMeanShiftSmoothingImageFilter.h.
typedef itk::SmartPointer<const Self> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::ConstPointer |
Definition at line 474 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::Pointer otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputImagePointerType |
Template parameters typedefs
Definition at line 487 of file otbMeanShiftSmoothingImageFilter.h.
typedef TInputImage otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputImageType |
Template parameters typedefs
Definition at line 480 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::IndexType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputIndexType |
Template parameters typedefs
Definition at line 489 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::IndexValueType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputIndexValueType |
Template parameters typedefs
Definition at line 491 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::PixelType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputPixelType |
Template parameters typedefs
Definition at line 488 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::SizeType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::InputSizeType |
Template parameters typedefs
Definition at line 490 of file otbMeanShiftSmoothingImageFilter.h.
typedef TKernel otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::KernelType |
Template parameters typedefs
Definition at line 510 of file otbMeanShiftSmoothingImageFilter.h.
typedef unsigned long otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::LabelType |
Template parameters typedefs
Definition at line 503 of file otbMeanShiftSmoothingImageFilter.h.
typedef otb::Image<unsigned short, InputImageType::ImageDimension> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::ModeTableImageType |
Template parameters typedefs
Definition at line 516 of file otbMeanShiftSmoothingImageFilter.h.
typedef OutputImageType::Pointer otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputImagePointerType |
Template parameters typedefs
Definition at line 497 of file otbMeanShiftSmoothingImageFilter.h.
typedef TOutputImage otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputImageType |
Template parameters typedefs
Definition at line 496 of file otbMeanShiftSmoothingImageFilter.h.
typedef TOutputIterationImage otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputIterationImageType |
Template parameters typedefs
Definition at line 501 of file otbMeanShiftSmoothingImageFilter.h.
typedef otb::Image<LabelType, InputImageType::ImageDimension> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputLabelImageType |
Template parameters typedefs
Definition at line 504 of file otbMeanShiftSmoothingImageFilter.h.
typedef OutputImageType::PixelType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputPixelType |
Template parameters typedefs
Definition at line 498 of file otbMeanShiftSmoothingImageFilter.h.
typedef OutputImageType::RegionType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputRegionType |
Template parameters typedefs
Definition at line 499 of file otbMeanShiftSmoothingImageFilter.h.
typedef OutputSpatialImageType::Pointer otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputSpatialImagePointerType |
Template parameters typedefs
Definition at line 507 of file otbMeanShiftSmoothingImageFilter.h.
typedef otb::VectorImage<RealType, InputImageType::ImageDimension> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputSpatialImageType |
Template parameters typedefs
Definition at line 506 of file otbMeanShiftSmoothingImageFilter.h.
typedef OutputSpatialImageType::PixelType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputSpatialPixelType |
Template parameters typedefs
Definition at line 508 of file otbMeanShiftSmoothingImageFilter.h.
typedef itk::SmartPointer<Self> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::Pointer |
Definition at line 473 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::PointType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::PointType |
Template parameters typedefs
Definition at line 492 of file otbMeanShiftSmoothingImageFilter.h.
typedef double otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::RealType |
Definition at line 475 of file otbMeanShiftSmoothingImageFilter.h.
typedef itk::VariableLengthVector<RealType> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::RealVector |
Template parameters typedefs
Definition at line 514 of file otbMeanShiftSmoothingImageFilter.h.
typedef otb::VectorImage<RealType, InputImageType::ImageDimension> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::RealVectorImageType |
Template parameters typedefs
Definition at line 515 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::RegionType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::RegionType |
Template parameters typedefs
Definition at line 493 of file otbMeanShiftSmoothingImageFilter.h.
typedef MeanShiftSmoothingImageFilter otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::Self |
Standard class typedef
Definition at line 471 of file otbMeanShiftSmoothingImageFilter.h.
typedef InputImageType::SizeType otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::SizeType |
Template parameters typedefs
Definition at line 494 of file otbMeanShiftSmoothingImageFilter.h.
typedef itk::ImageToImageFilter<TInputImage, TOutputImage> otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::Superclass |
Definition at line 472 of file otbMeanShiftSmoothingImageFilter.h.
|
protected |
Constructor
Definition at line 36 of file otbMeanShiftSmoothingImageFilter.hxx.
References otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::m_GlobalShift, otb::VectorImage< TPixel, VImageDimension >::New(), and otb::Image< TPixel, VImageDimension >::New().
|
overrideprotected |
Destructor
Definition at line 65 of file otbMeanShiftSmoothingImageFilter.hxx.
|
privatedelete |
Template parameters typedefs
|
overrideprotected |
Template parameters typedefs
Definition at line 771 of file otbMeanShiftSmoothingImageFilter.hxx.
|
overrideprotected |
Allocates the outputs (need to be reimplemented since outputs have different type)
Definition at line 126 of file otbMeanShiftSmoothingImageFilter.hxx.
|
overrideprotected |
Template parameters typedefs
Definition at line 222 of file otbMeanShiftSmoothingImageFilter.hxx.
|
protectedvirtual |
Template parameters typedefs
Definition at line 349 of file otbMeanShiftSmoothingImageFilter.hxx.
References otb::Meanshift::FastImageRegionConstIterator< TImage >::GetPixelPointer().
virtual::itk::LightObject::Pointer otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::CreateAnother | ( | void | ) | const |
Template parameters typedefs
|
overrideprotected |
Template parameters typedefs
Definition at line 164 of file otbMeanShiftSmoothingImageFilter.hxx.
|
overrideprotected |
GenerateOutputInformation Define output pixel size
Definition at line 147 of file otbMeanShiftSmoothingImageFilter.hxx.
OutputIterationImageType* otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetIterationOutput | ( | ) |
Returns the number of iterations done at each pixel
const MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputIterationImageType * otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetIterationOutput |
Returns the const number of iterations map.
Definition at line 99 of file otbMeanShiftSmoothingImageFilter.hxx.
OutputLabelImageType* otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetLabelOutput | ( | ) |
Returns the image of region labels. This output does not have sense without mode search optimization (each label codes for one mode)
const MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputLabelImageType * otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetLabelOutput |
Returns the const image of region labels. This output does not have sense without mode search optimization (each label codes for one mode)
Definition at line 113 of file otbMeanShiftSmoothingImageFilter.hxx.
|
virtual |
Sets the maximum number of algorithm iterations
|
virtual |
Template parameters typedefs
|
virtual |
Type macro
|
virtual |
Template parameters typedefs
|
virtual |
Template parameters typedefs
OutputImageType* otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetRangeOutput | ( | ) |
Returns the spectral image output
MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputImageType * otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetRangeOutput |
Returns the const spectral image output
Definition at line 85 of file otbMeanShiftSmoothingImageFilter.hxx.
|
virtual |
Template parameters typedefs
OutputSpatialImageType* otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetSpatialOutput | ( | ) |
Returns the spatial image output,spatial image output is a displacement map (pixel position after convergence minus pixel index)
MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::OutputSpatialImageType * otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::GetSpatialOutput |
Returns the const spatial image output,spatial image output is a displacement map (pixel position after convergence minus pixel index)
Definition at line 71 of file otbMeanShiftSmoothingImageFilter.hxx.
|
virtual |
Sets the threshold value for the mean shift vector's squared norm, under which convergence is assumed
|
static |
Template parameters typedefs
|
privatedelete |
Template parameters typedefs
|
overrideprotected |
PrintSelf method
Definition at line 817 of file otbMeanShiftSmoothingImageFilter.hxx.
|
virtual |
Global shift allows tackling down numerical instabilities by aligning pixel indices when performing tile processing
|
virtual |
Template parameters typedefs
|
virtual |
Toggle mode search, which is enabled by default. When off, the output label image is not available Be careful, with this option, the result will slightly depend on thread number.
|
virtual |
Sets the spectral bandwidth (or radius for a uniform kernel) for pixels to be included in the same mode
|
virtual |
Sets the range bandwidth ramp. If > 0, the range bandwidth will be y = RangeBandwidthRamp * x + RangeBandwidth, where x is the band value.
|
virtual |
Sets the spatial bandwidth (or radius in the case of a uniform kernel) of the neighborhood for each pixel
|
virtual |
Template parameters typedefs
|
overrideprotected |
MeanShiftFilter can be implemented as a multithreaded filter. Therefore, this implementation provides a ThreadedGenerateData() routine which is called for each processing thread. The output image data is allocated automatically by the superclass prior to calling ThreadedGenerateData(). ThreadedGenerateData can only write to the portion of the output image specified by the parameter "outputRegionForThread"
Definition at line 533 of file otbMeanShiftSmoothingImageFilter.hxx.
|
static |
Template parameters typedefs
Definition at line 512 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Template parameters typedefs
Definition at line 698 of file otbMeanShiftSmoothingImageFilter.h.
Referenced by otb::MeanShiftSmoothingImageFilter< TInputImage, TOutputImage, TKernel, TOutputIterationImage >::MeanShiftSmoothingImageFilter().
|
private |
Input data in the joint spatial-range domain, scaled by the bandwidths
Definition at line 668 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Kernel object, implementing operator() which returns a weight between 0 and 1 depending on the squared norm given in parameter
Definition at line 662 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Maximum number of iterations
Definition at line 658 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Boolean to enable mode search
Definition at line 679 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Image to store the status at each pixel: 0 : no mode has been found yet 1 : a mode has been assigned to this pixel 2 : pixel is in the path of the currently processed pixel and a mode will be assigned to it
Definition at line 676 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Number of components per pixel in the input image
Definition at line 665 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Mode counters (local to each thread)
Definition at line 687 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Range bandwidth
Definition at line 643 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Coefficient
Definition at line 646 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Spatial bandwidth
Definition at line 649 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Radius of pixel neighborhood, determined by the kernel from the spatial bandwidth
Definition at line 652 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Number of bits used to represent the threadId in the most significant bits of labels
Definition at line 691 of file otbMeanShiftSmoothingImageFilter.h.
|
private |
Threshold on the squared norm of the mean shift vector to decide when to stop iterating
Definition at line 655 of file otbMeanShiftSmoothingImageFilter.h.