image cache to compute the running average More...
#include <Image/ImageCache.H>
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 |
image cache to compute the running average
Definition at line 123 of file ImageCache.H.
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.
ImageCacheAvg< T >::ImageCacheAvg | ( | uint | maxSize | ) | [inline] |
Constructor.
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.
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().
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().
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.
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.
Image< T > ImageCacheAvg< T >::mean | ( | ) | const [inline] |
return the mean of the images currently in the cache
Definition at line 182 of file ImageCache.C.
References ImageCache< T >::itsCache, and ImageCacheAvg< T >::itsSumImg.
Referenced by ImageCacheAvg< T >::absDiffMean(), ImageCacheAvg< T >::clampedDiffMean(), SimulationViewerCompress::getTraj(), TaskRelevanceMapTigs2::integrate(), TaskRelevanceMapGistClassify::integrate(), TaskRelevanceMapTigs::integrate(), and FOEestimator::updateFOE().
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.
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().