Auxilliary Tool:
A linear feature that uses the "Integral
Image" trick to efficiently evaluate convolution kernels on an image, where the kernel can be expressed as a sum of boxes.
More...
#include <BoxFeature2.h>
Public Member Functions | |
BoxFeature2 (cv::Size expectedPatchSize, int nBoxes=2) | |
Constructor. | |
BoxFeature2 () | |
Default constructor. | |
BoxFeature2 (const BoxFeature2 ©) | |
Copy constructor. | |
BoxFeature2 & | operator= (const BoxFeature2 &rhs) |
Assignment operator. | |
virtual | ~BoxFeature2 () |
Destructor. | |
virtual void | setFeatureParameters (const cv::Mat ¶mVec) |
Set the parameters that describe the position of the boxes. See detailed description of the parameters below. | |
virtual double | evaluateImagePatch (const ImagePatch2 &patch) const |
Turn an ImagePatch into a scalar value by applying the box filter. | |
virtual void | filterPatchList (PatchList2 *patches) const |
Apply the feature to a PatchList data structure. |
Auxilliary Tool:
A linear feature that uses the "Integral
Image" trick to efficiently evaluate convolution kernels on an image, where the kernel can be expressed as a sum of boxes.
The derived HaarFeature class is a subset of these box features that are like wavelets composed of blocks.
BoxFeature2::BoxFeature2 | ( | cv::Size | expectedPatchSize, |
int | nBoxes = 2 |
||
) |
Constructor.
expectedPatchSize | Specifies the size of the filter, which specifies the possible ranges for the box positions. |
nBoxes | The number of boxes. The filtering time decreases linearly with the number of boxes. |
double BoxFeature2::evaluateImagePatch | ( | const ImagePatch2 & | patch ) | const [virtual] |
Turn an ImagePatch into a scalar value by applying the box filter.
patch | The image patch to evaluate. |
Implements Feature2.
void BoxFeature2::filterPatchList | ( | PatchList2 * | patches ) | const [virtual] |
void BoxFeature2::setFeatureParameters | ( | const cv::Mat & | paramVec ) | [virtual] |
Set the parameters that describe the position of the boxes. See detailed description of the parameters below.
The BoxFeature parameter vector has 5N+4 elements, where N is the number of boxes. The first 5N elements describe the sign of the box (addition or subtraction), x,y position of the box's top-left corner, and its width and height respectively. The parameters for each box are together, so the first 5 elements describe the first box, etc. The sign parameter can be -1 or +1, and the position parameters are bounded below by 0 and above by patchSize.[width or height]-1, as appropriate.
The last 4 parameters describe global behavior of the filtering process. They are: horizontal symmetry, vertical symmetry, mean subtraction, brightness normalization respectively.
The first two each effectively double the number of boxes, by reflecting them around the horizontal and vertical axes respectively. Values for these can be -1,0,+1. 0 means no symmetry, -1 means the symmetric box has the opposite sign, and +1 means the symmetric box has the same sign.
Mean Subtraction means the mean pixel value of the image patch is subtracted before filtering. This normalizes for contrast but not brightness. Brightness Normalization divides the image patch by its L1 norm before filtering. If both options are set, brightness is normalized and then the mean is subtracted. Both of these operations incur a time penalty, which is relatively small.
Implements Feature2.
Reimplemented in HaarFeature2.