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

Class for holding multiple downsampled images. More...

#include <Gui/ImageCanvas.hh>

+ Inheritance diagram for BIAS::PyramidImage< T >:
+ Collaboration diagram for BIAS::PyramidImage< T >:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
void Clear ()
 
void clear ()
 
int CreateAdditionalLayer (unsigned int numnewLayers=1, unsigned int minImageWidth=32)
 resizes this and fills correctly with smaller images More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
int Downsample ()
 downsamples from (*this)[0] assumes that all pointers e.g. More...
 
void Dump (std::ostream &os=std::cout) const
 
bool empty () const
 deprecated interface More...
 
int GetAnisotropicImageValue (const double &xsource, const double &ysource, const Matrix2x2< double > &Cov, double &T, unsigned int channel=0) const
 computes (Gaussian) expectation value across a region, used e.g. More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
const std::vector< double > & GetFactors () const
 
std::vector< double > GetFactors ()
 
double GetImageValue (const double &x, const double &y, unsigned int scale, int channel=0) const
 bilinear value from scale space: (x,y) is position in pyramid[0], 0<=scale<=size()-1 is pyramid level More...
 
double GetPositionOffset () const
 
unsigned GetPyramidSize () const
 deprecated interface More...
 
double GetRescaleFactor () const
 
void GetSingleImage (Image< StorageType > &im) const
 returns a single image containing all pyramid images More...
 
int GetTrilinearImageValue (const double &x, const double &y, const double &scale, double &T, int channel=0) const
 trilinear value from scale space: (x,y) is position in pyramid[0], 0<=scale<=size()-1 is pyramid level More...
 
void Init (const Image< StorageType > &image, const unsigned py_size=0)
 copy image into level 0 and create other levels according to parameters set so far (pyramidsize, filter,...) More...
 
void Init (const unsigned int width, const unsigned int height, const unsigned int channelcount, const unsigned py_size)
 
void Init (const unsigned pyramid_size)
 initializes with empty images More...
 
void InitFromImageBase (const ImageBase &image, const unsigned py_size=0)
 same as Init(Image) but can use different ST, e.g. More...
 
bool IsEmpty () const
 
bool IsInROI (double x, double y, int layer) 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...
 
PyramidImage< StorageType > & operator= (const PyramidImage< StorageType > &pim)
 deep copy assignement More...
 
SharedPtr< Image< StorageType > > & operator[] (const unsigned index)
 element access More...
 
SharedPtr< const Image
< StorageType > > 
operator[] (const unsigned index) const
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
 PyramidImage ()
 
 PyramidImage (const PyramidImage< StorageType > &pim)
 
 PyramidImage (const double factor, const std::vector< SharedPtr< Image< StorageType > > > &imgs)
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
virtual void resize (const unsigned size)
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
void SetLowPassFilter (const FilterNToN< StorageType, StorageType > &filter)
 
void SetLowPassType (int lpt)
 
void SetRescaleFactor (const double factor)
 
int SetROI (unsigned minx, unsigned miny, unsigned maxx, unsigned maxy)
 set the ROI for all images More...
 
int SetROI (const ROI &roi)
 set the ROI for all images from original ROI from Img More...
 
void SetUID (BIAS::UUID uid)
 
void SetZero ()
 sets all pixels in all images to zero More...
 
virtual PyramidImageInterface
< StorageType > * 
ShallowClone () const
 create a shallow clone More...
 
PyramidImage< StorageType > & ShallowCopy (const PyramidImage< StorageType > &pim)
 sets this as shallow copy of pim More...
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
unsigned size () const
 deprecated interface More...
 
unsigned Size () const
 
int WriteImages (const std::string &prefix) const
 writes a file in mip format per pyramid level using prefix More...
 
 ~PyramidImage ()
 

Static Public Member Functions

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

Protected Member Functions

void _CreateLevels ()
 creates the levels by downsampling from (*this)[0] More...
 
long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
virtual void push_back (SharedPtr< Image< StorageType > > img)
 

Protected Attributes

std::vector< SharedPtr< Image
< StorageType > > > 
_Images
 
long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
double _PositionOffset
 Offset which needs to be used when transferring point locations between pyramid levels: More...
 
Rescale< StorageType, StorageType > _rescale
 
double _RescaleFactor
 
std::map< std::string, long int > _String2Debuglevel
 
std::vector< double > _vFactor
 

Static Protected Attributes

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

Detailed Description

template<class T>
class BIAS::PyramidImage< T >

Class for holding multiple downsampled images.

Represent a pyramid image, i.e. multiple downsampled images. The image with index 0 has the original size, while each (i+1)-th image has half the size of the i-th image.

Note
Pointers to the images are held in this class.
Author
woelk 09/2004
Examples:
ExampleTracker.cpp.

Definition at line 30 of file ImageCanvas.hh.

Constructor & Destructor Documentation

template<class T>
BIAS::PyramidImage< T >::PyramidImage ( )
template<class T>
BIAS::PyramidImage< T >::PyramidImage ( const PyramidImage< StorageType > &  pim)
template<class T>
BIAS::PyramidImage< T >::PyramidImage ( const double  factor,
const std::vector< SharedPtr< Image< StorageType > > > &  imgs 
)
template<class T>
BIAS::PyramidImage< T >::~PyramidImage ( )

Member Function Documentation

template<class T>
void BIAS::PyramidImage< T >::_CreateLevels ( )
protected

creates the levels by downsampling from (*this)[0]

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 T>
void BIAS::PyramidImage< T >::Clear ( )
virtual
template<class T>
void BIAS::PyramidImage< T >::clear ( )
inline

Definition at line 88 of file PyramidImage.hh.

Referenced by BIAS::PyramidImage< StorageType >::Clear().

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

template<class T>
int BIAS::PyramidImage< T >::CreateAdditionalLayer ( unsigned int  numnewLayers = 1,
unsigned int  minImageWidth = 32 
)

resizes this and fills correctly with smaller images

Make sure that you do not change the filter type between initial pyramid creation and the call to this function, otherwise the global scalar _PositionOffset becomes inconsistent

No images smaller than minImageWidth will be created. I case such an image is rejected, return value is set to +1.

Returns
=0:ok, <0:error, >0 pyramid size limited by min image width
Author
koeser 08/2007
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 T>
int BIAS::PyramidImage< T >::Downsample ( )
virtual

downsamples from (*this)[0] assumes that all pointers e.g.

(*this)[1] are valid and point to an image of correct size returns 0 on success, anything else on failure

Author
woelk

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
void BIAS::PyramidImage< T >::Dump ( std::ostream &  os = std::cout) const
virtual
template<class StorageType>
bool BIAS::PyramidImageInterface< StorageType >::empty ( ) const
inlineinherited

deprecated interface

Definition at line 97 of file PyramidImageInterface.hh.

template<class T>
int BIAS::PyramidImage< T >::GetAnisotropicImageValue ( const double &  xsource,
const double &  ysource,
const Matrix2x2< double > &  Cov,
double &  T,
unsigned int  channel = 0 
) const

computes (Gaussian) expectation value across a region, used e.g.

in anisotropic anti-aliasing

Referenced by BIAS::ImageAlignment::Align().

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.

template<class T>
const std::vector<double>& BIAS::PyramidImage< T >::GetFactors ( ) const
inline
template<class T>
std::vector<double> BIAS::PyramidImage< T >::GetFactors ( )
inline

Definition at line 205 of file PyramidImage.hh.

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

Definition at line 431 of file Debug.hh.

template<class T>
double BIAS::PyramidImage< T >::GetImageValue ( const double &  x,
const double &  y,
unsigned int  scale,
int  channel = 0 
) const
virtual

bilinear value from scale space: (x,y) is position in pyramid[0], 0<=scale<=size()-1 is pyramid level

Slow, but correct implementation, with boundary checking, takes care of PositionOffset

Author
koeser 1/2008

Implements BIAS::PyramidImageInterface< StorageType >.

Referenced by BIAS::ImageAlignment::Align().

template<class T>
double BIAS::PyramidImage< T >::GetPositionOffset ( ) const
inlinevirtual
Author
woelk, see _PostionOffset for details

Implements BIAS::PyramidImageInterface< StorageType >.

Definition at line 209 of file PyramidImage.hh.

Referenced by BIAS::PyramidImage< StorageType >::operator=(), and BIAS::PyramidImage< StorageType >::ShallowCopy().

template<class StorageType>
unsigned BIAS::PyramidImageInterface< StorageType >::GetPyramidSize ( ) const
inlineinherited

deprecated interface

Definition at line 110 of file PyramidImageInterface.hh.

template<class T>
double BIAS::PyramidImage< T >::GetRescaleFactor ( ) const
inlinevirtual

Implements BIAS::PyramidImageInterface< StorageType >.

Definition at line 195 of file PyramidImage.hh.

template<class T>
void BIAS::PyramidImage< T >::GetSingleImage ( Image< StorageType > &  im) const
virtual

returns a single image containing all pyramid images

Author
woelk 09/2004

Implements BIAS::PyramidImageInterface< StorageType >.

Referenced by BIAS::ScaledImageCanvas::Show(), BIAS::ImageCanvas::Show(), and BIAS::GuiBase::ShowImage().

template<class T>
int BIAS::PyramidImage< T >::GetTrilinearImageValue ( const double &  x,
const double &  y,
const double &  scale,
double &  T,
int  channel = 0 
) const
virtual

trilinear value from scale space: (x,y) is position in pyramid[0], 0<=scale<=size()-1 is pyramid level

Slow, but correct implementation, with boundary checking, takes care of PositionOffset

Author
koeser 10/2007

Implements BIAS::PyramidImageInterface< StorageType >.

Referenced by BIAS::ImageAlignment::Align().

template<class T>
void BIAS::PyramidImage< T >::Init ( const Image< StorageType > &  image,
const unsigned  py_size = 0 
)
virtual

copy image into level 0 and create other levels according to parameters set so far (pyramidsize, filter,...)

Parameters
py_size0=auto, 1=only original image
Author
woelk 09/2004

Implements BIAS::PyramidImageInterface< StorageType >.

Referenced by BIAS::GuiBase::ShowImage().

template<class T>
void BIAS::PyramidImage< T >::Init ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channelcount,
const unsigned  py_size 
)
virtual
Author
woelk 09/2004

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
void BIAS::PyramidImage< T >::Init ( const unsigned  pyramid_size)
virtual

initializes with empty images

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
void BIAS::PyramidImage< T >::InitFromImageBase ( const ImageBase image,
const unsigned  py_size = 0 
)
virtual

same as Init(Image) but can use different ST, e.g.

construct float pyramid from uchar image, uses ImageConvert then.

Parameters
py_size0=auto, 1=only original image
Author
koeser

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
bool BIAS::PyramidImage< T >::IsEmpty ( ) const
inlinevirtual

Implements BIAS::PyramidImageInterface< StorageType >.

Definition at line 178 of file PyramidImage.hh.

template<class T>
bool BIAS::PyramidImage< T >::IsInROI ( double  x,
double  y,
int  layer 
) const
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
template<class T>
PyramidImage<StorageType>& BIAS::PyramidImage< T >::operator= ( const PyramidImage< StorageType > &  pim)

deep copy assignement

Author
woelk 09/2004
template<class T>
SharedPtr<Image<StorageType> >& BIAS::PyramidImage< T >::operator[] ( const unsigned  index)
inlinevirtual

element access

Implements BIAS::PyramidImageInterface< StorageType >.

Definition at line 103 of file PyramidImage.hh.

template<class T>
SharedPtr<const Image<StorageType> > BIAS::PyramidImage< T >::operator[] ( const unsigned  index) const
inlinevirtual

Implements BIAS::PyramidImageInterface< StorageType >.

Definition at line 107 of file PyramidImage.hh.

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

Definition at line 383 of file Debug.hh.

template<class T>
virtual void BIAS::PyramidImage< T >::push_back ( SharedPtr< Image< StorageType > >  img)
inlineprotectedvirtual

Definition at line 248 of file PyramidImage.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 T>
virtual void BIAS::PyramidImage< T >::resize ( const unsigned  size)
virtual
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 T>
void BIAS::PyramidImage< T >::SetLowPassFilter ( const FilterNToN< StorageType, StorageType > &  filter)
inline

Definition at line 197 of file PyramidImage.hh.

template<class T>
void BIAS::PyramidImage< T >::SetLowPassType ( int  lpt)
inline

Definition at line 199 of file PyramidImage.hh.

template<class T>
void BIAS::PyramidImage< T >::SetRescaleFactor ( const double  factor)
inline

Definition at line 193 of file PyramidImage.hh.

template<class T>
int BIAS::PyramidImage< T >::SetROI ( unsigned  minx,
unsigned  miny,
unsigned  maxx,
unsigned  maxy 
)
virtual

set the ROI for all images

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
int BIAS::PyramidImage< T >::SetROI ( const ROI roi)

set the ROI for all images from original ROI from Img

template<class T>
void BIAS::PyramidImage< T >::SetUID ( BIAS::UUID  uid)
virtual
template<class T>
void BIAS::PyramidImage< T >::SetZero ( )
virtual

sets all pixels in all images to zero

Author
woelk 10/2004

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
virtual PyramidImageInterface<StorageType>* BIAS::PyramidImage< T >::ShallowClone ( ) const
virtual

create a shallow clone

Implements BIAS::PyramidImageInterface< StorageType >.

template<class T>
PyramidImage<StorageType>& BIAS::PyramidImage< T >::ShallowCopy ( const PyramidImage< StorageType > &  pim)

sets this as shallow copy of pim

Referenced by BIAS::PyramidImage< StorageType >::ShallowClone().

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 StorageType>
unsigned BIAS::PyramidImageInterface< StorageType >::size ( ) const
inlineinherited
template<class T>
unsigned BIAS::PyramidImage< T >::Size ( ) const
inlinevirtual
template<class T>
int BIAS::PyramidImage< T >::WriteImages ( const std::string &  prefix) const
virtual

writes a file in mip format per pyramid level using prefix

Author
woelk 10/2004

Implements BIAS::PyramidImageInterface< StorageType >.

Member Data Documentation

template<class T>
std::vector<SharedPtr<Image<StorageType> > > BIAS::PyramidImage< T >::_Images
protected

Definition at line 220 of file PyramidImage.hh.

Referenced by BIAS::PyramidImage< StorageType >::operator=().

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=().

template<class T>
double BIAS::PyramidImage< T >::_PositionOffset
protected

Offset which needs to be used when transferring point locations between pyramid levels:

(2*xs+offset, 2*ys+offset) = (xb, yb) or (xs, ys) = ((xb-offset)/2.0, (yb-offset)/2.0)

where (xs, ys) is the pixel position in pixel coo. the smaller destination image and (xb, yb) is the position in pixel coo. in the bigger source image.

see Rescale::DowsampleBy2 for details

Author
woelk 05/2005

Definition at line 243 of file PyramidImage.hh.

template<class T>
Rescale<StorageType, StorageType> BIAS::PyramidImage< T >::_rescale
protected
template<class T>
double BIAS::PyramidImage< T >::_RescaleFactor
protected
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 T>
std::vector<double> BIAS::PyramidImage< T >::_vFactor
protected

Definition at line 229 of file PyramidImage.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: