Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::GaussThreshold< InputStorageType, OutputStorageType > Class Template Reference

smoothing with gaussian kernel using a threshold More...

#include <Filter/GaussThreshold.hh>

+ Inheritance diagram for BIAS::GaussThreshold< InputStorageType, OutputStorageType >:
+ Collaboration diagram for BIAS::GaussThreshold< InputStorageType, OutputStorageType >:

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)
 
bool CalculationInFloat () const
 decides if calculation is done in integer or floating point More...
 
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)
 sets gauss kernel if params changed and calls convolution or fast grey implementation if possible More...
 
int Filter7x7GreyIgnoreBelowThreshold (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const double thresh)
 7x7 gauss filtering, values below threshold are ignored useful for depth map filtering More...
 
int Filter7x7GreyOnlyBelowThreshold (const Image< InputStorageType > &src, Image< OutputStorageType > &dst, const double thresh)
 7x7 gauss filtering, values below threshold are ignored and only pixels below threshold are filed More...
 
virtual int FilterFloat (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 do the convolution using floating point calculations More...
 
virtual int FilterInt (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 do the convolution using integer arithmetics and shifts More...
 
 GaussThreshold ()
 
 GaussThreshold (const GaussThreshold< InputStorageType, OutputStorageType > &other)
 
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
 
void GetKernel (FilterMask &fm) const
 get the current filter mask More...
 
double GetRatio () const
 
double GetRatio ()
 
double GetSigma () const
 
double GetSigma ()
 
double GetTreshold () const
 
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 PrintKernel () const
 prints the used filter mask, for debugging More...
 
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 SetHalfWinSize (const int hws, bool AdjustSigma=true)
 define the half win size of the kernel, if AdjustSigma is true sigma is computed according to the cut-off ratio, otherwise the ratio is adapted to the sigma More...
 
void SetKernel (FilterMask &fm)
 set a new filter mask More...
 
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 SetRatio (const double ratio)
 
void SetSigma (const double si)
 
void SetTreshold (const double th)
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
 ~GaussThreshold ()
 

Static Public Member Functions

static long int GetGlobalDebugLevel ()
 
static void SetGlobalDebugLevel (long int lev)
 

Protected Member Functions

void _CalculateKernels (double Sigma, double Ratio)
 calculates the kernel More...
 
long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
int ConvFloatHori_ (const Image< InputStorageType > &src, Image< CONV_FLOAT > &dst)
 worker function for float separated (horizontal) convolution More...
 
int ConvFloatMat_ (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 worker function for float matrix convolution More...
 
int ConvFloatVert_ (const Image< CONV_FLOAT > &src, Image< OutputStorageType > &dst)
 worker function for float separated (vertical) convolution More...
 
int ConvIntHori_ (const Image< InputStorageType > &src, Image< CONV_INT > &dst)
 worker function for int separated (horizontal) convolution More...
 
int ConvIntMat_ (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 worker function for int matrix convolution More...
 
int ConvIntVert_ (const Image< CONV_INT > &src, Image< OutputStorageType > &dst)
 worker function for int separated (vertical) convolution More...
 
void GetBordersValid_ (int &border_x, int &border_y) const
 

Protected Attributes

int _FilterBorderHandling
 
FilterMask _fm
 the kernel data used for convolution More...
 
Gauss< InputStorageType,
OutputStorageType > * 
_GaussIO
 
Gauss< OutputStorageType,
OutputStorageType > * 
_GaussOO
 to allow for iterated gauss convolution saving the intermediate image we need a different instance, this is caused by template concept More...
 
double _GaussRatio
 minimum ratio of 1D kernel center and border, ignore smaller entries More...
 
double _GaussSigma
 the parameter sigma of gaussian kernel More...
 
double _LastRatio
 
double _LastSigma
 
long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
double _Threshold
 
Image< CONV_FLOAT > _tmpFloat
 temporary memory, needed for separable filters when float filtering More...
 
Image< CONV_INT > _tmpInt
 temporary memory, needed for separable filters when integer filtering More...
 

Static Protected Attributes

static std::ostream _zDebugStream
 
static long int GlobalDebugLevel = 0
 

Detailed Description

template<class InputStorageType, class OutputStorageType>
class BIAS::GaussThreshold< InputStorageType, OutputStorageType >

smoothing with gaussian kernel using a threshold

All pixel values below the trehshold are not concerned for smoothing the image.

Author
cmenk 08/2007

Definition at line 42 of file GaussThreshold.hh.

Member Enumeration Documentation

template<class InputStorageType, class OutputStorageType>
enum BIAS::FilterBase::TBorderHandling
inherited

enum for border calculation, same meanings as in matlab:

  • TBH_valid: returns only the pixels whose values can be computed without using zero padding of the input image. The resulting output image is smaller than the input image. The ROI of the output image is set accordingly.
  • TBH_same: returns the set of pixels that can be computed by applying the filter to all pixels that are actually part of the input image. Border pixels are computed using zero padding, but the center pixel of the computational kernel is applied only to pixels in the image. This results in an output image that is the same size as the input image.
  • TBH_full: returns the full convolution. This means conv2 returns all pixels for which any of the pixels in the computational molecule overlap pixels in the image, even when the center pixel is outside the input image. The resulting output image is larger than the input image. This is not implemented at the moment.
Enumerator
TBH_full 
TBH_same 
TBH_valid 

Definition at line 98 of file FilterBase.hh.

Constructor & Destructor Documentation

template<class InputStorageType , class OutputStorageType >
GaussThreshold::GaussThreshold ( )
template<class InputStorageType , class OutputStorageType >
GaussThreshold::GaussThreshold ( const GaussThreshold< InputStorageType, OutputStorageType > &  other)
template<class StorageType , class KernelType >
GaussThreshold::~GaussThreshold ( )

Definition at line 63 of file GaussThreshold.cpp.

Member Function Documentation

template<class InputStorageType , class OutputStorageType >
void GaussThreshold::_CalculateKernels ( double  Sigma,
double  Ratio 
)
protected

calculates the kernel

Definition at line 94 of file GaussThreshold.cpp.

void BIAS::Debug::AddDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::AddDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 362 of file Debug.hh.

template<class InputStorageType, class OutputStorageType>
bool BIAS::Convolution< InputStorageType, OutputStorageType >::CalculationInFloat ( ) const
inlineinherited

decides if calculation is done in integer or floating point

Definition at line 103 of file Convolution.hh.

template<class InputStorageType, class OutputStorageType>
virtual FilterNToN<InputStorageType, OutputStorageType>* BIAS::Convolution< InputStorageType, OutputStorageType >::Clone ( ) const
inlinevirtualinherited
long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

template<class InputStorageType, class OutputStorageType >
int Convolution::ConvFloatHori_ ( const Image< InputStorageType > &  src,
Image< CONV_FLOAT > &  dst 
)
protectedinherited
template<class InputStorageType, class OutputStorageType>
int Convolution::ConvFloatMat_ ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
protectedinherited
template<class InputStorageType , class OutputStorageType>
int Convolution::ConvFloatVert_ ( const Image< CONV_FLOAT > &  src,
Image< OutputStorageType > &  dst 
)
protectedinherited
template<class InputStorageType, class OutputStorageType >
int Convolution::ConvIntHori_ ( const Image< InputStorageType > &  src,
Image< CONV_INT > &  dst 
)
protectedinherited
template<class InputStorageType, class OutputStorageType>
int Convolution::ConvIntMat_ ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
protectedinherited
template<class InputStorageType , class OutputStorageType>
int Convolution::ConvIntVert_ ( const Image< CONV_INT > &  src,
Image< OutputStorageType > &  dst 
)
protectedinherited
template<class InputStorageType, class OutputStorageType>
void FilterBase::CopyNonROIFromSource ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
) const
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.

Author
koeser 12/2008

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.

bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const
inlineinherited
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const
inlineinherited

Definition at line 350 of file Debug.hh.

template<class InputStorageType , class OutputStorageType >
int GaussThreshold::Filter ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
virtual

sets gauss kernel if params changed and calls convolution or fast grey implementation if possible

Reimplemented from BIAS::Convolution< InputStorageType, OutputStorageType >.

Definition at line 73 of file GaussThreshold.cpp.

References BIAS::ImageConvert::ConvertST(), BIAS::Convolution< InputStorageType, OutputStorageType >::Filter(), BIAS::ImageBase::GetChannelCount(), and BIAS::ImageBase::GetStorageType().

template<class InputStorageType , class OutputStorageType >
int GaussThreshold::Filter7x7GreyIgnoreBelowThreshold ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst,
const double  thresh 
)
template<class InputStorageType , class OutputStorageType >
int GaussThreshold::Filter7x7GreyOnlyBelowThreshold ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst,
const double  thresh 
)
template<class InputStorageType, class OutputStorageType>
int Convolution::FilterFloat ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
virtualinherited
template<class InputStorageType, class OutputStorageType>
int Convolution::FilterInt ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
virtualinherited
template<class InputStorageType, class OutputStorageType>
int BIAS::FilterBase< InputStorageType, OutputStorageType >::GetBorderHandling ( ) const
inlineinherited

Definition at line 129 of file FilterBase.hh.

template<class InputStorageType , class OutputStorageType >
void FilterBase::GetBorders ( int &  border_x,
int &  border_y 
) const
inherited
template<class InputStorageType, class OutputStorageType>
void BIAS::Convolution< InputStorageType, OutputStorageType >::GetBordersValid_ ( int &  border_x,
int &  border_y 
) const
inlineprotectedvirtualinherited
int BIAS::Debug::GetDebugLevel ( ) const
inlineinherited
std::ostream& BIAS::Debug::GetDebugStream ( ) const
inlineinherited

Definition at line 405 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const
inlineinherited

Definition at line 414 of file Debug.hh.

static long int BIAS::Debug::GetGlobalDebugLevel ( )
inlinestaticinherited

Definition at line 431 of file Debug.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::Convolution< InputStorageType, OutputStorageType >::GetKernel ( FilterMask fm) const
inlineinherited

get the current filter mask

Definition at line 92 of file Convolution.hh.

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GetRatio ( ) const
inline

Definition at line 83 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GetRatio ( )
inline

Definition at line 104 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GetSigma ( ) const
inline

Definition at line 79 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GetSigma ( )
inline

Definition at line 103 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GetTreshold ( ) const
inline

Definition at line 75 of file GaussThreshold.hh.

long int BIAS::Debug::Name2DebugLevel ( const std::string &  name) const
inlineinherited

looks up a debuglevel in the internal map, returns 0 if not found

Author
woelk 09/2006

Definition at line 454 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name)
inlineinherited
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

Definition at line 383 of file Debug.hh.

template<class InputStorageType , class OutputStorageType >
void Convolution::PrintKernel ( ) const
inherited

prints the used filter mask, for debugging

Definition at line 583 of file Convolution.cpp.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv)
inlineinherited

Definition at line 369 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 376 of file Debug.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::FilterBase< InputStorageType, OutputStorageType >::SetBorderHandling ( const int  bh)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 325 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os)
inlineinherited

Definition at line 398 of file Debug.hh.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev)
inlinestaticinherited

Definition at line 424 of file Debug.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::GaussThreshold< InputStorageType, OutputStorageType >::SetHalfWinSize ( const int  hws,
bool  AdjustSigma = true 
)
inline

define the half win size of the kernel, if AdjustSigma is true sigma is computed according to the cut-off ratio, otherwise the ratio is adapted to the sigma

Definition at line 88 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::Convolution< InputStorageType, OutputStorageType >::SetKernel ( FilterMask fm)
inlineinherited

set a new filter mask

Definition at line 96 of file Convolution.hh.

template<class InputStorageType , class OutputStorageType>
void FilterBase::SetNonROIToValue ( Image< OutputStorageType > &  dst,
const std::vector< OutputStorageType > &  t 
) const
inherited

run over all pixel which do not belong to the roi and set them to some value (typically black)

Author
koeser 12/2008

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.

template<class InputStorageType, class OutputStorageType>
void BIAS::GaussThreshold< InputStorageType, OutputStorageType >::SetRatio ( const double  ratio)
inline

Definition at line 81 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::GaussThreshold< InputStorageType, OutputStorageType >::SetSigma ( const double  si)
inline

Definition at line 77 of file GaussThreshold.hh.

template<class InputStorageType, class OutputStorageType>
void BIAS::GaussThreshold< InputStorageType, OutputStorageType >::SetTreshold ( const double  th)
inline

Definition at line 73 of file GaussThreshold.hh.

void BIAS::Debug::ShowDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

prints all internally known debuglevels

Author
woelk 09/2006

Definition at line 496 of file Debug.hh.

Member Data Documentation

template<class InputStorageType, class OutputStorageType>
int BIAS::FilterBase< InputStorageType, OutputStorageType >::_FilterBorderHandling
protectedinherited
template<class InputStorageType, class OutputStorageType>
FilterMask BIAS::Convolution< InputStorageType, OutputStorageType >::_fm
protectedinherited

the kernel data used for convolution

Definition at line 107 of file Convolution.hh.

Referenced by BIAS::Convolution< InputStorageType, OutputStorageType >::Convolution().

template<class InputStorageType, class OutputStorageType>
Gauss<InputStorageType, OutputStorageType>* BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_GaussIO
protected
template<class InputStorageType, class OutputStorageType>
Gauss<OutputStorageType, OutputStorageType>* BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_GaussOO
protected

to allow for iterated gauss convolution saving the intermediate image we need a different instance, this is caused by template concept

Definition at line 128 of file GaussThreshold.hh.

Referenced by BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GaussThreshold().

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_GaussRatio
protected

minimum ratio of 1D kernel center and border, ignore smaller entries

Definition at line 112 of file GaussThreshold.hh.

Referenced by BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GaussThreshold().

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_GaussSigma
protected

the parameter sigma of gaussian kernel

Definition at line 104 of file GaussThreshold.hh.

Referenced by BIAS::GaussThreshold< InputStorageType, OutputStorageType >::GaussThreshold().

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_LastRatio
protected
template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_LastSigma
protected
long int BIAS::Debug::_liDebugLevel
protectedinherited

Definition at line 510 of file Debug.hh.

Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().

long int BIAS::Debug::_liNextDebugLevel
protectedinherited

new concept, debuglevel are managed here in the debug class

Definition at line 516 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

template<class InputStorageType, class OutputStorageType>
double BIAS::GaussThreshold< InputStorageType, OutputStorageType >::_Threshold
protected
template<class InputStorageType, class OutputStorageType>
Image<CONV_FLOAT> BIAS::Convolution< InputStorageType, OutputStorageType >::_tmpFloat
protectedinherited

temporary memory, needed for separable filters when float filtering

Definition at line 114 of file Convolution.hh.

template<class InputStorageType, class OutputStorageType>
Image<CONV_INT> BIAS::Convolution< InputStorageType, OutputStorageType >::_tmpInt
protectedinherited

temporary memory, needed for separable filters when integer filtering

Definition at line 117 of file Convolution.hh.

std::ostream BIAS::Debug::_zDebugStream
staticprotectedinherited

Definition at line 511 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

long int BIAS::Debug::GlobalDebugLevel = 0
staticprotectedinherited

Definition at line 513 of file Debug.hh.


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