last update 20 Sep 2009 |
#include <cvrIntegralImage.h>
Classes | |
class | parameters |
The parameters for the class integralImage. More... | |
Public Member Functions | |
integralImage () | |
integralImage (const eBoundaryType boundaryType) | |
integralImage (const parameters &par) | |
integralImage (const integralImage &other) | |
virtual | ~integralImage () |
bool | apply (const matrix< ubyte > &src, matrix< int32 > &dest) const |
bool | apply (const fmatrix &src, fmatrix &dest) const |
integralImage & | copy (const integralImage &other) |
integralImage & | operator= (const integralImage &other) |
virtual const std::string & | name () const |
virtual integralImage * | clone () const |
virtual integralImage * | newInstance () const |
const parameters & | getParameters () const |
bool | updateParameters () |
Convenience window sums with boundary considerations. | |
This methods used the computed integral image to produce the sum of elements of the originary channel falling inside a given window. These methods are relatively slow, since they check if a part of the window falls outside the image and take the necessary measures depending on the boundary type selected. The methods are designed to produce valid results if and only if at least a part of the window falls over the image. If in your application you know for sure that the window falls completely inside the image, and at least with one pixel free on the top and left boundaries, then you may want to use the unchecked internalSum() methods. The NoBoundary type will return 0 if any part of the given window falls outside the image.
You have to ensure that the
| |
int32 | sum (const matrix< int32 > &intImage, const irectangle &rect) const |
int32 | sum (const matrix< int32 > &intImage, const ipoint &from, const ipoint &to) const |
int32 | sum (const matrix< int32 > &intImage, const int fromX, const int fromY, const int toX, const int toY) const |
float | sum (const fmatrix &intImage, const irectangle &rect) const |
float | sum (const fmatrix &intImage, const ipoint &from, const ipoint &to) const |
float | sum (const matrix< float > &intImage, const int fromX, const int fromY, const int toX, const int toY) const |
Convenience window sums without boundary considerations. | |
These methods use the computed integral image to produce the sum of elements of the originary channel falling inside a given window. They are relatively fast, since they assume that the complete window falls into the image and at least one pixel border has been left on the top and on the left. If this is not the case, you have to use the sum() methods instead.
| |
int32 | internalSum (const matrix< int32 > &intImage, const irectangle &rect) const |
int32 | internalSum (const matrix< int32 > &intImage, const ipoint &from, const ipoint &to) const |
int32 | internalSum (const matrix< int32 > &intImage, const int fromX, const int fromY, const int toX, const int toY) const |
float | internalSum (const fmatrix &intImage, const irectangle &rect) const |
float | internalSum (const fmatrix &intImage, const ipoint &from, const ipoint &to) const |
float | internalSum (const matrix< float > &intImage, const int fromX, const int fromY, const int toX, const int toY) const |
The integral image, (which in the CVR-Lib should it be better called the integral channel, but for consistency with the literature we leave it as is) is the image obtained from the channel with the following convention:
From this integral image, the computation of any sum of intensities over any upright, rectangular area can be done with only four additions, independent of the area size.
The computation of the integral image is very efficient. It needs just one pass of the orignal image to be obtained, with just two additions per pixel.
The class provides a collection of useful methods to compute the sum of elements in a rectangular window, for which the parameter boundaryType makes a lot of sense.
cvr::integralImage::integralImage | ( | ) |
Default constructor.
cvr::integralImage::integralImage | ( | const eBoundaryType | boundaryType | ) |
Construct with the given boundary type.
cvr::integralImage::integralImage | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
cvr::integralImage::integralImage | ( | const integralImage & | other | ) |
virtual cvr::integralImage::~integralImage | ( | ) | [virtual] |
Destructor.
Compute the integral image of an fmatrix.
src | fmatrix with the source data. | |
dest | fmatrix where the result will be left. |
Compute the integral image of a ubyte matrix.
src | matrix<ubyte> with the source data. | |
dest | matrix<ubyte> where the result will be left. |
virtual integralImage* cvr::integralImage::clone | ( | ) | const [virtual] |
integralImage& cvr::integralImage::copy | ( | const integralImage & | other | ) |
const parameters& cvr::integralImage::getParameters | ( | ) | const |
float cvr::integralImage::internalSum | ( | const matrix< float > & | intImage, | |
const int | fromX, | |||
const int | fromY, | |||
const int | toX, | |||
const int | toY | |||
) | const [inline] |
Convenience method to use the computed integral image to produce the sum of the results in the provided rectangle.
intImage | an integral image computed with apply() | |
fromX | initial x coordinate of area to be summed. | |
fromY | initial y coordinate of area to be summed. | |
toX | final x coordinate of area to be summed. | |
toY | final y coordinate of area to be summed. |
float cvr::integralImage::internalSum | ( | const fmatrix & | intImage, | |
const irectangle & | rect | |||
) | const [inline] |
int32 cvr::integralImage::internalSum | ( | const matrix< int32 > & | intImage, | |
const int | fromX, | |||
const int | fromY, | |||
const int | toX, | |||
const int | toY | |||
) | const [inline] |
Convenience method to use the computed integral image to produce the sum of the results in the provided rectangle.
intImage | an integral image computed with apply() | |
fromX | initial x coordinate of area to be summed. | |
fromY | initial y coordinate of area to be summed. | |
toX | final x coordinate of area to be summed. | |
toY | final y coordinate of area to be summed. |
int32 cvr::integralImage::internalSum | ( | const matrix< int32 > & | intImage, | |
const irectangle & | rect | |||
) | const [inline] |
virtual const std::string& cvr::integralImage::name | ( | ) | const [virtual] |
virtual integralImage* cvr::integralImage::newInstance | ( | ) | const [virtual] |
integralImage& cvr::integralImage::operator= | ( | const integralImage & | other | ) |
float cvr::integralImage::sum | ( | const matrix< float > & | intImage, | |
const int | fromX, | |||
const int | fromY, | |||
const int | toX, | |||
const int | toY | |||
) | const [inline] |
Convenience method to use the computed integral image to produce the sum of the results in the provided rectangle.
intImage | an integral image computed with apply() | |
fromX | initial x coordinate of area to be summed. | |
fromY | initial y coordinate of area to be summed. | |
toX | final x coordinate of area to be summed. | |
toY | final y coordinate of area to be summed. |
float cvr::integralImage::sum | ( | const fmatrix & | intImage, | |
const irectangle & | rect | |||
) | const [inline] |
int32 cvr::integralImage::sum | ( | const matrix< int32 > & | intImage, | |
const int | fromX, | |||
const int | fromY, | |||
const int | toX, | |||
const int | toY | |||
) | const [inline] |
Convenience method to use the computed integral image to produce the sum of the results in the provided rectangle.
intImage | an integral image computed with apply() | |
fromX | initial x coordinate of area to be summed. | |
fromY | initial y coordinate of area to be summed. | |
toX | final x coordinate of area to be summed. | |
toY | final y coordinate of area to be summed. |
int32 cvr::integralImage::sum | ( | const matrix< int32 > & | intImage, | |
const irectangle & | rect | |||
) | const [inline] |
bool cvr::integralImage::updateParameters | ( | ) | [virtual] |