Basic Image AlgorithmS Library
2.8.0
|
Implements a 2D median filter for images. More...
#include <Filter/Median.hh>
Public Types | |
enum | TBorderHandling { TBH_full, TBH_same, TBH_valid } |
enum for border calculation, same meanings as in matlab: More... | |
Public Member Functions | |
void | AddDebugLevel (const long int lv) |
void | AddDebugLevel (const std::string &name) |
virtual FilterNToN < InputStorageType, OutputStorageType > * | Clone () const |
void | CopyNonROIFromSource (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) const |
run over all pixel which do not belong to the roi and set them to the value in the source image regardless of the roi of the source. More... | |
bool | DebugLevelIsSet (const long int lv) const |
bool | DebugLevelIsSet (const std::string &name) const |
virtual int | Filter (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) |
virtual function for interface definition More... | |
int | Filter3x3x3Color (std::vector< Image< InputStorageType > > &srcs, Image< OutputStorageType > &dst) |
int | Filter3x3x3Grey (std::vector< Image< InputStorageType > > &srcs, Image< OutputStorageType > &dst) |
int | FilterColorImg (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) |
int | FilterColorImgVec (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, unsigned int px, unsigned int py, const Image< unsigned char > *ignorePixels=NULL) |
int | FilterColorImgVec (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const Image< unsigned char > *ignorePixels=NULL) |
virtual int | FilterFloat (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) |
int | FilterIgnore3x3 (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const float &threshold) const |
filters using only values above threshold as input More... | |
int | FilterIgnoreZero5x5 (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) const |
virtual int | FilterInt (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) |
int | FilterOnlyBelowIgnoreBelow3x3 (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const float &threshold, const unsigned &min_support=1) const |
Specialized median filter for images with invalid values. More... | |
int | FilterOnlyZeroIgnoreZero3x3 (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const float &Threshold=0.0f) const |
fill spurious gaps in depth maps compute 3x3 median at zero points, thereby ignoring zero values More... | |
int | FilterOnlyZeroIgnoreZero5x5 (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const float &Threshold=0.0f) const |
fill spurious gaps in depth maps compute 5x5 median at zero points, thereby ignoring zero values More... | |
int | FilterParallel (Image< InputStorageType > &source, Image< OutputStorageType > &dest, unsigned int numberOfThreads) |
int | FilterRemoveSaltAndPepper (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const float &Threshold=3.0f) const |
removes "salt and pepper" by replacing outliers (Threshold) with median of neighbourhood. More... | |
int | GetBorderHandling () const |
void | GetBorders (int &border_x, int &border_y) const |
int | GetDebugLevel () const |
std::ostream & | GetDebugStream () const |
void | GetDebugStream (std::ostream &os) const |
Median () | |
Median (const Median< InputStorageType, OutputStorageType > &other) | |
long int | Name2DebugLevel (const std::string &name) const |
looks up a debuglevel in the internal map, returns 0 if not found More... | |
long int | NewDebugLevel (const std::string &name) |
creates a new debuglevel More... | |
void | PrintDebugLevel (std::ostream &os=std::cout) const |
void | RemoveDebugLevel (const long int lv) |
void | RemoveDebugLevel (const std::string &name) |
void | SetBorderHandling (const int bh) |
void | SetDebugLevel (const long int lv) |
void | SetDebugLevel (const std::string &name) |
void | SetDebugStream (const std::ostream &os) |
void | SetMinValue (float min) |
void | SetNonROIToValue (Image< OutputStorageType > &dst, const std::vector< OutputStorageType > &t) const |
run over all pixel which do not belong to the roi and set them to some value (typically black) More... | |
void | SetSize (int newsize, int secondsize=-1) |
void | ShowDebugLevel (std::ostream &os=std::cout) const |
prints all internally known debuglevels More... | |
virtual | ~Median () |
Static Public Member Functions | |
static long int | GetGlobalDebugLevel () |
static void | SetGlobalDebugLevel (long int lev) |
Protected Member Functions | |
long | ConsumeNextFreeDebuglevel_ () |
returns the next available debuglevel More... | |
virtual void | GetBordersValid_ (int &border_x, int &border_y) const |
Protected Attributes | |
int | _FilterBorderHandling |
long int | _liDebugLevel |
long int | _liNextDebugLevel |
new concept, debuglevel are managed here in the debug class More... | |
int | _MedianSize |
half win size of median, 1 means 3x3 More... | |
float | _MinValue |
int | _secondSize |
Use this variable for non-quadratic filter sizes e.g. 3x1. More... | |
std::map< std::string, long int > | _String2Debuglevel |
Static Protected Attributes | |
static std::ostream | _zDebugStream |
static long int | GlobalDebugLevel = 0 |
Implements a 2D median filter for images.
|
inherited |
enum for border calculation, same meanings as in matlab:
Enumerator | |
---|---|
TBH_full | |
TBH_same | |
TBH_valid |
Definition at line 98 of file FilterBase.hh.
Median::Median | ( | ) |
Median::Median | ( | const Median< InputStorageType, OutputStorageType > & | other | ) |
Definition at line 44 of file Median.cpp.
References BIAS::Median< InputStorageType, OutputStorageType >::_MedianSize, and BIAS::Median< InputStorageType, OutputStorageType >::_secondSize.
|
virtual |
Definition at line 53 of file Median.cpp.
|
inlineinherited |
Definition at line 355 of file Debug.hh.
Referenced by BIAS::GLProjectionParametersBase::AddDebugLevel(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase(), BIAS::ShowCamWxVideoSourceFactory::OpenDevice(), and BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph().
|
inlineinherited |
|
inlinevirtual |
|
inlineprotectedinherited |
|
inherited |
run over all pixel which do not belong to the roi and set them to the value in the source image regardless of the roi of the source.
Both images must have same size.
Definition at line 135 of file FilterBase.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ROI::GetCorners(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), BIAS::ImageBase::GetWidth(), and BIAS::ROI_Corners.
|
inlineinherited |
Definition at line 341 of file Debug.hh.
Referenced by BIAS::GenSynthMatches::_AddUniformDistributedOutliers(), BIAS::GenSynthMatches::_CreateCamMovement(), BIAS::GenSynthMatches::_CreateStatic2DPoints(), BIAS::UnscentedTransform::ComputeSigmaPoints_(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::GenSynthMatches::GetGTNormalizedF(), BIAS::MonteCarloTransform::GetSamples_(), and BIAS::MonteCarloTransform::Transform().
|
inlineinherited |
|
virtual |
virtual function for interface definition
Implements BIAS::FilterNToN< InputStorageType, OutputStorageType >.
Definition at line 69 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ROI::GetCorners(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::Image< StorageType >::Release(), BIAS::ImageBase::SamePixelAndChannelCount(), BIAS::ROI::SetCorners(), and BIAS::ImageBase::StealImage().
Referenced by BIAS::PMDImageProc::DenoiseDepthImage().
int Median::Filter3x3x3Color | ( | std::vector< Image< InputStorageType > > & | srcs, |
Image< OutputStorageType > & | dst | ||
) |
Definition at line 1355 of file Median.cpp.
References BIAS::ImageBase::CM_RGB, BIAS::ImageConvert::Convert(), BIAS::ImageBase::GetChannel(), BIAS::Image< StorageType >::PixelValue(), and BIAS::Image< StorageType >::SetPixel().
int Median::Filter3x3x3Grey | ( | std::vector< Image< InputStorageType > > & | srcs, |
Image< OutputStorageType > & | dst | ||
) |
Definition at line 1291 of file Median.cpp.
References BIAS::ImageBase::CM_Grey, BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::Image< StorageType >::SetPixel().
int Median::FilterColorImg | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst | ||
) |
use planar image in order to apply median filter seperately to each channel for now
Definition at line 1030 of file Median.cpp.
References BIAS::ImageBase::CM_RGB, BIAS::ImageConvert::Convert(), BIAS::ImageBase::GetChannel(), BIAS::ImageBase::GetColorModel(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::ImageBase::IsPlanar(), BIAS::Image< StorageType >::PixelValue(), and BIAS::Image< StorageType >::SetPixel().
Referenced by BIAS::ConstantRegionDetector< StorageType, CalculationType >::Detect().
int Median::FilterColorImgVec | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
unsigned int | px, | ||
unsigned int | py, | ||
const Image< unsigned char > * | ignorePixels = NULL |
||
) |
Definition at line 1077 of file Median.cpp.
References BIAS::Image< StorageType >::Clear(), BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::Image< StorageType >::PixelValue(), and BIAS::Image< StorageType >::SetPixel().
int Median::FilterColorImgVec | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const Image< unsigned char > * | ignorePixels = NULL |
||
) |
Definition at line 1181 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), and BIAS::Image< StorageType >::PixelValue().
|
virtual |
Implements BIAS::FilterNToN< InputStorageType, OutputStorageType >.
Definition at line 174 of file Median.cpp.
int Median::FilterIgnore3x3 | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const float & | threshold | ||
) | const |
filters using only values above threshold as input
Definition at line 765 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::Image< StorageType >::Release(), and BIAS::ImageBase::SamePixelAndChannelCount().
int Median::FilterIgnoreZero5x5 | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst | ||
) | const |
Definition at line 182 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetPixelCount(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::Image< StorageType >::Release(), and BIAS::ImageBase::SamePixelAndChannelCount().
|
virtual |
Implements BIAS::FilterNToN< InputStorageType, OutputStorageType >.
Definition at line 166 of file Median.cpp.
int Median::FilterOnlyBelowIgnoreBelow3x3 | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const float & | threshold, | ||
const unsigned & | min_support = 1 |
||
) | const |
Specialized median filter for images with invalid values.
Only positions containing an invalid value (i.e. a value < threshold) are touched by the filter. They are set to the median of all neighboring pixels, which are not invalid themselves, iff a minimium number of min_support_pixels are found. Otherwise the invalid value is preserved.
Definition at line 664 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), and BIAS::ImageBase::SamePixelAndChannelCount().
int Median::FilterOnlyZeroIgnoreZero3x3 | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const float & | Threshold = 0.0f |
||
) | const |
fill spurious gaps in depth maps compute 3x3 median at zero points, thereby ignoring zero values
Threshold | all values<=threshold are rewritten, all values>threshold are used for median sorting |
Definition at line 559 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetPixelCount(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::Image< StorageType >::Release(), and BIAS::ImageBase::SamePixelAndChannelCount().
int Median::FilterOnlyZeroIgnoreZero5x5 | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const float & | Threshold = 0.0f |
||
) | const |
fill spurious gaps in depth maps compute 5x5 median at zero points, thereby ignoring zero values
Threshold | all values<=threshold are rewritten, all values>threshold are used for median sorting |
Definition at line 366 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetPixelCount(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::Image< StorageType >::Release(), and BIAS::ImageBase::SamePixelAndChannelCount().
int Median::FilterParallel | ( | Image< InputStorageType > & | source, |
Image< OutputStorageType > & | dest, | ||
unsigned int | numberOfThreads | ||
) |
Definition at line 1219 of file Median.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), and BIAS::Image< StorageType >::Release().
int Median::FilterRemoveSaltAndPepper | ( | const Image< InputStorageType > & | src, |
Image< OutputStorageType > & | dst, | ||
const float & | Threshold = 3.0f |
||
) | const |
removes "salt and pepper" by replacing outliers (Threshold) with median of neighbourhood.
For two channels: assume second channel is covariance, do not filter but copy corresponding value from median
Definition at line 831 of file Median.cpp.
References BIAS::Median1D< DataType >::Compute(), BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetColorModel(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::Median1D< DataType >::GetMedian(), BIAS::ImageBase::GetStorageType(), BIAS::ImageBase::GetWidth(), BIAS::Median1D< DataType >::GetX84(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), BIAS::ImageBase::IsPlanar(), BIAS::Image< StorageType >::Release(), BIAS::ImageBase::SamePixelAndChannelCount(), BIAS::ImageBase::SetColorModel(), and BIAS::ImageBase::StealImage().
|
inlineinherited |
Definition at line 129 of file FilterBase.hh.
|
inherited |
Definition at line 61 of file FilterBase.cpp.
Referenced by BIAS::Rescale< InputStorageType, OutputStorageType >::GetBordersValid_().
|
protectedvirtual |
Implements BIAS::FilterBase< InputStorageType, OutputStorageType >.
Definition at line 1016 of file Median.cpp.
|
inlineinherited |
Definition at line 332 of file Debug.hh.
Referenced by BIAS::listenthread(), BIAS::Image< StorageType >::operator=(), and BIAS::ImageBase::operator=().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlineinherited |
creates a new debuglevel
Definition at line 474 of file Debug.hh.
Referenced by BIAS::COSAC< SolutionType >::COSAC(), BIAS::ProjectionParametersPerspectiveDepth::Init(), BIAS::MonteCarloTransform::MonteCarloTransform(), BIAS::PMatrixEstimation::PMatrixEstimation(), BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC(), BIAS::RANSACPreKnowledge< SolutionType >::RANSACPreKnowledge(), BIAS::ROI::ROI(), BIAS::RotationAveraging::RotationAveraging(), BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph(), BIAS::ThreeDOutOpenSceneGraph::ThreeDOutOpenSceneGraph(), BIAS::Triangulation::Triangulation(), and BIAS::UnscentedTransform::UnscentedTransform().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 127 of file FilterBase.hh.
Referenced by BIAS::PMDImageProc::DenoiseDepthImage(), BIAS::CalibratedPyramid< StorageType >::Downsample_(), BIAS::PMDImageProc::FitDepthTo2DImage(), and BIAS::PMDImageProc::FitDepthTo2DImageFree_().
|
inlineinherited |
Definition at line 318 of file Debug.hh.
Referenced by BIAS::ShowCamWxVideoSourceFactory::CreateBumbleBee(), BIAS::ShowCamWxVideoSourceFactory::CreateDCAM(), BIAS::VideoSource_MDcam::ScanBus(), BIAS::GLProjectionParametersBase::SetDebugLevel(), BIAS::VideoSource_Disk::VideoSource_Disk(), BIAS::VideoSource_DV2::VideoSource_DV2(), BIAS::VideoSource_DV::VideoSource_DV_Internal_Init_(), and BIAS::VideoSource_V4L::VideoSource_V4L().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inline |
|
inherited |
run over all pixel which do not belong to the roi and set them to some value (typically black)
Definition at line 84 of file FilterBase.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ROI::GetCorners(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), BIAS::ImageBase::GetWidth(), and BIAS::ROI_Corners.
|
inline |
Definition at line 140 of file Median.hh.
Referenced by BIAS::PMDImageProc::DenoiseDepthImage(), and BIAS::ConstantRegionDetector< StorageType, CalculationType >::Detect().
|
inlineinherited |
|
protectedinherited |
Definition at line 132 of file FilterBase.hh.
Referenced by BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase().
|
protectedinherited |
Definition at line 510 of file Debug.hh.
Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().
|
protectedinherited |
new concept, debuglevel are managed here in the debug class
Definition at line 516 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
half win size of median, 1 means 3x3
Definition at line 159 of file Median.hh.
Referenced by BIAS::Median< InputStorageType, OutputStorageType >::Median().
|
protected |
Definition at line 163 of file Median.hh.
Referenced by BIAS::Median< InputStorageType, OutputStorageType >::Median().
|
protected |
Use this variable for non-quadratic filter sizes e.g. 3x1.
Definition at line 162 of file Median.hh.
Referenced by BIAS::Median< InputStorageType, OutputStorageType >::Median().
|
protectedinherited |
Definition at line 517 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |
Definition at line 511 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |