You are on page 1of 6

IEEE ISIE 2006, July 9-12, 2006, Montreal, Quebec, Canada

Parquet Sorting

and Grading Based on Color and

Texture Analyses
D. Rozman, M. Brezak, I. Petrovic

Department of Computing Engineering in Automation


Faculty of Electrical Engineering and Computing
University of Zagreb, Zagreb, Croatia

more complex. Classification of wood surfaces is especially


challenging because of the strongly varying appearance of
wood. Various methods for automated visual inspection of
wooden surfaces have been developed [2].
In this work performance of various pattern recognition
techniques applied for wood sorting application have been
compared. Our goal was to find out how the performance of
color based wood inspection systems could be improved by
combining color and texture features. The performance of
proposed approach was tested in parquet slab inspection.
Standard DIN 280, part 2, defines three possible parquet slab
classes. According to this standard the class of the parquet is
determined by measuring the sizes, types and number of
defects and a distribution of color and texture regions on the
parquet slab surface. It is necessary to emphasize that the
parquet slab class definition described in sense of visual
information for observer and there are not any mathematically
defined criteria for the description of the parquet slab class.
The slab is classified to the best grade whose requirements it
fulfills. Of course human graders seldom follow strict
numerical definitions about the defects. Instead the grading is
based mainly on the general visual appearance of the parquet
slabs. Therefore the results are difficult to compare to the ones
achieved by human graders. Parquet slabs of three defined
classes are shown on the figures 1, 2 and 3.

Abstract - In this paper a computer vision algorithm for


automatic parquet slab sorting is described, as a part of a real
time automatic parquet slab sorting system. Various computer
vision algorithms and methods for automatic visual inspection
and automatic classification have been analyzed. Developed
algorithm consists of three main stages: color analysis, texture
analysis and defects detection. The color analysis is based on the
percentile values obtained from the cumulative histogram of the
image and texture analysis is based on the second order statistical
features obtained from gray level co-occurrence matrix.
Detection of defects is implemented as the segmentation method,
based on the adaptive binary threshold algorithm, which is based
on a local square regions and connected component analysis
methods. This way we have achieved a very accurate classifying
process with about 90 percent of accuracy, which greatly
outstands results of human inspector, that are about 60-70
percent.
I. INTRODUCTION

In many manufacturing processes visual inspection plays an


important role in the quality control. Traditionally, this job has
been mainly carried out by human inspectors. The use of
human workers in routine tasks like this should be avoided if
possible, because results in manual inspection are often worse
than one could expect, since the performance of a human
inspector has a strong tendency to drop radically in
uninteresting jobs. A human inspector is also quite insensitive
to gradually occurring small changes. Human made grading is
often inconsistent. There have been observations that the
correspondence between different graders is surprisingly low.
In a test of four grades two different graders gave the same
grade for only 60% of the boards [1].
To overcome these difficulties, in recent time visual
inspection has been introduced. The benefits of automated
inspection in wood industry are easily demonstrated. In lumber
production the product volumes are huge and therefore even
small improvements in quality result in considerable savings
and earnings because high graded wood is considerably more
expensive than low graded or nongraded wood.
For visual inspection of wood surfaces, grey level and color
cameras are used most often, but there are also numerous
applications where special sensors like X-ray, laser profile,
microwaves and electronic colorimeter are used. Usually the
color is considered to be important in grading of wood surfaces
and inspection of smooth uniformly colored surfaces can be
automated quite easily. But the quality of wood surfaces can
not be evaluated only on color, and also texture features must
be considered, which makes the automating problem much
1-4244-0497-5/06/$20.00 2006 IEEE

Fig. 1. Oak parquet slab of class Nature

Fig. 2. Oak parquet slab of class Gestreift

Fig. 3. Oak parquet slab of class Rustik

655

obtained for every color channel of RGB and HSI color space
of analyzed parquet image defined like:

II. COLOR ANALYSIS

Color analysis is based on a two different methods, both


based on the first order histogram of a color image. First
method is extraction of first order statistical features derived
from a normalized first order histogram. Second method is
based on a calculation of a so-called percentile values from a
first order cumulative histogram.

N-1IM-1

NM~E0o E0= (f (x, y), i),

(1)

where f(x, y) is the image, N and M are image width and


height, and 3 is a Kronecker delta function defined like:

8(i,j)=

i= J

i j

G-1

G-1

(i

(2)

p(i

-3

G-1
5

P)4 p (i) 3,

(i

i =O

G-1
=

[p(i)]

(5)
(6)

(y)

f f= (y1 )

x,

fk (y2 )

fjk (IOOo) f (O )

(1 1)

(12)

(13)

(7)

Maximum and minimum percentile values may be unreliable


because of saturated noise in the images. Therefore it is safer to
use, for example, 950 and 50 percentiles. It should be noted
that color percentile features could be used in other color
spaces than RGB as well. The only requirement is that the
values measured cannot be circular, i.e. the smallest value is
close to the largest value. This is the case for example with the
hue in HSI color space. In this kind of situation the starting
point for calculating the cumulative histograms cannot be
defined.

i=O

G-1

(10)

These percentile difference values can be computed also for


different color channels, which give information about the
relative positions of histograms of different channels. This can
be useful in recognizing certain color defects. Invariance
against the width of the histogram can be achieved by
normalizing percentile differences. This is done by scaling with
the difference of maximum and minimum percentile values:

H =Z- p (i)ln [p (i)],

p(X).

f f= (Y1) fk (Y2).

(4)

i =O

4 =

where y is a value of the cumulative histogram value in the


range [0%0, 100%]. As it can be seen, the concept of percentile
is extended to have any real value between 0 and 100, so the
name percentile might be misleading.
Percentile features are sensitive to intensity changes because
they measure direct values of color channels. Invariance
against the shift of the histogram can be achieved by
calculating differences of two percentiles as shown in (12):

i =O

G-1

(i)

fk (y)

(3)

_)2p(i),

(9)

The value for the percentile feature is the value of x when


C, (x) is known. If the color percentile feature value is
denoted with fk (y) the relationship is described as

i=O

2 =

H] .

x=O

First order statistical features provide information on the


distribution of pixels on a digital image, but do not give any
information on their relative positions. Thus, these are the
features characterizing contrast (strength of the patterns) and
the color distributions of the image, but not its spatial structure.
First order statistical features are defined according to [3]. It is
possible to define the following characteristic coefficients:

A = L,ip(Wi)

Recently, a method based on color percentile (CP) features


for wood inspection has been proposed [4]. The method is
computationally very simple and has performed very well in
various inspection problems. The color percentile features are
calculated from cumulative color channel histograms Ck(X),
which is the sum of normalized histogram p(i) of color channel
k for all the values that are smaller than or equal to x. It is
defined like the cumulative sum:

expression
I

14

B. Percentile values

A. First order statisticalfeatures


First order statistical features are extracted from a
normalized image histogram, which is calculated using the

p(i) 1=

/'3

[i

(8)

i=o

where ,u is the mean value of histogram, U2 iS the variance, pt3 iS


the skewness, t4 is the kurtosis, E is the energy and H is the
entropy of analyzed image histogram.
After calculating given statistical features a feature vector is
obtained by combining those features. Feature vector is

656

For a feature vector describing the color of a parquet slab, a


feature vector composed of five different percentile values is
obtained for every color channel of RGB and HSI color space:
X

IX0.2

xI

x0

x50

F7(0, 0) 17(0,1) 17(0,2)


C d(i,J)

(14)

x95

experiments.

III. TEXTURE ANALYSIS


As shown later in this paper, using only color analysis for
parquet slabs classification doesn't give satisfying results, so a
texture analysis is combined with color analysis. There are
many possible methods for texture classification, and in this
paper we use second order histogram statistical features as a
one of simplest and most used methods in texture analysis.

(m)=

i,

or

;T

((a, b), (c, d))

(18)

M-1 N-1

= -E

(i, j) log C d(i, j)

(19)

i=O j=O

M-1 N-1

AV

E, E,

i=O j=O

i - jl CoC(d (in)

(20)

M-1 N-1

1DM= E

j)

i=0 j=0 1+(i

d(' j)

I=Ei_j))2 Cd('nJ)
M-1 N-1

(21)

(22)

i=O j=0
a,

(n)= j},

=max (la -

(2,2)_

=EEc d(i,j)

M-1 N-1

Zd((i

Cs =

i=O j=O

(15)

where d(a, b) is appropriate metrics, usually


d

(17)

i=O j=O

Cd (ij) = {(m,n) E (M xN) x(M xN): d(m,n) = d,

tan-' (m n) =

M-1 N-1

A. Second order statisticalfeatures


Second order statistical features consider pixels in pairs and
give information on their relative positions. Hence, they
characterize a texture by providing information on contrast and
spatial structure. A pair of pixels is determined by two values,
relative distance d and relative orientation a. For every
combination of d and a a two-dimensional histogram is
defined, according to [3], as a ratio between the number pixel
pairs at distance d in direction a with values (i, j) and the total
number of possible pairs of pixels. Mathematically this method
can be described with expression:

7(1,1)
L77(2,o) 7(2,1)
17(10,)

where (i7j) is the number of pixel pairs at relative position


(d,a) with values (ij). R is the total number of possible pixel
pairs. The definition of the co-occurrence matrix implies its
symmetry, which enables further reduction and gives a
possibility of separating certain coefficients that efficiently
encode image texture.
From the GLCM, according to [3] it is possible to extract
many different statistical features. In this paper only six of
them were used, which gave the best grading results. These
features are:

For a percentile values, as shown in (14), values of 0.2, 1,


10, 50 and 100 percent of cumulative histogram were selected
as a combination of values which give best results in the

I=

c|, |b - d|),

M-1 N-1
Cp

(16)

Y0((ij
i=O j=O

and f ((M x N) > N (O, G -1)) is analyzed digital picture


where NG is number of gray levels.
Relative distance d is measured by the number of pixels (d
1 for neighboring pixels, etc.). Relative orientation
can be
any angle between 00 and 3600, but the expression (15) ensures
symmetry around main diagonal of calculated second order
histogram matrix, called Gray Level Co-Occurrence Matrix,
GLCM, so in practice there are used only angles quantized in
four directions: horizontally or 00, diagonally or 450, vertically
900, and antidiagonally or 1350, or a sum of combination of
any given quantized angles.
A GLCM for pair (d, a) is defined as an NGxNG matrix,
where NG is the image depth. E.g. if NG= 3, then the image is
equal to:

Pi) + (j

pi))' c", (i, j)

(23)

Pi) + (j

pi))' c", (i, j)

(24)

(i -pi) ( j

(ij

(7i C7i

i=O j=

(25)

M-1 N-1

HC

i=

Z(ij) C,,d (i,j)

'lily

j=O

(26)
y

where E is energy, H is entropy, A V is absolute value, IDM is


inverse difference moment, I is inertia or contrast, C is
correlation and HC is Haralicks correlation. vi and oj are
defined like:
NC -1

E=Y ( i -)2
i=O

657

NC -1
E
j=O

C, ( i j)

(27)

i)2Zci
C
j ) C

jO

(inj)

(')

ll

0.04

(28)

i=O

where pi uy are mean values and cx and cy are standard


deviations of matrix rows and columns respectively.
From the given second order statistical features a feature
vector is composed as a combination, which gives best results
in experiments. Finally, feature vector is computed for every
channel of used color space and is defined like:
,

xcm

[E

AV

IDM

C]

(29)

where

Im

max

((I.)

(33)

150

/ ?l

h(max)

250

k(max)

-h

on

image

(34)
(35)

Classifiers
The main goal of our experiments was to find optimal set of
color and texture features, which gives the best classification
results.
We have compared performance of following classifiers:
Minimum Distance Classifier (MD) [13], Nearest Neighbor
Classifier (NN) [10], and K Nearest Neighbors Classifier
(KNN) [12].
These classifiers were chosen because of performance
reasons, as they have low complexity, but still give satisfying
results on high-dimension feature spaces.
The experiments were performed on 20 images of parquet
slabs of every class, all together 60 images. Because of
relatively small number of images, there was no possibility to
divide this set of images in two separate sets, one for learning
and one for testing, so we used Leave One-Out testing method
[11], which gives satisfying results on small learning sets.

B.

Color analysis
The first step was comparison of different color analysis
methods in order to obtain best classification results. As
already mentioned, best classification results are obtained with
feature vectors defined with (9) and (14). Using these feature
vectors, a comparison of different color spaces and different
classifiers is also performed. For every color channel of RGB
and HSI color spaces feature vectors were computed, so that
final feature vector can be defined like:

(31)

(32)

Intensity

A.

(30)

p- (Nma )

100

V. EXPERIMENTAL RESULTS

RX is original image, b E {0,1} is thresholded

= max (p (i))

250

200

ax

where Nmax is maximum value of probability histogram p (i),


Pma percentile value of
Imax intensity of maximum value Nma P,
cumulative histogram c, (i) for I and h, and k, are
experimentally defined percentile values of cumulative
histogram C, (i). The described threshold determination
method is illustrated in image 4.

image and [h (max), k (max)] is defined adaptive


boundary range for binary thresholding.
Adaptive thresholding boundaries h (max) and k (max) are
calculated using the following terms:
N

150

k(max) = c'(Pm +k),

A. Adaptive thresholding
Adaptive thresholding is an extension of simple thresholding
techniques. In this paper adaptive thresholding boundaries are
recalculated for every new processed image using the image
cumulative histogram. Mathematically this method is described
with equation:
,

50

h (max) =c 1 (P

2. Segment the image using a binary threshold on a pixel


level;
3. Count up pixels of value 1 in thresholded image in every
single local rectangular regions
4. If a number of pixels in local rectangular region exceeds
defined limit number of pixels, name the analyzed region
as a defect
5. Using connected component analysis methods get the
position and size of every single defect
6. Using some classification method get the class (type) of
defect

h(max) < a(x) < k(max) VxX


else

Intensity

Fig. 4. Determination of adaptive thresholding boundaries


cumulative histogram

regions size n xn pixels;

za

100

-a

IV. DEFECT DETECTION


Proposed defect detection method is based on a
segmentation method, which uses adaptive thresholding in
local rectangular regions. Segmentation method of defect
detection is a very fast and very effective method [5]. This
method consists of following steps:
1. Divide the parquet slab image on local rectangular

{1,

50

658

X-

[T -2T X3T]

For every possible combination of angle (37) and distance


(38), GLCM of every color channel of HSI color space was
calculated. Then the feature vector (29) of every channel was
calculated. Final texture analysis feature vector for all three
color channels was:

(36)

where subscripts 1, 2 and 3 denote R, G and B channel of RGB


color space, or H, S and I channel of HSI color space, and xi is
feature vector of respective color channel defined with (9) or
(14).
Also the comparison of MD, NN and KNN classifiers was
performed, where numbers of nearest neighbors K of KNN
classifier were K = 3, K = 5 and K = 7. The results obtained
with Leave One-Out method of classification are shown in
Table I and Fig. 5. From the obtained results we can conclude
that the best method for color analysis is the one that uses
percentile features based on the HSI color space, which gave
the best results for all used classifiers.
TABLE I.

Features

Statistical

Statial

ercentile

Classifier

space
RGB

I-NN

3-NN

5-NN

7-NN

69.84
68.25

MD
71.43
71.43

66.67
77.78

65.08
77.78

71.43
82.54

71.43
77.78

66.67
71.43

71.42
66.67

HSI
HSI

RGB

77.78
69.84

66.67
65.08

x cms

_x
X

XCcm

--------4)

7d50
l40.
----------------------

------------

-4-

..&. RGB statistical features


-.0. HSI statistical features

--t--&3-NN

5-NN

Classifier

percentile features
percentile features

RGB

--s- HSI

NN

7-NN

MD

Fig. 5. Results of color analysis

C. Combined color and texture analysis


Considering texture analysis, best classification results are
obtained with feature vector of second order statistical texture
features based on GLCM and defined with (29). Because HSI
color space has manifested like the supreme color space in
color analysis, in texture analysis methods we also use HSI
color space. Thus, feature vector (29) is computed for every
channel of HSI color space. Here the comparison of
classification performance for different angles a and distances
d of GLCM is done.
GLCM was calculated with the following angles:

ax = {0,450,90,135,0 + 450 + 900 + 1350},

{1,3,5}.

(40)

Classifier
1-NN 3-NN
75.81 80.65
75.81 77.42
79.03 80.65
82.26 87.10
77.42 80.65
79.03 82.26
82.26 80.65
85.48 83.87
88.71 83.87
77.42 80.65
79.03 79.03
80.65 75.81
80.65 83.87
79.69

7.69

87.10

81.25
81.25
87.10

5-NN

80.65
80.65
72.58
87.10
80.65
74.19
79.03
82.26
83.87
83.87
79.03
74.19
87.10
82.81
82.81
70.97

7-NN

79.03
79.03
77.42
83.87
79.03
80.65
85.48
85.48
88.71
80.65
82.26
75.81
83.87
87.50
7.50
74.19

MD
75.80
74.19
72.58
75.80
74.19
72.58
72.58
72.58
74.19
79.03
74.19
72.58
77.42
78.13

78.13

70.97

Examination of obtained results of combined color and

texture analysis leads to conclusion that the accuracy of every


classifier has increased compared to color only based

classification. The best results of classification have been


obtained with the second order statistical features obtained
from GLCM calculated with distance and angle pair a = 900
and d= 5.
In Fig. 6 results of the best method in color only analysis,
and results of the best combined color and texture analysis
method are shown. We can conclude that the combined color
and texture analysis rapidly increases accuracy of classification
compared to color only analysis methods.

(37)

where sum in expression (37) stands for combination of given


angles. The compared distances d were:
d =

(39)

TABLE III.

Dist.
d
cc
1
00
2
5
1
450
2
5
1
900
2
5
1
2
1350
5
1
Combination
22
of angles
_____5

80<

20-

TABLE II.
RESULTS OF COMBINED COLOR AND TEXTURE ANALYSIS
METHOD RESULTS OF COLOR ANALYSIS METHOD DESCRIBED AS CLASSIFIER
ACCURACY IN PERCENTS

Angle

30-

x cmI

MD, NN and KNN classifiers were compared, where the


number of nearest neighbors K of KNN were K = 3, K = 5 and
K = 7. The results obtained with Leave One-Out method of
classification are shown in Table II and Fig. 6.

90

,0

-T]T
XS

100-

00

The final feature vector for color and texture analysis is


obtained by combining the vectors (36) and (39), i.e. by
combination of percentile values and second order statistical
features of every channel of HSI color space, using the
expression:

RESULTS OF COLOR ANALYSIS METHOD DESCRIBED AS


CLASSIFIER AccURACY IN PERCENTS
Color

LkcmH

CM

(38)

659

REFERENCES
[1]
]

[2]

60X5040-

[3]

30

_
1010
NN

[4]

Xiy
@ CColorAnalysisl
i
_4- Combined Color and Texture Analysis
3-NN

5-NN

Classifier

7-NN

MD

[5]

Fig. 6. Comparison of only color analysis and combined color and texture
analysis.

[6]

VI. CONCLUSIONS

[7]

Based on obtained experimental results, we can conclude


that only color information is not sufficient for accurate parquet
slab sorting. But with combination of color and texture
information we have achieved a very accurate classifying
process with about 90 percent of accuracy, which greatly
outstands results of human inspector, that are about 60-70
percent.
It must be emphasized that these results are obtained on a
relatively small learning set of parquet slab images. Using a
larger learning set with images of boundary parquet slabs in
combination with intelligent classifier, like neural network
based self organizing maps, even better accuracy could be
achieved.
Except of accuracy, our algorithm is relatively fast, and can
process about 15 parquet slabs per second running on a 2.4
GHz Pentium IV processor. This is achieved using fast
machine vision algorithms.
In addition, except for parquet slab sorting, our algorithm,
combined with new learning set of images, can be used for
very large number of visual inspection applications, like
surface inspection or sorting and classifying large number of
industry products.
Future work will include experiments with intelligent
classifiers, in order to improve classification results.

[8]
[9]

[10]

[11]
[12]

[13]

660

T. NEWMAN, A. JAIN, "A Survey of Automated Visual Inspection",


Computer Vision and Understanding, 61:231-262, 1995
0. SILVEN, H. KAUPPINEN, "Recent Developments in Wood
Inspection", International Journal of Pattern Recognition and Artificial
Intelligence, 10:83-95, 1996
R. Haralick, K. Shanmugam, I. Dinstein, "Textural Features for Image
Classification", IEEE Transactions on Systems, Man and Cybernetics
3:610-621, 1973
H. KAUPPINEN, "Development of a Color Machine Vision Method for
Wood Surface Inspection", PhD thesis, University of Oulu, Oulu, 1999.
H. KAUPPINEN, "Two Stage Defect Recognition Methodfor Parquet Slab
Grading", Proc. 15th International Conference on Pattern Recognition,
Vol IV, pp 803 - 806, 2000.
R. W. CONNERS, C. W. MCMILLIN, K. LIN, R. E. VASQUEZ - ESPINOSA,
"Identifying and Locating Surface Defects in Wood: Part of an
Automated Lumber Processing System", IEEE Transactions on Pattern
Recognition and Machine Intelligence, Vol V, pp 573 - 583, 1983.
T. MAENPAA, M. PIETIKAINEN, "Classification with Color and Texture:
Jointly or Separately? ", Pattern Recognition, 8, pp 1629 - 1640, 2004.
J. IIVARINEN, "Surface Defect Detection with Histogram - Based Texture
Features ", Intelligent Robots and Computer Vision XIX: Algorithms,
Techniques, and Active Vision, Proc. SPIE 4197, pp 140 - 145, 2000.
T. PETKOVIC, J. KRAPAC, S. LONCARIC, M. SERCER, "Automated Visual
Inspection of Plastic Products", Proceedings of the 11th International
Electrotechnical and Computer Science Conference ERK 2002, pp 283 286, 2002.
T.M. COVER, P. E. HART, "Nearest Neighbor Pattern Classification",
IT, No. 1, 1967, pp. 21-27, 1967.
K. FUKUNAGA, D.M. HUMMELS, "Leave-One-Out Procedures for
Nonparametric Error Estimates", PAMI, No. 4, pp. 421-423, 1989
J. S. PAN, Y. L. QIAO, S. H. SUN, "A Fast K Nearest Neighbors
Classification Algorithm", IEICE Transactions on Fundamentals of
Electronics, Communication and Computer Sciences, vol. E-87-A, No.
3, pp. 961-963, 2004.
P. J. VAN OTTERLOO, I.T. YOUNG, "A distribution-free geometric upper
bound for the probability of error of a minimum distance classifier",
PR(10), No. 4, pp. 281-286., 1978.