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::GradientSobel3x3< InputStorageType, OutputStorageType > Class Template Reference

gradient calculation with sobel 3 by 3 masks More...

#include <Filter/GradientSobel3x3.hh>

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

Public Types

enum  EVecLengthType { VLT_L1, VLT_L2, VLT_max }
 algorithm used to calculate the absolute length of the 2D vector More...
 
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 FilterNTo2N
< 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 > &grad)
 returns a 2 channel image containing gx and gy More...
 
virtual int Filter (const Image< InputStorageType > &src, Image< OutputStorageType > &gx, Image< OutputStorageType > &gy)
 dstX.GetChannelCount()==src.GetCHannelCount() More...
 
virtual int Filter (const Image< InputStorageType > &src, Image< OutputStorageType > &gx, Image< OutputStorageType > &gy, Image< OutputStorageType > &absg)
 
virtual int FilterFloat (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 
virtual int FilterFloat (const Image< InputStorageType > &src, Image< OutputStorageType > &dst1, Image< OutputStorageType > &dst2)
 
virtual int FilterInt (const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
 
virtual int FilterInt (const Image< InputStorageType > &src, Image< OutputStorageType > &dst1, Image< OutputStorageType > &dst2)
 
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
 
 GradientSobel3x3 ()
 
 GradientSobel3x3 (const GradientSobel3x3< 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 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 ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
int VecLen (const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
 decides which vector length to use from *_VecLenthType More...
 
int VecLenL1 (const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
 length = | fabs(gx) + fabs(gy) | destination absg must be initialized More...
 
int VecLenL2 (const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
 length = sqrt(gx*gx+gy*gy) destination absg must be initialized More...
 
int VecLenMax (const Image< OutputStorageType > &gx, const Image< OutputStorageType > &gy, Image< OutputStorageType > &length)
 length = max(fabs(gx),fabs(gy)) destination absg must be initialized More...
 
virtual ~GradientSobel3x3 ()
 

Static Public Member Functions

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

Protected Member Functions

void _AllocInternalMem (const int width, const int height)
 deletes _work1 and _work2 and sets _InternalMemSize More...
 
void _DeleteInternalMem ()
 
long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
virtual void GetBordersValid_ (int &border_x, int &border_y) const
 
void InitKernel_ ()
 sets the sobel kernel for the convolution object More...
 
void ShrinkROI_ (ROI *roi) const
 
int Sobel3x3GreySameFloat_ (const Image< InputStorageType > &src, Image< OutputStorageType > &gWE, Image< OutputStorageType > &gNS)
 Repeats the border pixel infinitly in direction perpendicular to the border to achieve destination image ROIs of same size as source image ROIs. More...
 
int Sobel3x3GreyValidFloat_ (const Image< InputStorageType > &src, Image< OutputStorageType > &gWE, Image< OutputStorageType > &gNS)
 uses CONV_FLOAT for calculation More...
 
int Sobel3x3GreyValidInt_ (const Image< InputStorageType > &src, Image< OutputStorageType > &gWE, Image< OutputStorageType > &gNS)
 uses CONV_INT for calculation More...
 

Protected Attributes

Convolution< InputStorageType,
OutputStorageType > 
_Conv
 computation object to execute the convolution More...
 
int _FilterBorderHandling
 
CONV_FLOAT ** _fwork
 
CONV_FLOAT ** _fwork2
 
int _InternalMemHeight
 
int _InternalMemWidth
 
CONV_INT ** _iwork
 
CONV_INT ** _iwork2
 
long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
int _VecLengthType
 of type Gradient<InputStorageType, OutputStorageType>::EVecLengthType More...
 

Static Protected Attributes

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

Detailed Description

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

gradient calculation with sobel 3 by 3 masks

calculates the gradient using the sobel operators
-1 0 1 -1 -2 -1 WE: -2 0 2 NS: 0 0 0 -1 0 1 1 2 1

They can be separated into:

WE: vh = (-1, 0, 1) and vv = (1, 2, 1)^T

NS: vh = (1, 2, 1) and vv = (-1, 0, 1)^T

Author
woelk 09/2004
Examples:
ExampleGradient.cpp, ExampleLineMatcher.cpp, ExampleRefineContour.cpp, and ExampleTrackerBase.cpp.

Definition at line 54 of file GradientSobel3x3.hh.

Member Enumeration Documentation

template<class InputStorageType, class OutputStorageType>
enum BIAS::FilterNTo2N::EVecLengthType
inherited

algorithm used to calculate the absolute length of the 2D vector

  • VLT_L1: | fabs(gx) + fabs(gy) |
  • VLT_L2: sqrt(gx*gx+gy*gy)
  • VLT_max: max(fabs(gx), fabs(gy))
Enumerator
VLT_L1 
VLT_L2 
VLT_max 

Definition at line 52 of file FilterNTo2N.hh.

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 >
GradientSobel3x3::GradientSobel3x3 ( )
template<class InputStorageType, class OutputStorageType>
GradientSobel3x3::GradientSobel3x3 ( const GradientSobel3x3< InputStorageType, OutputStorageType > &  other)

Definition at line 68 of file GradientSobel3x3.cpp.

template<class InputStorageType , class OutputStorageType >
GradientSobel3x3::~GradientSobel3x3 ( )
virtual

Definition at line 78 of file GradientSobel3x3.cpp.

Member Function Documentation

template<class InputStorageType , class OutputStorageType >
void GradientSobel3x3::_AllocInternalMem ( const int  width,
const int  height 
)
protected

deletes _work1 and _work2 and sets _InternalMemSize

Definition at line 579 of file GradientSobel3x3.cpp.

template<class InputStorageType , class OutputStorageType >
void GradientSobel3x3::_DeleteInternalMem ( )
protected

Definition at line 556 of file GradientSobel3x3.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>
virtual FilterNTo2N<InputStorageType, OutputStorageType>* BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::Clone ( ) const
inlinevirtual
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>
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 GradientSobel3x3::Filter ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  grad 
)
virtual

returns a 2 channel image containing gx and gy

Author
woelk 12/2004, untested

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

Definition at line 86 of file GradientSobel3x3.cpp.

References BIAS::Image< StorageType >::AppendChannel().

Referenced by BIAS::ContourDetectorBSpline< StorageType >::GetFeatImage_().

template<class InputStorageType, class OutputStorageType>
int GradientSobel3x3::Filter ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst1,
Image< OutputStorageType > &  dst2 
)
virtual
template<class InputStorageType, class OutputStorageType>
int GradientSobel3x3::Filter ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  gx,
Image< OutputStorageType > &  gy,
Image< OutputStorageType > &  absg 
)
virtual
template<class InputStorageType, class OutputStorageType>
int FilterNTo2N::FilterFloat ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
virtualinherited

Definition at line 74 of file FilterNTo2N.cpp.

template<class InputStorageType, class OutputStorageType>
int FilterNTo2N::FilterFloat ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst1,
Image< OutputStorageType > &  dst2 
)
virtualinherited

Definition at line 100 of file FilterNTo2N.cpp.

template<class InputStorageType, class OutputStorageType>
int FilterNTo2N::FilterInt ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst 
)
virtualinherited

Definition at line 66 of file FilterNTo2N.cpp.

template<class InputStorageType, class OutputStorageType>
int FilterNTo2N::FilterInt ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  dst1,
Image< OutputStorageType > &  dst2 
)
virtualinherited

Definition at line 91 of file FilterNTo2N.cpp.

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 GradientSobel3x3::GetBordersValid_ ( int &  border_x,
int &  border_y 
) const
protectedvirtual
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 GradientSobel3x3::InitKernel_ ( )
protected

sets the sobel kernel for the convolution object

Definition at line 37 of file GradientSobel3x3.cpp.

References BIAS::FilterMask::CreateFloatFilter().

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

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.

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 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.

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.

template<class InputStorageType , class OutputStorageType >
void GradientSobel3x3::ShrinkROI_ ( ROI roi) const
protected
template<class InputStorageType, class OutputStorageType>
int GradientSobel3x3::Sobel3x3GreySameFloat_ ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  gWE,
Image< OutputStorageType > &  gNS 
)
protected

Repeats the border pixel infinitly in direction perpendicular to the border to achieve destination image ROIs of same size as source image ROIs.

Untested !!

Author
woelk 07/2005

Definition at line 296 of file GradientSobel3x3.cpp.

References BIAS::ROI::GetCorners(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), and BIAS::ROI::SetCorners().

template<class InputStorageType, class OutputStorageType>
int GradientSobel3x3::Sobel3x3GreyValidFloat_ ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  gWE,
Image< OutputStorageType > &  gNS 
)
protected
template<class InputStorageType, class OutputStorageType>
int GradientSobel3x3::Sobel3x3GreyValidInt_ ( const Image< InputStorageType > &  src,
Image< OutputStorageType > &  gWE,
Image< OutputStorageType > &  gNS 
)
protected
template<class InputStorageType , class OutputStorageType>
int FilterNTo2N::VecLen ( const Image< OutputStorageType > &  gx,
const Image< OutputStorageType > &  gy,
Image< OutputStorageType > &  length 
)
inherited

decides which vector length to use from *_VecLenthType

Author
woelk 12/2004

Definition at line 114 of file FilterNTo2N.cpp.

template<class InputStorageType , class OutputStorageType>
int FilterNTo2N::VecLenL1 ( const Image< OutputStorageType > &  gx,
const Image< OutputStorageType > &  gy,
Image< OutputStorageType > &  length 
)
inherited

length = | fabs(gx) + fabs(gy) | destination absg must be initialized

Author
woelk 09/2004

Definition at line 140 of file FilterNTo2N.cpp.

References BIAS::ROI::GetCorners(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), and BIAS::ROI::SetCorners().

template<class InputStorageType , class OutputStorageType>
int FilterNTo2N::VecLenL2 ( const Image< OutputStorageType > &  gx,
const Image< OutputStorageType > &  gy,
Image< OutputStorageType > &  length 
)
inherited

length = sqrt(gx*gx+gy*gy) destination absg must be initialized

Author
woelk 09/2004

Definition at line 172 of file FilterNTo2N.cpp.

References BIAS::ROI::GetCorners(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), and BIAS::ROI::SetCorners().

template<class InputStorageType , class OutputStorageType>
int FilterNTo2N::VecLenMax ( const Image< OutputStorageType > &  gx,
const Image< OutputStorageType > &  gy,
Image< OutputStorageType > &  length 
)
inherited

length = max(fabs(gx),fabs(gy)) destination absg must be initialized

Author
woelk 09/2004

Definition at line 205 of file FilterNTo2N.cpp.

References BIAS::ROI::GetCorners(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), and BIAS::ROI::SetCorners().

Member Data Documentation

template<class InputStorageType, class OutputStorageType>
Convolution<InputStorageType, OutputStorageType> BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_Conv
protected

computation object to execute the convolution

Definition at line 84 of file GradientSobel3x3.hh.

template<class InputStorageType, class OutputStorageType>
int BIAS::FilterBase< InputStorageType, OutputStorageType >::_FilterBorderHandling
protectedinherited
template<class InputStorageType, class OutputStorageType>
CONV_FLOAT** BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_fwork
protected
template<class InputStorageType, class OutputStorageType>
CONV_FLOAT ** BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_fwork2
protected
template<class InputStorageType, class OutputStorageType>
int BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_InternalMemHeight
protected
template<class InputStorageType, class OutputStorageType>
int BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_InternalMemWidth
protected
template<class InputStorageType, class OutputStorageType>
CONV_INT** BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_iwork
protected
template<class InputStorageType, class OutputStorageType>
CONV_INT ** BIAS::GradientSobel3x3< InputStorageType, OutputStorageType >::_iwork2
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>
int BIAS::FilterNTo2N< InputStorageType, OutputStorageType >::_VecLengthType
protectedinherited

of type Gradient<InputStorageType, OutputStorageType>::EVecLengthType

Definition at line 107 of file FilterNTo2N.hh.

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

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: