Basic Image AlgorithmS Library
2.8.0
|
A filter mask (or a kernel) used for convolution. More...
#include <Filter/FilterMask.hh>
Public Member Functions | |
void | AddDebugLevel (const long int lv) |
void | AddDebugLevel (const std::string &name) |
int | ComputeIntPrecisionBits (int NumberOfBitsInInputData, int NumberOfBitsInTempData) |
compute the number of shiftable bits for int-from-float mask More... | |
void | CreateFloatFilter () |
create the float filter from the int filter More... | |
void | CreateIntFilter (int rshift, int rshifth, int rshiftv) |
create the int filter from the float filter More... | |
bool | DebugLevelIsSet (const long int lv) const |
bool | DebugLevelIsSet (const std::string &name) const |
FilterMask () | |
FilterMask (const FilterMask &mask) | |
calls operator= More... | |
FilterMask (const Matrix< FM_INT > &kernel, int rs, bool ResetOtherType=FM_RESET_OTHER) | |
calls Init More... | |
FilterMask (const Matrix< FM_FLOAT > &kernel, bool ResetOtherType=FM_RESET_OTHER) | |
calls Init More... | |
FilterMask (const Vector< FM_INT > &horz, const Vector< FM_INT > &vert, int hrs, int vrs, bool ResetOtherType=FM_RESET_OTHER) | |
calls Init More... | |
FilterMask (const Vector< FM_FLOAT > &horz, const Vector< FM_FLOAT > &vert, bool ResetOtherType=FM_RESET_OTHER) | |
calls Init More... | |
int | GetDebugLevel () const |
std::ostream & | GetDebugStream () const |
void | GetDebugStream (std::ostream &os) const |
int | GetHorizRightShift () const |
if separable, returns right shift after separated horizontal int filtering More... | |
const Matrix< FM_FLOAT > * | GetKernelf () const |
returns pointer to float filter mask More... | |
const Matrix< FM_INT > * | GetKerneli () const |
returns pointer to int filter mask More... | |
int | GetKernelRightShift () const |
returns right shift applied to data after int mask filtering More... | |
const Vector< FM_FLOAT > * | GetSepfh () const |
returns pointer to horiz float vector for sep. More... | |
const Vector< FM_FLOAT > * | GetSepfv () const |
returns pointer to vertical float vector for sep. More... | |
const Vector< FM_INT > * | GetSepih () const |
returns pointer to horizontal int vector for sep. More... | |
const Vector< FM_INT > * | GetSepiv () const |
returns pointer to vertical int vector for sep. More... | |
void | GetSize (int &hor, int &vert) const |
returns the size of the Kernel More... | |
int | GetVertRightShift () const |
if separable, returns right shift after separated vertical int filtering More... | |
void | Init (const Matrix< FM_INT > &kernel, int rs, bool ResetOtherType=FM_RESET_OTHER) |
sets _sKernel and also _fKernel. More... | |
void | Init (const Matrix< FM_FLOAT > &kernel, bool ResetOtherType=FM_RESET_OTHER) |
sets _fKernel and also calculates the best int approximation int _sKernel. More... | |
void | Init (const Vector< FM_INT > &horz, const Vector< FM_INT > &vert, int hrs, int vrs, bool ResetOtherType=FM_RESET_OTHER) |
sets horz and vert vectors and their right shifts, _Separable is true, FM_FLOAT vectors are updated also More... | |
void | Init (const Vector< FM_FLOAT > &horz, const Vector< FM_FLOAT > &vert, bool ResetOtherType=FM_RESET_OTHER) |
sets horz and vert vectors, _Separable is true, integer vectors are updated also More... | |
bool | IsSeparable () const |
checks if the kernel is separable More... | |
bool | IsSize1x1 () |
returns true if size is 1 by one More... | |
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... | |
FilterMask & | operator= (const FilterMask &src) |
copy operator, copies ALL components More... | |
void | PrintDebugLevel (std::ostream &os=std::cout) const |
void | RemoveDebugLevel (const long int lv) |
void | RemoveDebugLevel (const std::string &name) |
void | ResetFloatFilter () |
fill float filter with zeros, same dim as int filter More... | |
void | ResetIntFilter () |
fill int filter with zeros, same dim as float filter More... | |
void | SetDebugLevel (const long int lv) |
void | SetDebugLevel (const std::string &name) |
void | SetDebugStream (const std::ostream &os) |
void | SetZero () |
reset data, all kernel to zero, separable to false More... | |
void | ShowDebugLevel (std::ostream &os=std::cout) const |
prints all internally known debuglevels More... | |
void | Transpose () |
transposes the kernel (and adapts all dependent data) More... | |
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... | |
Protected Attributes | |
Vector< FM_FLOAT > | _fHoriz |
the filter mask in separated representation (floating point) More... | |
Matrix< FM_FLOAT > | _fKernel |
the filter mask if we have a floating type convolution More... | |
Vector< FM_FLOAT > | _fVert |
int | _HorizRightShift |
int | _KernelRightShift |
the shifts used for the integer filter masks More... | |
long int | _liDebugLevel |
long int | _liNextDebugLevel |
new concept, debuglevel are managed here in the debug class More... | |
bool | _Separable |
flag indicating if the 2 vectors or the matrix should be used as kernel representation More... | |
Vector< FM_INT > | _sHoriz |
the filter mask in separated representation (integer) More... | |
Matrix< FM_INT > | _sKernel |
the filter mask if we have a integer type convolution More... | |
std::map< std::string, long int > | _String2Debuglevel |
Vector< FM_INT > | _sVert |
int | _VertRightShift |
Static Protected Attributes | |
static std::ostream | _zDebugStream |
static long int | GlobalDebugLevel = 0 |
Friends | |
BIASFilter_EXPORT std::ostream & | operator<< (std::ostream &os, const FilterMask &fm) |
A filter mask (or a kernel) used for convolution.
When convolving an image with a FilterMask f, that mask is at first reflected at its symmetry center. Afterwards for each pixel x a weighted (by the entries of f) sum of the pixels around x is computed and written into the output image. In case of integer filtering, the result is shifted by the appropriate right shift.
You can define a filter mask by specifying either the float values or the int values and computing the other type. You may also set both manually, set the initalltypes flag to false for that. If your filtermask is separable you have to call the vector-init to define that.
Definition at line 61 of file FilterMask.hh.
FilterMask::FilterMask | ( | ) |
Definition at line 32 of file FilterMask.cpp.
|
inline |
calls operator=
Definition at line 68 of file FilterMask.hh.
|
inline |
calls Init
ResetOtherType | if true, sets other filter entries to zero |
Definition at line 73 of file FilterMask.hh.
|
inline |
calls Init
Definition at line 78 of file FilterMask.hh.
|
inline |
calls Init
Definition at line 83 of file FilterMask.hh.
|
inline |
calls Init
Definition at line 88 of file FilterMask.hh.
|
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 |
int FilterMask::ComputeIntPrecisionBits | ( | int | NumberOfBitsInInputData, |
int | NumberOfBitsInTempData | ||
) |
compute the number of shiftable bits for int-from-float mask
When you compute an int approximation of the float mask, you must avoid overflow. The weighted sum of the convolution is stored in the type CONV_INT, e.g. int, which means 31 bit range. The input data has typically 8 bit, so depending on the norm of the float filter mask, say 1.0 in this example, we can approximate a 0.3 entry in the float mask by and int entry = 0.3*(1<<(31-8))). This function computes the maximum possible shift.
NumberOfBitsInInputData | typically sizeof(InputImageType)*8 |
NumberOfBitsInTempData | typically sizeof(CONV_INT)*8-1 |
Definition at line 211 of file FilterMask.cpp.
Referenced by BIAS::GradientGaussAsymmetric< InputStorageType, OutputStorageType >::_CalculateKernels(), BIAS::HessianGauss< InputStorageType, OutputStorageType >::_CalculateKernels(), and BIAS::GradientGauss< InputStorageType, OutputStorageType >::_CalculateKernels().
|
inlineprotectedinherited |
void FilterMask::CreateFloatFilter | ( | ) |
create the float filter from the int filter
Definition at line 91 of file FilterMask.cpp.
Referenced by BIAS::HessianSimple< InputStorageType, OutputStorageType >::InitKernel_(), BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::InitKernel_(), and BIAS::GradientSimple< InputStorageType, OutputStorageType >::InitKernel_().
void FilterMask::CreateIntFilter | ( | int | rshift, |
int | rshifth, | ||
int | rshiftv | ||
) |
create the int filter from the float filter
Definition at line 113 of file FilterMask.cpp.
Referenced by BIAS::GradientGaussAsymmetric< InputStorageType, OutputStorageType >::_CalculateKernels(), BIAS::HessianGauss< InputStorageType, OutputStorageType >::_CalculateKernels(), and BIAS::GradientGauss< InputStorageType, OutputStorageType >::_CalculateKernels().
|
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 |
|
inlineinherited |
Definition at line 332 of file Debug.hh.
Referenced by BIAS::listenthread(), BIAS::Image< StorageType >::operator=(), and BIAS::ImageBase::operator=().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inline |
if separable, returns right shift after separated horizontal int filtering
Definition at line 148 of file FilterMask.hh.
|
inline |
returns pointer to float filter mask
Definition at line 116 of file FilterMask.hh.
Referenced by BIAS::TrackerBaseInterface< StorageType >::ComputeMaskSum(), BIAS::TrackerBaseInterface< StorageType >::Filter_ByMask(), BIAS::TrackerBaseInterface< StorageType >::FilterLowpass_ByMask(), and BIAS::TrackerBaseInterface< StorageType >::Init().
|
inline |
returns pointer to int filter mask
Definition at line 112 of file FilterMask.hh.
|
inline |
returns right shift applied to data after int mask filtering
Definition at line 143 of file FilterMask.hh.
|
inline |
returns pointer to horiz float vector for sep.
filtering
Definition at line 128 of file FilterMask.hh.
Referenced by BIAS::TrackerBaseInterface< StorageType >::ComputeMaskSum(), BIAS::TrackerBaseInterface< StorageType >::Filter_BySeparableMask(), BIAS::TrackerBaseInterface< StorageType >::FilterLowpass_BySeparableMask(), and BIAS::TrackerBaseInterface< StorageType >::Init().
|
inline |
returns pointer to vertical float vector for sep.
filtering
Definition at line 132 of file FilterMask.hh.
Referenced by BIAS::TrackerBaseInterface< StorageType >::ComputeMaskSum(), BIAS::TrackerBaseInterface< StorageType >::Filter_BySeparableMask(), BIAS::TrackerBaseInterface< StorageType >::FilterLowpass_BySeparableMask(), and BIAS::TrackerBaseInterface< StorageType >::Init().
|
inline |
returns pointer to horizontal int vector for sep.
filtering
Definition at line 120 of file FilterMask.hh.
|
inline |
returns pointer to vertical int vector for sep.
filtering
Definition at line 124 of file FilterMask.hh.
|
inline |
returns the size of the Kernel
Definition at line 201 of file FilterMask.hh.
|
inline |
if separable, returns right shift after separated vertical int filtering
Definition at line 153 of file FilterMask.hh.
void FilterMask::Init | ( | const Matrix< FM_INT > & | kernel, |
int | rs, | ||
bool | ResetOtherType = FM_RESET_OTHER |
||
) |
sets _sKernel and also _fKernel.
_Separable is set to false
Definition at line 37 of file FilterMask.cpp.
Referenced by BIAS::Tracker< StorageType, CalculationType >::Vector2FilterMask_().
void FilterMask::Init | ( | const Matrix< FM_FLOAT > & | kernel, |
bool | ResetOtherType = FM_RESET_OTHER |
||
) |
sets _fKernel and also calculates the best int approximation int _sKernel.
_Separable is set to false.
Definition at line 47 of file FilterMask.cpp.
void FilterMask::Init | ( | const Vector< FM_INT > & | horz, |
const Vector< FM_INT > & | vert, | ||
int | hrs, | ||
int | vrs, | ||
bool | ResetOtherType = FM_RESET_OTHER |
||
) |
sets horz and vert vectors and their right shifts, _Separable is true, FM_FLOAT vectors are updated also
Definition at line 54 of file FilterMask.cpp.
void FilterMask::Init | ( | const Vector< FM_FLOAT > & | horz, |
const Vector< FM_FLOAT > & | vert, | ||
bool | ResetOtherType = FM_RESET_OTHER |
||
) |
sets horz and vert vectors, _Separable is true, integer vectors are updated also
Definition at line 65 of file FilterMask.cpp.
|
inline |
checks if the kernel is separable
Definition at line 136 of file FilterMask.hh.
Referenced by BIAS::TrackerBaseInterface< StorageType >::ComputeMaskSum(), BIAS::TrackerBaseInterface< StorageType >::Filter_ByMask(), BIAS::TrackerBaseInterface< StorageType >::Filter_BySeparableMask(), BIAS::TrackerBaseInterface< StorageType >::FilterLowpass_ByMask(), BIAS::TrackerBaseInterface< StorageType >::FilterLowpass_BySeparableMask(), and BIAS::TrackerBaseInterface< StorageType >::Init().
|
inline |
returns true if size is 1 by one
Definition at line 196 of file FilterMask.hh.
|
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().
FilterMask & FilterMask::operator= | ( | const FilterMask & | src | ) |
copy operator, copies ALL components
Definition at line 75 of file FilterMask.cpp.
References _fHoriz, _fKernel, _fVert, _HorizRightShift, _KernelRightShift, _Separable, _sHoriz, _sKernel, _sVert, and _VertRightShift.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
void FilterMask::ResetFloatFilter | ( | ) |
fill float filter with zeros, same dim as int filter
Definition at line 152 of file FilterMask.cpp.
void FilterMask::ResetIntFilter | ( | ) |
fill int filter with zeros, same dim as float filter
Definition at line 171 of file FilterMask.cpp.
|
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 |
reset data, all kernel to zero, separable to false
Definition at line 187 of file FilterMask.hh.
Referenced by BIAS::Convolution< InputStorageType, OutputStorageType >::Convolution().
|
inlineinherited |
void FilterMask::Transpose | ( | ) |
transposes the kernel (and adapts all dependent data)
Definition at line 197 of file FilterMask.cpp.
Referenced by BIAS::GradientGauss< InputStorageType, OutputStorageType >::Filter(), and BIAS::GradientGaussAsymmetric< InputStorageType, OutputStorageType >::Filter().
|
friend |
|
protected |
the filter mask in separated representation (floating point)
Definition at line 214 of file FilterMask.hh.
Referenced by operator=().
|
protected |
the filter mask if we have a floating type convolution
Definition at line 210 of file FilterMask.hh.
Referenced by operator=().
|
protected |
Definition at line 214 of file FilterMask.hh.
Referenced by operator=().
|
protected |
Definition at line 219 of file FilterMask.hh.
Referenced by operator=().
|
protected |
the shifts used for the integer filter masks
Definition at line 219 of file FilterMask.hh.
Referenced by operator=().
|
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 |
flag indicating if the 2 vectors or the matrix should be used as kernel representation
Definition at line 217 of file FilterMask.hh.
Referenced by operator=().
|
protected |
the filter mask in separated representation (integer)
Definition at line 212 of file FilterMask.hh.
Referenced by operator=().
|
protected |
the filter mask if we have a integer type convolution
Definition at line 208 of file FilterMask.hh.
Referenced by operator=().
|
protectedinherited |
Definition at line 517 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
Definition at line 212 of file FilterMask.hh.
Referenced by operator=().
|
protected |
Definition at line 219 of file FilterMask.hh.
Referenced by operator=().
|
staticprotectedinherited |
Definition at line 511 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |