Public Member Functions

OpenCVBoxFilter Class Reference
[Auxilliary Tools]

Auxilliary Tool: A class for efficiently applying multiple box convolutions to the same image. More...

#include <OpenCVBoxFilter.h>

List of all members.

Public Member Functions

 OpenCVBoxFilter (int imageWidth, int imageHeight, int maxPaddingRequired)
 Constructor.
 ~OpenCVBoxFilter ()
 Default Destructor.
void setNewImage (IplImage *imageToFilter)
 Change the image that will be filtered.This must be a 32-bit single channel floating point image.
void setBoxFilter (IplImage *destinationImage, CvRect boxPosition=cvRect(0, 0, 1, 1), double scaleResultFactor=1.0)
 Compute a box filter and over-write the result to an image. The result of filtering is the sum of the pixel values in the specified rectangular region. This must be a 64-bit single channel floating point image.
void accumulateBoxFilter (IplImage *destinationImage, CvRect boxPosition=cvRect(0, 0, 1, 1), double scaleResultFactor=1.0)
 Compute a box filter and add the result to an image. The result of filtering is the average of the pixel values in the specified rectangular region. This is useful for designing filters composed of multiple boxes.

Detailed Description

Auxilliary Tool: A class for efficiently applying multiple box convolutions to the same image.

By computing the integral image once, an image can be filtered multiple times with boxes of different sizes. Requires OpenCV libraries.

Author:
Nicholas Butko
Date:
2010 version 0.4

Constructor & Destructor Documentation

OpenCVBoxFilter::OpenCVBoxFilter ( int  imageWidth,
int  imageHeight,
int  maxPaddingRequired 
)

Constructor.

NOTE: The source image is assumed to be single channel, floating point, 32-bit. The destination image is assumed to be a single channel, floating point, 64-bit image.

Parameters:
imageWidthThe width of the image that will be filtered.
imageHeightThe height of the image that will be filtered.
maxPaddingRequiredExtra memory required for performing convolutions. In practice, this must be the distance from the central pixel of the most extreme point of any box we expect to use, i.e. at least the maximum intended value of: (1) |boxPosition.x|, (2) |boxPosition.x+boxPosition.width-1|, (3) |boxPosition.y|, (4) |boxPosition.y+boxPosition.height-1|. Erring on the side of too much padding has no adverse consequences other than increased memory usage.
OpenCVBoxFilter::~OpenCVBoxFilter (  )

Default Destructor.

Deallocates all memory associated with the box filter.


Member Function Documentation

void OpenCVBoxFilter::accumulateBoxFilter ( IplImage *  destinationImage,
CvRect  boxPosition = cvRect(0,0,1,1),
double  scaleResultFactor = 1.0 
)

Compute a box filter and add the result to an image. The result of filtering is the average of the pixel values in the specified rectangular region. This is useful for designing filters composed of multiple boxes.

Parameters:
destinationImageImage target for the results of the filtering. After invoking this method, the contents of this variable will be overwritten with the results of the operation.
boxPositionLocation of the box (relative to the central pixel) to average pixel values over. For example, cvRect(0,0,1,1) has zero-offset from the current pixel and a width/height of one pixel. Filtering the image in this way will return the original image. To filter with a width-5 averaging filter with no offset, use cvRect(-2,-2,5,5).
scaleResultFactorScale the result by some factor. For example, if the scale is boxPosition.width*boxPosition.height, the sum of the pixels in the box is returned instead of the average.
void OpenCVBoxFilter::setBoxFilter ( IplImage *  destinationImage,
CvRect  boxPosition = cvRect(0,0,1,1),
double  scaleResultFactor = 1.0 
)

Compute a box filter and over-write the result to an image. The result of filtering is the sum of the pixel values in the specified rectangular region. This must be a 64-bit single channel floating point image.

Parameters:
destinationImageImage target for the results of the filtering. After invoking this method, the contents of this variable will be overwritten with the results of the operation.
boxPositionLocation of the box (relative to the central pixel) to average pixel values over. For example, cvRect(0,0,1,1) has zero-offset from the current pixel and a width/height of one pixel. Filtering the image in this way will return the original image. To filter with a width-5 averaging filter with no offset, use cvRect(-2,-2,5,5).
scaleResultFactorScale the result by some factor. For example, if the scale is 1/boxPosition.width*boxPosition.height, the average of the pixels in the box is returned instead of the sum.
void OpenCVBoxFilter::setNewImage ( IplImage *  imageToFilter )

Change the image that will be filtered.This must be a 32-bit single channel floating point image.

This method computes a new integral image that will be used repeatedly for future filtering, until this method is invoked again with a new image.

Parameters:
imageToFilterA new OpenCV image to filter repeatedly.

The documentation for this class was generated from the following files: