Into

Modules

Documentation

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
(
  • float value
)
template<class ColorType, class UnaryFunction>
PiiMatrix< typename UnaryFunction::result_type >
(
  • const PiiMatrix< ColorType > & clrImage
  • const PiiMatrix< double > & baseVectors
  • const PiiMatrix< double > & center
  • UnaryFunction func
)

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

    (
    • const PiiMatrix< ColorType > & clrImage
    • const PiiMatrix< double > & baseVectors
    • const PiiMatrix< double > & center
    • UnaryFunction func
    )

    Match colors in an image to a precalculated model.

    This function compares colors in an image to a color model represented by baseVectors and center. 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 at center. 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
Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.