7.3.17.2. Color Segmentation on RGBA float Images
|
(lsh/libimage/rgbafim-greypage.lsh) |
a set of function for detecting the background and foreground colors in
a document image and for transforming them into grey-level images
suitable for recognition, segmentation, etc... essentially sets the
background to 0, the foreground to 256, the rest in the middle.
7.3.17.2.0. (rgbafim-cluster-colors rgbafim ubim polarity bsatur fsatur proto weight variance)
|
(lsh/libimage/rgbafim-greypage.lsh) |
See arguments of grey-page. This function performs the actual color
clustering, using the K-means algorithm. Results in
proto : n_colors x 3 matrix = colors
of the clusters weight : n_colors
vector = weights of the Gaussian mixture for each cluster
variance : n_colors vector = variance parameter of each
cluster Gaussian distribution
See: (rgbafim-greypage rgbafim
ubim polarity
bsatur fsatur )
7.3.17.2.1. (rgbafim-project-greys rgbafim ubim polarity bsatur fsatur colors)
|
(lsh/libimage/rgbafim-greypage.lsh) |
transforms an rgb image into a grey image where the foreground is 256,
the background is 0, and the greys in between are between 256 and 0 the
resulting image can be used for segmentation and recognition.
rgbafim an idx3 of flts containing the input RGBA image.
ubim an idx2 of flts that will contain the result it should
be the same size as rgbafim
polarity determines the polarity of the image: 0 means light
background and dark foreground, 1 means dark background and light
forground, -1 should be passed if the polarity is unknown. In that case,
the color cluster with the most numerous pixels is assigned to the
background. pixel colors in rgbafim
are projected on a straight segment between two color prototypes
computed with K-means. The output pixels are given a grey value that
depends on their position along that segment. The function that maps
positions on the line to grey-levels is piece-wise linear
saturation-type function. It is controlled by two points A and B. below
A, points are assigned the value 0, above B they are assigned 256. in
between they are mapped linearly. the position of point A is determined
by the argument bsatur a value of 0
puts A on the background prototype, a value of 0.5 puts it half way
between the 2 prototypes. Point B is controlled similarly: 0 puts it at
the foreground prototype and 0.5 puts it halfway.
colors is a 2x3 matrix of rgb color clusters for the
background and foreground respectively.
7.3.17.2.2. (rgbafim-project-colors rgbafim rgbafim2 polarity bsatur fsatur colors)
|
(lsh/libimage/rgbafim-greypage.lsh) |
project the colors of an image onto a line joining two center clusters.
rgbafim an idx3 of flts containing the input RGBA image.
rgbafim2 contains the result image on output. it should be the same
size as rgbafim polarity determines the polarity of the
image: 0 means light background and dark foreground, 1 means dark
background and light forground, -1 should be passed if the polarity is
unknown. In that case, the color cluster with the most numerous pixels
is assigned to the background. pixel colors in rgbafim are
projected on a straight segment between two color prototypes computed
with K-means. The output pixels are given a grey value that depends on
their position along that segment. The function that maps positions on
the line to grey-levels is piece-wise linear saturation-type function.
It is controlled by two points A and B. below A, points are assigned the
value 0, above B they are assigned 256. in between they are mapped
linearly. the position of point A is determined by the argument bsatur
a value of 0 puts A on the background prototype, a value of 0.5 puts it
half way between the 2 prototypes. Point B is controlled similarly: 0
puts it at the foreground prototype and 0.5 puts it halfway. colors
is a 2x3 matrix of rgb color clusters for the background and foreground
respectively.
7.3.17.2.3. (rgbafim-quickquant rgbafim ubim ppal assign)
|
(lsh/libimage/rgbafim-greypage.lsh) |
quick color quantization using result of cqu-kmeans
rgbafim is the RGBA image to be quantized
ubim is the output image (of floats). It must be the same
size as rgbafim .
ppal is the color histogram as computed by rgbafim-histo32
assign is the vector of color labels for each color in the
histogram this is "quick" only for fairly large images.
7.3.17.2.4. (rgbafim-greyquant rgbafim ubim proto polarity bsatur fsatur)
|
(lsh/libimage/rgbafim-greypage.lsh) |
transforms and RGB image into a grey image with uniform foreground and
background. proto is a 2x3 matrix of
floats containing two color prototypes for background and foreground
colors. transforms an rgb image into a grey image where the foreground
is 256, the background is 0, and the greys in between are between 256
and 0 the resulting image can be used for segmentation and recognition.
rgbafim an idx3 of flts containing the input RGBA image.
ubim an idx2 of flts that will contain the result it should
be the same size as rgbafim
polarity determines the polarity of the image: 0 means light
background and dark foreground, 1 means dark background and light
forground, -1 should be passed if the polarity is unknown. In that case,
the color cluster with the most numerous pixels is assigned to the
background. pixel colors in rgbafim
are projected on a straight segment between two color prototypes
computed with K-means. The output pixels are given a grey value that
depends on their position along that segment. The function that maps
positions on the line to grey-levels is piece-wise linear
saturation-type function. It is controlled by two points A and B. below
A, points are assigned the value 0, above B they are assigned 256. in
between they are mapped linearly. the position of point A is determined
by the argument bsatur a value of 0
puts A on the background prototype, a value of 0.5 puts it half way
between the 2 prototypes. Point B is controlled similarly: 0 puts it at
the foreground prototype and 0.5 puts it halfway.
colors is a 2x3 matrix of rgb color clusters for the
background and foreground respectively.
7.3.17.2.5. (rgbafim-projectcolors rgbafim rgbafim2 proto polarity bsatur fsatur)
|
(lsh/libimage/rgbafim-greypage.lsh) |
Basically does the same thing as
rgbafim-greyquant , but builds a color image instead of a gey
image.
See: (rgbafim-greyquant rgbafim
ubim proto
polarity bsatur
fsatur )