ImageCacheAvg< T > Class Template Reference

image cache to compute the running average More...

#include <Image/ImageCache.H>

Inheritance diagram for ImageCacheAvg< T >:
Inheritance graph
[legend]
Collaboration diagram for ImageCacheAvg< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImageCacheAvg ()
 Uninitialized constructor.
 ImageCacheAvg (uint maxSize)
 Constructor.
Image< T > mean () const
 return the mean of the images currently in the cache
Image< T > absDiffMean (const Image< T > &img) const
 return abs(img - mean)
Image< T > clampedDiffMean (const Image< T > &img) const
 return (img - mean), clamped to zero where negative
Image< typename promote_trait
< T, float >::TP > 
sum () const
 returns the sum of all cached images

Protected Member Functions

virtual void doWhenAdd (const Image< T > &img)
 called when an image is added - add image to the sum
virtual void doWhenRemove (const Image< T > &img)
 called when an image is removed - subtract image from the sum

Protected Attributes

Image< typename promote_trait
< T, float >::TP > 
itsSumImg
 the sum of all the cached images

Detailed Description

template<class T>
class ImageCacheAvg< T >

image cache to compute the running average

Definition at line 123 of file ImageCache.H.


Constructor & Destructor Documentation

template<class T >
ImageCacheAvg< T >::ImageCacheAvg (  )  [inline]

Uninitialized constructor.

By default, cache size is not limited. A limit can be set later using setMaxSize().

Definition at line 170 of file ImageCache.C.

template<class T >
ImageCacheAvg< T >::ImageCacheAvg ( uint  maxSize  )  [inline]

Constructor.

Parameters:
maxSize the maximum size of the cache. If this size is exceeded, images are popped off the front of the cache and disregarded for the computation of the mean. If maxSize = 0, the cache is not limited.

Definition at line 176 of file ImageCache.C.


Member Function Documentation

template<class T>
Image< T > ImageCacheAvg< T >::absDiffMean ( const Image< T > &  img  )  const [inline]

return abs(img - mean)

Definition at line 189 of file ImageCache.C.

References absDiff(), and ImageCacheAvg< T >::mean().

template<class T>
Image< T > ImageCacheAvg< T >::clampedDiffMean ( const Image< T > &  img  )  const [inline]

return (img - mean), clamped to zero where negative

Definition at line 196 of file ImageCache.C.

References clampedDiff(), and ImageCacheAvg< T >::mean().

template<class T>
void ImageCacheAvg< T >::doWhenAdd ( const Image< T > &  img  )  [inline, protected, virtual]

called when an image is added - add image to the sum

Reimplemented from ImageCache< T >.

Definition at line 210 of file ImageCache.C.

References ASSERT, Image< T >::initialized(), Image< T >::isSameSize(), and ImageCacheAvg< T >::itsSumImg.

template<class T>
void ImageCacheAvg< T >::doWhenRemove ( const Image< T > &  img  )  [inline, protected, virtual]

called when an image is removed - subtract image from the sum

Reimplemented from ImageCache< T >.

Definition at line 225 of file ImageCache.C.

References ASSERT, Image< T >::initialized(), and ImageCacheAvg< T >::itsSumImg.

template<class T >
Image< T > ImageCacheAvg< T >::mean (  )  const [inline]
template<class T >
Image< typename promote_trait< T, float >::TP > ImageCacheAvg< T >::sum (  )  const [inline]

returns the sum of all cached images

This will be of type Image<int> if T = byte, int16 or int32; of type float if T = float; of type Image< PixRGB<int> > if T = PixRGB<byte>, PixRGB<int16> or PixRGB<int32>; and of type Image< PixRGB<float> > if T = PixRGB<float>

Definition at line 203 of file ImageCache.C.

References ImageCacheAvg< T >::itsSumImg.


Member Data Documentation

template<class T>
Image<typename promote_trait<T,float>::TP> ImageCacheAvg< T >::itsSumImg [protected]

the sum of all the cached images

Definition at line 161 of file ImageCache.H.

Referenced by ImageCacheAvg< T >::doWhenAdd(), ImageCacheAvg< T >::doWhenRemove(), ImageCacheAvg< T >::mean(), and ImageCacheAvg< T >::sum().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:22:18 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3