colors classes to the main color classes. This step
also ranks the text color layer by frequency and
selects the main text colors. We have already
illustrated (figure 4) that the MeanShift produces
classes of outliers colors due to the existing color
transitions along characters contour. As the
Meanshift is applied only in the colorimetric space,
for each pixel independently to the other
neighbouring pixels, these color outliers cannot be
avoided. We have tested several pre-processing
algorithms such as the edge preserving smoothing
(
Nikolaou,2009) or other choc filters to suppress the
color transitions along contours. However, this kind
of pre-processing is time consuming and cannot be
used for real time applications.
We have developed a straightforward merging
process which takes into account the spatial co-
occurrence of colors classes in the segmented image
by the MeanShift. We use
TextsImage to compute
statistics about the connectivity of colors classes
found by the MeanShift. We only focus on text color
because the color of the background is useless for
our application. In the image
TextsImage, we
compute the 2D spatial co-occurrence
H2D (i,j)
equal to the number of class color
i connected
spatially to class color
j in all the inside characters of
the image
TextsImage. We use a 8-connectivity to
count correctly in one pass
H2D(i,j).We compute
H1D(i) the number of occurrence of the class color
from
H2D(i,j). C(i,j)=H2D(i,j)/H1D(j)
measures the degree of connectivity between the
class color
i with the class colorj. Color Outliers
share a high connectivity with main colors of
characters.
Algorithm 2 merges color class
i to color class j
if the connectivity
C(i,j) exceeds Cmin=0.25 and
if
C(i,j) and H1D(j)are maximal and the
colorimetric distance is minimal. To keep the color
coherency, we merge small class to large class and
not the inverse.
After merging the color classes in
ColorClass,
we repeat algorithm 2 until there is no more
changes. The iterations are necessary to merge
successively layers of colors around characters
contours. To select the right number of different text
color, we rank the text color classes in descending
order of frequency. There is a gap between two
consecutive ranked color classes of the decreasing
curve of frequencies. We set the number of text
colors in the middle of the larger gap between
successive color classes.
Algorithm 2: Color Fusion.
for all pixel (x,y)
if (TextsImage(x,y)==0) // if character
{
i=ColorClass(x,y) // from MeanShift
if (TextsImage(x-1,y)==0)
{ j=ColorClass(x-1,y) H2D(i,j)++ }
if (TextsImage(x,y-1)==0)
{ j=ColorClass(x,y-1) H2D(i,j)++ }
if (TextsImage(x-1,y-1)==0)
{j=ColorClass(x-1,y-1) H2D(i,j)++}
}
forcolor class i
forcolor class j >i
if C(i,j)>cmin
mergei to j if
{
* H1D(i)<H1D(j)
* C(i,j) is maximal
* H1D(j) is maximal
* ColorDistance(i,j) minimal
}
3.6 Algorithmic Optimization
Several hundreds of thousands of documents are
automatically processed daily by the company.
We must reduce the algorithmic complexity of each
step of the AColDPS system. The overall processing
for each image must not exceed few seconds without
parallelization. The objective consists of computing
an image in less than a second with parallelisation.
The color clustering is already optimized with a
complexity of a O(N) by using the Fast Integral
MeanShift based on integral cubes (Lebourgeois et
al., 2013). The adpative thresholding of the color
morphology results is also already optimized with
integral images (Gaceb et al., 2013). Median filter is
also computed in constant time by using partial
histograms correspondence of sliding windows
between two successive windows (Perreault, 2007).
We have speeded-up the median filtering by
applying it on a low resolution image for a degraded
result. However, the median result is just a coarse
representation of the local dominant color we use as
seeds for a conditional dilation or erosion. The
quality of the median result is not taken into account
during the process. For the morphological color
operation of dilation and erosion, integral images
cannot be used with min and max operators, only
summation of functions can be computed. To
optimize the color morphological operations of
dilation and erosion, we use the same idea from
(Perreault, 2007). Instead of computing the
statistical histogram to calculate the median values,
we compute the local maxima and minima of a
sliding window by using an horizontal raw vector
which stores the maximal/minimal values of each
VISAPP2015-InternationalConferenceonComputerVisionTheoryandApplications
182