classPiiColors::LikelihoodFunction
#include <PiiColors.h>
A unary function for converting color distances to "likelihoods".
Inherits Pii::UnaryFunction< float >
Description
The function is defined as
.
As a result, zero distance to the center of a color model maps to
one, and infinity distance to zero.
Public member functions
|
float
|
(
|
|
template<class ColorType, class UnaryFunction>
PiiMatrix< typename
UnaryFunction::result_type >
|
Match colors in an image to a precalculated model. |
Function details
-
float operator()
(- float value
[inline] -
template<class ColorType, class UnaryFunction>
PiiMatrix< typename UnaryFunction::result_type > matchColors
Match colors in an image to a precalculated model.
This function compares colors in an image to a color model represented by
baseVectorsandcenter. The function tries to find the likelihood of a color belonging to the model. A value of one is given to a pixel whose color that is exactly atcenter. The value decreases by distance according to the formula
,
where d is the geometric distance of the color to the
center of the distribution in normalized coordinates and
f() is a user-specified function.
Parameters
- clrImage
-
the input image
- baseVectors
-
a 3-by-3 matrix in which rows represent a normalized base for the color system.
- center
-
a 1-by-3 translation vector
- func
-
an adaptable unary function that converts the distance d (a
float) to the output value. See LikelihoodFunction for an example.
Returns
an image in which each value represents the "likelihood" of that pixel belonging to the given model.
See also
Add a note
Not a single note added yet. Be the first, add yours.