latest version v1.9 - last update 10 Apr 2010 |
This functor computes descriptors for shapes, decomposing a binary mask as a sum of some basis functions. More...
#include <ltiRegionShapeFeatures.h>
Classes | |
class | parameters |
the parameters for the class regionShapeFeatures More... | |
Public Member Functions | |
regionShapeFeatures () | |
regionShapeFeatures (const parameters &par) | |
regionShapeFeatures (const regionShapeFeatures &other) | |
virtual | ~regionShapeFeatures () |
virtual const char * | getTypeName () const |
bool | apply (const channel8 &src, channel &dest) const |
bool | apply (const channel8 &src, dvector &dest) const |
bool | apply (const channel8 &src, channel &dest1, channel &dest2) const |
bool | apply (const channel8 &src, dvector &dest1, dvector &dest2) const |
bool | reconstruct (const channel &coef1, const channel &coef2, channel &shape1, channel &shape2) const |
bool | getBasisFunction (const int n, const int m, channel &real, channel &imag) const |
regionShapeFeatures & | copy (const regionShapeFeatures &other) |
regionShapeFeatures & | operator= (const regionShapeFeatures &other) |
virtual functor * | clone () const |
virtual bool | updateParameters () |
const parameters & | getParameters () const |
Protected Member Functions | |
void | dot (const channel &reA, const channel &imA, const channel &reB, const channel &imB, float &real, float &imag) const |
bool | calcLUT () |
bool | testOrthogonality (channel &ortho) const |
void | resizeMask (const channel8 &src, channel &ssrc) const |
double | fac (int arg) |
Static Protected Member Functions | |
static float | binarize (const float &x) |
Protected Attributes | |
std::vector< std::vector < channel > > | lutR |
std::vector< std::vector < channel > > | lutI |
channel | radLut |
parameters::basisFunctionsType | lastBasisFunctionSet |
std::vector< std::vector< bool > > | vecNM |
This functor computes descriptors for shapes, decomposing a binary mask as a sum of some basis functions.
Several basis function sets have been implemented:
More information about this descriptor can be found in Miroslaw Bober, "MPEG-7 Visual Shape Descriptors", IEEE Transactions on Circuits and Systems for Video Technology, Vol. 11, No. 6, June 2001. or http://www.ctr.columbia.edu/~sfchang/course/vis/REF/bober-01.pdf
Tschebichef Moments need still to be implemented.
lti::regionShapeFeatures::regionShapeFeatures | ( | ) |
default constructor
lti::regionShapeFeatures::regionShapeFeatures | ( | const parameters & | par | ) |
default constructor with parameters
lti::regionShapeFeatures::regionShapeFeatures | ( | const regionShapeFeatures & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::regionShapeFeatures::~regionShapeFeatures | ( | ) | [virtual] |
destructor
bool lti::regionShapeFeatures::apply | ( | const channel8 & | src, | |
dvector & | dest1, | |||
dvector & | dest2 | |||
) | const |
operates on the given parameter.
src | channel8 with the input binary mask. All not-object pixels must be zero. The object pixels must have a value 255. | |
dest1 | feature vector with real part or magnitude of the coefficients, depending on the value of parameters::polar. | |
dest2 | feature vector with imaginary part or phase of the coefficients, depending on the value of parameters::polar. |
bool lti::regionShapeFeatures::apply | ( | const channel8 & | src, | |
channel & | dest1, | |||
channel & | dest2 | |||
) | const |
operates on the given parameter.
src | channel8 with the input binary mask. All not-object pixels must be zero. The object pixels must have a value 255. | |
dest1 | channel with real part or magnitude of the coefficients, depending on the value of parameters::polar. | |
dest2 | channel with imaginary part or phase of the coefficients, depending on the value of parameters::polar. |
operates on the given parameter.
src | channel8 with the input binary mask. All not-object pixels must be zero. The object pixels must have a value 255. | |
dest | feature vector with coefficients for the base functions. (real part or magnitude, depending on parameters::polar value) |
Reimplemented from lti::globalFeatureExtractor.
operates on the given parameter.
src | channel8 with the input binary mask. All not-object pixels must be zero. The object pixels must have a value 255. | |
dest | channel with coefficients for the base functions. (real part or magnitude, depending on parameters::polar value) |
static float lti::regionShapeFeatures::binarize | ( | const float & | x | ) | [static, protected] |
static function used to binarize a channel.
All values under 0.5 will be set to 0 and all values above 0.5 will be set to 1.0
bool lti::regionShapeFeatures::calcLUT | ( | ) | [protected] |
calculates the look up tables (LUT) for the transformation (suitable to the given parameters::maskSize)
virtual functor* lti::regionShapeFeatures::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::globalFeatureExtractor.
regionShapeFeatures& lti::regionShapeFeatures::copy | ( | const regionShapeFeatures & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::globalFeatureExtractor.
void lti::regionShapeFeatures::dot | ( | const channel & | reA, | |
const channel & | imA, | |||
const channel & | reB, | |||
const channel & | imB, | |||
float & | real, | |||
float & | imag | |||
) | const [protected] |
dot product between two matrices of the same size
double lti::regionShapeFeatures::fac | ( | int | arg | ) | [protected] |
compute factorial of arg
bool lti::regionShapeFeatures::getBasisFunction | ( | const int | n, | |
const int | m, | |||
channel & | real, | |||
channel & | imag | |||
) | const |
get one of the basis functions currently being used.
The indices must be in the valid range (specified in the parameters), otherwise the function will return false.
n | radial component (row) | |
m | angular component (column) | |
real | real part of the basis function | |
imag | imaginary part of the basis function |
const parameters& lti::regionShapeFeatures::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::globalFeatureExtractor.
virtual const char* lti::regionShapeFeatures::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("regionShapeFeatures")
Reimplemented from lti::globalFeatureExtractor.
regionShapeFeatures& lti::regionShapeFeatures::operator= | ( | const regionShapeFeatures & | other | ) |
bool lti::regionShapeFeatures::reconstruct | ( | const channel & | coef1, | |
const channel & | coef2, | |||
channel & | shape1, | |||
channel & | shape2 | |||
) | const |
This method is for debugging purposes only.
It provides a tentative reconstruction algorithm for the original shape using the given coefficients. Depending on the parameters::polar the output will be in cartesic or in polar form.
coef1 | real part (or magnitude) of the coefficients. | |
coef2 | imaginary part (or phase) of the coefficients. | |
shape1 | reconstructed real part (or magnitude) | |
shape2 | reconstructed imaginary part (or phase) |
void lti::regionShapeFeatures::resizeMask | ( | const channel8 & | src, | |
channel & | ssrc | |||
) | const [protected] |
crop the object in the mask and resizes it to the parameters::maskSize (here: the center of mass of the object is in the center of the new image)
bool lti::regionShapeFeatures::testOrthogonality | ( | channel & | ortho | ) | const [protected] |
virtual bool lti::regionShapeFeatures::updateParameters | ( | ) | [virtual] |
set functor's parameters.
This member makes a copy of theParam: the functor will keep its own copy of the parameters!
Reimplemented from lti::functor.
flag to remember the last basis function set
std::vector< std::vector<channel> > lti::regionShapeFeatures::lutI [protected] |
imaginary part of the basis functions (LUT)
std::vector< std::vector<channel> > lti::regionShapeFeatures::lutR [protected] |
real part of the basis functions (LUT)
channel lti::regionShapeFeatures::radLut [protected] |
std::vector<std::vector<bool> > lti::regionShapeFeatures::vecNM [protected] |
used to decide whether zernike moment (n,m) exists