cppcode/colorfilteringIPOL.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  paramColorFilter
 Data structure containing the parameters of the filtering algorithm. More...

Functions

struct paramColorFilternew_colorfiltering_parameters (int rneigh, int rsim, int nneighmin, float eitmax, unsigned char option, unsigned char ignore000)
 Organize input parameters in a data structure.
void delete_colorfiltering_parameters (struct paramColorFilter *param)
 Delete input parameters data structure.
int colorfiltering (unsigned char *R, unsigned char *G, unsigned char *B, unsigned char *outR, unsigned char *outG, unsigned char *outB, int w, int h, struct paramColorFilter *param)
 Main function implementing the color filtering algorithm (LLP algorithm).
float *** RGBdensities (unsigned char *R, unsigned char *G, unsigned char *B, int w, int h, int rdst, float hdst, float &maxdst)
 Compute the density of the colors of an image.
void delete_RGBdensities (float ***dsts)
 Delete data structure containing density values.
void removeisolatedRGB (unsigned char *R, unsigned char *G, unsigned char *B, unsigned char *outR, unsigned char *outG, unsigned char *outB, int w, int h, int r, int nmin, int &nRGB, int &nisolatedRGB, int &nisolatedpixels)
 Filter out "isolated" colors in RGB space, that is, colors with a small number of neighbors.

Function Documentation

int colorfiltering ( unsigned char *  R,
unsigned char *  G,
unsigned char *  B,
unsigned char *  outR,
unsigned char *  outG,
unsigned char *  outB,
int  w,
int  h,
struct paramColorFilter param 
)

Main function implementing the color filtering algorithm (LLP algorithm).

Algorithm description (LLP algorithm)

Image colors are considered as points in a 3D space, namely the color cube. The algorithm replaces each RGB color in the cube by its projection onto a line (or plane) locally defined. This line (or plane) is the one that better fits the spatial distribution of the colors in a neighborhood of the considered RGB point, and it is computed by Principal Components Analysis (PCA). Only points with a large enough number of neighboring colors are projected. The process is iterated until the average error between corresponding colors in consecutive iterations is below a threshold.

Parameters:
[in] R,G,B pointers to red, green and blue channels of the input image
[out] outR,outG,outB pointers to red, green and blue channels of the output image
[in] w,h width and height of the input (and output) images
[in] param data structure with the parameters of the algorithm:
param.rneigh radius of local neighborhood for computation of lines or planes
param.nneighmin minimum number of neighbors (number of different colors) needed to compute lines or planes
param.rsim speed up factor, the same line or plane computed for a given RGB point is used for its neighbors at L1-distance $ \leq $ rsim
param.eitmax stop criterion of the algorithm. The algorithm is iterated until the average difference of corresponding colors in two consecutive iterations is below eitmax
param.option 1 project to line, 2 project to plane
param.ignore000 if TRUE ignore (0,0,0) color points (eventually belonging to pixels discarded in a pre-processing step)
Returns:
number of iterarations of the algorithm

Definition at line 1017 of file colorfilteringIPOL.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void delete_colorfiltering_parameters ( struct paramColorFilter param  ) 

Delete input parameters data structure.

Definition at line 1151 of file colorfilteringIPOL.cpp.

Here is the caller graph for this function:

void delete_RGBdensities ( float ***  dsts  ) 

Delete data structure containing density values.

Definition at line 1247 of file colorfilteringIPOL.cpp.

Here is the caller graph for this function:

struct paramColorFilter* new_colorfiltering_parameters ( int  rneigh,
int  rsim,
int  nneighmin,
float  eitmax,
unsigned char  option,
unsigned char  ignore000 
) [read]

Organize input parameters in a data structure.

Parameters:
[in] rneigh distance defining the neighborhood of a color point (neighbors are RGB points at L1-distance below rneigh)
[in] rsim distance defining a small neighborhood around each color point, it is used to speed up the algorithm. It must be much smaller than rneigh, typically rsim=rneigh/3
[in] nneighmin minimum number of neighbors needed to compute a local line or plane in the vicinity of a color point
[in] eitmax stop criterion of the algorithm. The algorithm is iterated until the average difference of corresponding colors in two consecutive iterations is below eitmax
[in] option project points to lines (option=1) or planes (option=2)
[in] ignore000 if set to 1, do not take into account pixels with (0,0,0) RGB value (eventually discarded for computation in a preprocessing step)
Returns:
Data structure containing the input parameters

Definition at line 1129 of file colorfilteringIPOL.cpp.

Here is the caller graph for this function:

void removeisolatedRGB ( unsigned char *  R,
unsigned char *  G,
unsigned char *  B,
unsigned char *  outR,
unsigned char *  outG,
unsigned char *  outB,
int  w,
int  h,
int  r,
int  nmin,
int &  nRGB,
int &  nisolatedRGB,
int &  nisolatedpixels 
)

Filter out "isolated" colors in RGB space, that is, colors with a small number of neighbors.

The result is an image identical to the original, except at the pixels with "isolated" colors, whose value has been replace by (0, 0, 0). The number of neighbors of a pixel is the number of color points at L1-distance below some threshold. Each color appears in the list of neighbors as many times as it is present in the image (i.e. the frequency of the color is taken into account in the computations).

Parameters:
[in] R,G,B color channels of the input image
[out] outR,outG,outB color channels of the output image
[in] w,h dimensions of input and output images
[in] r radius of the neighborhood around each color point
[in] nmin threshold for the minimum number of neighboring color points needed to decide that a color is not "isolated"
[out] nRGB number of colors in input image
[out] nisolatedRGB number of "isolated" colors
[out] nisolatedpixels number of pixel with "isolated" color

Definition at line 1284 of file colorfilteringIPOL.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

float*** RGBdensities ( unsigned char *  R,
unsigned char *  G,
unsigned char *  B,
int  w,
int  h,
int  rdst,
float  hdst,
float &  maxdst 
)

Compute the density of the colors of an image.

The density of a color C (in RGB space) is defined as

\[ \delta(C)=\sum_{C' \in {\cal S}} e^{-d(C, C')^2/h^2} \]

where $ {\cal S} $ is the set of neighbors of C $ d(C, C') $ is the Euclidean distance between colors C and C' in RGB space and $ h $ is a weighting parameter

The set of neighbors of a color C is composed of all the colors at L1-distance below some threshold $ r $. Each color appears in the set of neighbors as many times as it is present in the image (i.e. the frequency of the color is taken into account in the computations). Tipically the weighting parameter is $ h = r/\sqrt{2} $ so the weight of the furthest neighbors is $ e^{-2}=0.135 $

Parameters:
[in] R,G,B color channels of the image
[in] w,h dimensions of the image
[in] rdst radius of the neighbor around each color point
[in] hdst weighting parameter
[out] maxdst maximum density value
Returns:
density of each RGB point of the image

Definition at line 1186 of file colorfilteringIPOL.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Files Functions Variables Defines
Generated on Fri Jul 8 12:55:46 2011 for color dimensional filtering by  doxygen 1.6.3