LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::similarityMatrix Class Reference

Given a set of connected image regions (coded in a labeled mask or std::list of area point lists) and the original color image, this functor will compute a similarity measure between the objects, and will code them in a similarity matrix. More...

#include <ltiSimilarityMatrix.h>

Inheritance diagram for lti::similarityMatrix:
Inheritance graph
[legend]
Collaboration diagram for lti::similarityMatrix:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class similarityMatrix More...

Public Member Functions

 similarityMatrix ()
 similarityMatrix (const similarityMatrix &other)
virtual ~similarityMatrix ()
virtual const char * getTypeName () const
bool apply (const image &img, const int &nObj, const imatrix &lmask, dmatrix &colSimMat, dmatrix &geoSimMat) const
bool apply (const image &img, const std::list< areaPoints > &lapts, dmatrix &colSimMat, dmatrix &geoSimMat, imatrix &lmask) const
bool neighbors (const int &nObj, const imatrix &lmask, const int &label, ivector &neighborLabels) const
similarityMatrixcopy (const similarityMatrix &other)
similarityMatrixoperator= (const similarityMatrix &other)
virtual functorclone () const
const parametersgetParameters () const

Static Public Member Functions

Color Distances



static double euclideanLLL2 (const rgbPixel &a, const rgbPixel &b)
static double euclideanRGB2 (const rgbPixel &a, const rgbPixel &b)
static double chromaticity2 (const rgbPixel &a, const rgbPixel &b)
static double hueSaturation (const rgbPixel &a, const rgbPixel &b)
static double hue (const rgbPixel &a, const rgbPixel &b)
static double neighbor (const rgbPixel &a, const rgbPixel &b)

Protected Member Functions

void createMask (const std::list< areaPoints > &apts, imatrix &mask) const
void similarity (const image &img, const imatrix &mask, dmatrix &colBorderSimMat, dmatrix &colAreaSimMat, dmatrix &geoSimMat) const

Detailed Description

Given a set of connected image regions (coded in a labeled mask or std::list of area point lists) and the original color image, this functor will compute a similarity measure between the objects, and will code them in a similarity matrix.

The first approach (BorderBased) will compute the sum of the square root of the difference of the colors at the borders between two both objects. The second approach (AreaBased) will compute the difference of the mean colors for each object.

See also Segmentation Overview


Constructor & Destructor Documentation

lti::similarityMatrix::similarityMatrix (  ) 

default constructor

lti::similarityMatrix::similarityMatrix ( const similarityMatrix other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::similarityMatrix::~similarityMatrix (  )  [virtual]

destructor


Member Function Documentation

bool lti::similarityMatrix::apply ( const image img,
const std::list< areaPoints > &  lapts,
dmatrix colSimMat,
dmatrix geoSimMat,
imatrix lmask 
) const

operates on the given parameter.

Parameters:
img original image. All points in the list of areaPoints must lie inside the image, or an exception will be thrown.
lapts list of area points.
colSimMat color similarity matrix
geoSimMat geometry similarity measure
lmask label mask computed from the area points
Returns:
true if apply successful or false otherwise.
bool lti::similarityMatrix::apply ( const image img,
const int &  nObj,
const imatrix lmask,
dmatrix colSimMat,
dmatrix geoSimMat 
) const

operates on the given parameter.

Parameters:
img original image. All points in the list of areaPoints must lie inside the image, or an exception will be thrown.
nObj number of objects in the mask (without background). Is expected here in order to reduce its computation from the mask. This value should be equal to the maximum value in the mask, i.e. the number of elements of the area points list used to generate the mask.
lmask label mask computed from the area points
colSimMat color similarity matrix
geoSimMat geometry similarity measure
Returns:
true if apply successful or false otherwise.
static double lti::similarityMatrix::chromaticity2 ( const rgbPixel a,
const rgbPixel b 
) [static]

euclidean distance in the rg color space, ignoring the intensity channel.

virtual functor* lti::similarityMatrix::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

similarityMatrix& lti::similarityMatrix::copy ( const similarityMatrix other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

void lti::similarityMatrix::createMask ( const std::list< areaPoints > &  apts,
imatrix mask 
) const [protected]

create a mask from the area points.

The mask must have the correct dimensions before calling this method.

static double lti::similarityMatrix::euclideanLLL2 ( const rgbPixel a,
const rgbPixel b 
) [static]

This measure compares the differences between the color channels (red-green)^2, (red-blue)^2 and (green-blue)^2 for each pixel, and then the square of the differences between these values for a and b.

static double lti::similarityMatrix::euclideanRGB2 ( const rgbPixel a,
const rgbPixel b 
) [static]

square of the euclidean distance in RGB color space, i.e.

this returns a.distanceSqr(b)

const parameters& lti::similarityMatrix::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

virtual const char* lti::similarityMatrix::getTypeName (  )  const [virtual]

returns the name of this type ("similarityMatrix")

Reimplemented from lti::functor.

static double lti::similarityMatrix::hue ( const rgbPixel a,
const rgbPixel b 
) [static]

distance of the pixels in the HSV color space, where only the hue channel is considered.

The angular distance of hue is always normed from 0 to 255.

Also usefull to ignore shadow based differences.

static double lti::similarityMatrix::hueSaturation ( const rgbPixel a,
const rgbPixel b 
) [static]

distance of the pixels in the HSV color space.

The value channel is ignored. The angular distance of hue is always normed from 0 to 255. The Saturation value is also normed.

Also usefull to ignore shadow based differences.

static double lti::similarityMatrix::neighbor ( const rgbPixel a,
const rgbPixel b 
) [static]

returns always 1.0 Usefull to create a matrix to know which areas are neighbors

bool lti::similarityMatrix::neighbors ( const int &  nObj,
const imatrix lmask,
const int &  label,
ivector neighborLabels 
) const

computes for the given mask which labels are used in neighbor objects for the given label.

Parameters:
nObj number of objects in the mask (without background). Is expected here in order to reduce its computation from the mask. This value should be equal to the maximum value in the mask, i.e. the number of elements of the area points list used to generate the mask.
lmask label mask computed from the area points
label label for which the neighbors need to be found
neighborLabels resulting vector
similarityMatrix& lti::similarityMatrix::operator= ( const similarityMatrix other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

void lti::similarityMatrix::similarity ( const image img,
const imatrix mask,
dmatrix colBorderSimMat,
dmatrix colAreaSimMat,
dmatrix geoSimMat 
) const [protected]

create the border similarity matrix.

The size of the similarity matrix must be set before calling this method.

Parameters:
img original color image
mask labeled segmentation mask, created with createMask()
colBorderSimMat border color similarity mask, the size must be set previously
colAreaSimMat area color similarity
geoSimMat geomatrical similarity measure

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

Generated on Sat Apr 10 15:27:51 2010 for LTI-Lib by Doxygen 1.6.1