Abstract
Abstract-This paper presents a quality control vision system developed for the inspection of cork parquets that is already applied in the Portuguese cork industry. It is devoted specifically to the most critical quality issues: visibility of the lowest layer (BASE) on the noble layer (UPPER) and the homogeneity of this noble layer. Since these aspects are related with the texture of the raw material, the system was based on texture segmentation techniques. Features used were extracted from detail images of the wavelet transform. The classifier consists of a fuzzy grammar inference system. The segmentation procedure revealed a good performance indicated by high classification rates. Behavior in the industrial environment has been demonstrating high performance, revealing good perspectives for full spread industrialization.

Abstract-This paper presents a quality control vision system developed for the inspection of cork parquets that is already applied in the Portuguese cork industry. It is devoted specifically to the most critical quality issues: visibility of the lowest layer (BASE) on the noble layer (UPPER) and the homogeneity of this noble layer. Since these aspects are related with the texture of the raw material, the system was based on texture segmentation techniques. Features used were extracted from detail images of the wavelet transform. The classifier consists of a fuzzy grammar inference system. The segmentation procedure revealed a good performance indicated by high classification rates. Behavior in the industrial environment has been demonstrating high performance, revealing good perspectives for full spread industrialization.

Index Terms-Computer vision, fuzzy grammar, industrial application, inspection system, texture segmentation.
I. INTRODUCTION
T HE CORK industry has an important economic impact on Portuguese industry as a whole. One of the growing sectors is related to the manufacture of parquets for decoration and insulating. The main raw material used in the productive process is cork in the form of cork scraps, cork bits and waste, and thin virgin cork (cork which is not adequate for the manufacture of natural caps). This sector is characterized by high degree of heterogeneity of its products, which is extremely related with the public preferences and the faction's designers.
I. INTRODUCTION
The productive process can be divided in to three main stages: the manufacture of agglomerate blocks; the manufacture of crushed products; and the finishing of agglomerates. During these industrial processes, there occur some problems that generate defects in the final products.
I. INTRODUCTION
There are two cork parquets in the Portuguese cork industry which, due to their great production rates, are the most popular ones. One of the cork parquets type is composed of three cork layers. The first layer remains in contact with the floor and is called the BASE layer. The second layer is visible and is named UPPER layer. Finally, a third layer, named MOTIVE layer, is made of larger and thicker pieces of cork, which are placed randomly above the UPPER layer. The other cork parquet type has only two layers: the BASE and the UPPER layers.
I. INTRODUCTION
To achieve an effective quality control of these products, several parameters must be evaluated and estimated. The most important of them are the following: 1) the geometry of the Fig. 1(d) ]. The last one is related to the MOTIVE layer distribution over the UPPER layer. At present, the quality control of these products is assured by specialized workers, who perform an intensive manual visual inspection of the products. This inspection, besides slowing down the production rate, is very dependent on the worker subjectivity. An automatic inspection system is highly important for this sector, and therefore, automatic classification equipment, specifically able to be used in the cork parquet industry, was specified and developed.
I. INTRODUCTION
According to the type of materials and with the nature of the quality problems, two vision systems were developed with different computer vision techniques specifically based on texture (for the detection of the BASE layer in the UPPER and for the MOTIVE layer distribution), color (for the detection of strange objects and color drift), and region analysis (for geometry evaluation).
I. INTRODUCTION
The system to verify the geometry of the parquet uses a Pulnix monochrome camera with an image size of 1024 × 1024 pixels and a Matrox Pulsar acquisition board. The major problem working in the industrial environment was related with the illumination conditions. To minimize problems, such as flicker and specular reflections, a specific illumination setup 0278-0046/$25.00 © 2009 IEEE was projected. The illumination is based on high-frequency fluorescent light, in a frontal position. The illumination setup simulates a kind of cloudy day light, which was achieved with a white box in a diffuse material where fluorescent light points toward the box interior. The result is an image with a high degree of illumination uniformity on the cork parquet. To detect the color defects, a color image is used, acquired by a JAI color camera and a Matrox acquisition board (model Meteor). The illumination used was of the same type described for the geometric defects. Concerning the texture defects, the used image was the same acquired to control the geometry properties. Fig. 2 shows the layout of the prototype showing the material flow direction and the vision system positions. This paper is devoted specifically to the description of the approach developed to detect the visibility of the BASE layer in the UPPER layer and the homogeneity in the visible UPPER layer, which was based on texture analysis techniques.
I. INTRODUCTION
Texture analysis continues to play an important role in many application areas, with its use increasing with the availability of faster processors, such as medical imaging, biometrics, remote sensing, tracking objects in robotics, image retrieval, and industrial inspection; its tasks are mainly classification and segmentation [1] - [9] .
I. INTRODUCTION
The classical techniques for analyzing, texture can be classified as statistical, structural, and spectral [9] - [11] . New ones have been more recently under research, such as features extracted from the wavelets transform [12] - [15] , Gabor filters [16] - [19] , fractals [1] , [2] , [20] , mathematical morphology [22] , [23] , Markov random fields [24] , [25] , feature-based interaction maps (FBIMs) of pixels [26] , and fuzzy logic techniques [27] .
I. INTRODUCTION
The segmentation techniques based on the wavelet transform, Gabor filters, fractals, and FBIMs deserve special attention, mainly because of their similarity with the human vision system, which processes visual information in a multiscale manner. In this way, they incorporate the notion of scale, allowing the identification of micro-and macrotextures.
I. INTRODUCTION
Regarding the classifiers and recognizers, there are also different approaches. The most common solutions use recognizers based on the calculus of metrics like Euclidean, Minkowsky, and Mahalanobis distance measures. Others use multivariate statistical approaches [based on principal component analysis and partial least squares], Hidden Markov Models, and softcomputing techniques (neural, fuzzy logic, and neurofuzzy networks) [28] - [36] . However, these recognizers, even the unsupervised, demand a great amount of samples from the population to perform the learning procedure. Consequently, the commercial available vision solutions for texture segmentation are not completely appropriated for quality control in industrial environments. Specifically, their limitations concern the capability to learn "online" new texture patterns and to deal with a great number and type of textures.
I. INTRODUCTION
An important observation regarding the works previously mentioned is the fact that the validation is made using a restrict number of textures (typically, 5 to 40 images). Other conclusion is that different authors use different texture images and different image resolutions, which increase the difficulty to compare the performance of the segmentation techniques.
I. INTRODUCTION
The approach presented in this paper was developed concerning two major constraints: the production speed and the high diversity of texture patterns. This diversity results directly both from the inherent cork granularity of the different layers in the parquet and from the distribution of the MOTIVE layer. The texture segmentation is based on features extracted from the detail images of wavelet transforms and on a fuzzy grammar as the classifier [37] . 
II. SYSTEM ARCHITECTURE
The developed approach is divided into two phases ( Fig. 3) : the learning and the execution phases. In the learning phase, a texture is manually selected, and a fuzzy rule is generated and stored in the database. In the execution phase, the texture under analysis is submitted to each fuzzy rule stored in the database, and texture identification is done. The system is capable of automatically starting a learning phase in case an unknown texture is shown to the system.
II. SYSTEM ARCHITECTURE
The Feature Extraction module ( Fig. 3 ) extracts the feature vector that best describes each texture, among the set of features extracted, accordingly with the selection procedure used.
II. SYSTEM ARCHITECTURE
The Fuzzy Grammar module uses the extracted feature vector to generate the fuzzy rule that describes the texture. Each rule is stored in a database during the learning phase.
II. SYSTEM ARCHITECTURE
In the Execution phase, the extracted feature vector is submitted to a Parsing Procedure module, developed with the compilers yacc and lex [38] . The vector is submitted to each fuzzy rule stored in the database, and a response value in the interval [0, 1], reflecting the grade of membership of the texture, is obtained.
II. SYSTEM ARCHITECTURE
Finally, the Classification module uses the output of the parsing and verifies which rule produces a value higher than a predefined threshold. In case no rule produces a value higher than this threshold, it is assumed that a new type of texture is present. A learning phase is automatically initiated and an appropriate fuzzy rule is generated for that texture. The result is a binary image where the blobs correspond to the presence of specific textures.
III. FEATURE EXTRACTION MODULE
In [39] , the author tests different approaches for texture segmentation and realizes that the best compromise between processing time and classification rate was achieved with the wavelet transform. These aspects led to the choice of the wavelet transform for texture segmentation in this industrial application.
III. FEATURE EXTRACTION MODULE
Reference [40] presents theoretical fundamentals of the wavelet transform applied to signal analysis. The wavelet transform in this domain introduces the concept of variable time window with frequency. Signal events with high frequency are analyzed with a higher timing resolution than the ones with lower frequency. To perform the wavelet transform, in the context of image processing, it is necessary to employ a 2-D discrete wavelet transform. As shown in Fig. 4(a) , an approximation coefficient, at level m + 1(V m+1 × V m+1 ), is decomposed in four components: the approximation coefficient at level m(V m × V m ) and the details at level m in three orientation coefficients:
III. FEATURE EXTRACTION MODULE
These last three components are the detail images used to construct the feature vectors. Fig. 4(b) shows a cork-textured image and the correspondent wavelet transforms. There are several types of wavelets functions that can be used in texture analysis.
III. FEATURE EXTRACTION MODULE
This application uses three levels for the wavelet transform (Daubechies D94), which results in a total of nine detail images. The feature vector consists of features extracted from the detail images at each decomposition level. The extracted features are the following parameters: Mean (M), Standard Deviation (SD), Contrast Between adjacent-Next Neighbour-pixels in Vertical (CBNNV) and Horizontal (CBNNH) directions and Contrast Between alternated-Alternated Neighbour-pixels in Vertical (CBANV) and Horizontal (CBANH) directions [(1)- (6)].
III. FEATURE EXTRACTION MODULE
Since the classifier is based on a fuzzy inference system, it implies that the magnitude of each element of the feature vector must be in the interval [0, 1], and thus, a normalization of each feature element is required (7) . The feature vector F V to be presented to the fuzzy grammar module consists of six features for each detail image (6 × 9 = 54 features): 
III. FEATURE EXTRACTION MODULE
(b) (Up) Image of a textured object and (down) the corresponding wavelet transform with three levels of decomposition.
III. FEATURE EXTRACTION MODULE
where I is the image, N is the number of pixels in the image, and Nc and Nl are the number of columns and lines in the image, respectively. During the learning phase, for initial tracking window size specification, it is necessary to consider the type of texture, specifically periodical or random aspects. Therefore, the following was settled for the learning phase: 1) Initially, the user chooses the initial tracking window; 2) this tracking area is divided in nonoverlapping windows (NOW), whose size is set by the operator [ Fig. 5(a) ]; 3) for each NOW, the wavelet transform is applied, and the 6 × 9 features are extracted. Each element of the final feature vector is the result of a feature selection procedure for each NOW; 4) a fuzzy rule is created with this feature vector. In the execution phase, the image is also divided in NOW with the same size as the ones of the learning phase, but now overlapped [ Fig. 5(b)] by (dx, dy) , where dx, dy are the displacements relatively to the previous one. This procedure ensures different grades of performance. For all the extracted features, it is fundamental to select n representative features from N initials, where n is much smaller than N . This procedure, shown in Fig. 6 , enables to eliminate both the nonrepresentative features of a particular texture and the redundant ones. Null value and high correlation were the criteria used to eliminate features. The correlation of the feature set is evaluated through the following fuzzy correlation [41] : where N is the total number of features, μ j is the set of values of feature j, and μ k is the set of values of feature k.
III. FEATURE EXTRACTION MODULE
This equation estimates the correlation coefficient between the values of a feature j(μ j ) and the set of values of the feature k(μ k ). If they are strongly correlated, only one is selected to be part of the final feature vector. In this paper, the threshold used for the correlation coefficient was 0.9.
III. FEATURE EXTRACTION MODULE
For a particular texture, in the cases where more than one value for each feature occur (most of the cases), it is necessary to select the value or the values that best describe it. This was done applying a fuzzy-c-means algorithm [42] , [43] . Several attempts, concerning the number of centers, were evaluated indicating a good description with five centers. Fig. 7 shows the application of the fuzzy-c-means algorithm to the features Mean and Standard Deviation of the detail image D22, for the three layers of cork parquet.
IV. FUZZY GRAMMAR MODULE
After the extraction of the feature vector that characterizes a texture, it is necessary to classify it according to its attributes. Specifically, the application has to deal with a high diversity of texture objects. To fulfil this constraint, the learning phase must be done with a unique sample of each type of texture.
IV. FUZZY GRAMMAR MODULE
In this paper, a fuzzy system modeling approach was developed in which a fuzzy inference system identifies the fuzzy rules representing relationships among the features extracted from the wavelet detail images. There are several approaches that generate these fuzzy rules. The most often applied are based on statistics, neural networks, and genetic algorithms [31] , [42] , [44] . However, these methods poorly satisfy the needs of this application, specifically the possibility to learn using only a characteristic vector. Therefore, a fuzzy grammar approach [41] , [42] , [45] was applied. Fuzzy grammar is a pattern classification syntactic model used to represent the structural relations of patterns and describes the syntax of the fuzzy languages that generate the fuzzy rules. This inference system is capable of generating a fuzzy rule using only one sample of a pattern.
IV. FUZZY GRAMMAR MODULE
Herein, a brief review of some basic concepts of fuzzy grammar is presented (for full discussion, see [42] , [45] , and [46] ). Fuzzy grammar GF is a quintuple GF = (V N , V T , P, S 0 , μ), in which V N and V T are finite disjoint sets of nonterminal and terminal vocabulary, respectively, such that V = V N ∪ V T is the total vocabulary of the grammar. P is a finite set of production rules of the type α → β, with α ∈ V N , and β is a member of the set V * of all strings (including the null string ε). S 0 ∈ V N is the starting symbol. μ is the mapping of P → [0, 1], such that μ(p) denotes the possibility of the current language sentence p ∈ P.
IV. FUZZY GRAMMAR MODULE
The syntax of the developed language L(GF ) includes four different steps.
IV. FUZZY GRAMMAR MODULE
1) The codification of the features to primitives (Table I) .
IV. FUZZY GRAMMAR MODULE
2) The definition of linguistic terms HistVar:c In the membership function Π, the parameter c is chosen such that the 11 membership functions cover the all universe of discourse X, and have disjointed maximums.
IV. FUZZY GRAMMAR MODULE
3) The definition of fuzzy modifiers (F M): "More than," "Less than" and "Between." The F M "More than" LT is defined by
IV. FUZZY GRAMMAR MODULE
where L is a threshold value and lb is the bandwidth value of the S membership function [41] , [42] . The F M "Less than" LT is given by
IV. FUZZY GRAMMAR MODULE
The F M "Between" LT 1 e LT 2 , is given by
IV. FUZZY GRAMMAR MODULE
where w 1 and w 2 are threshold values [41] , [42] . 4) The definition of fuzzy operators (F O) that establish the relations between the linguistic terms and primitives. The following F O were defined as follows. a) &, representing the AND of two primitives. It is given by the Yager intersection. b) >, representing "More than" LT and is given by μ MT LT . c) <, means "Less than" LT and is given by the function μ LT LT . d) | |, describes "Between two" LT and is given by μ B LT 1 LT 2 . e) #, means a "Separator between a" primitive and a LT . f) ( ), imposes a hierarchy in the rule.
IV. FUZZY GRAMMAR MODULE
Consider the texture shown in Fig. 4(b) . Fig. 8 shows the values of the 11 membership function Π for the primitive FWD00M [ Fig. 8(a) ], primitive FWD21CBNNV [ Fig. 8(b) ], primitive FWD22CBNNV [ Fig. 8(c) ], and primitive FWD22CBANV [ Fig. 8(d) ]. Primitive FWD00M has nonzero degrees of membership for LT HistVar:0, LT HistVar:1, and LT HistVar:2. The highest fuzzy value is obtained using LT HistVar:0. Thus, HistVar:0# FWD00M is part of the fuzzy rule which characterizes this texture.
IV. FUZZY GRAMMAR MODULE
If more than one linguistic term gives fuzzy values superior to 0.75, a fuzzy modifier like "More than," "Less than," and "Between" is applied to combine the obtained results. Accordingly, >HistVar:9# FWD22CBNNV is part of the fuzzy rule that characterizes this texture for primitive FWD21CBNNV. For primitive FWD22CBNNV, the result will be <HistVar:1# FWD22CBNNV, and for the primitive FWD22CBANV, the result will be HistVar:6 HistVar:7# FWD22CBANV.
IV. FUZZY GRAMMAR MODULE
The final rule will characterize the texture, but herein we present part of this rule for detail image D00, created by the fuzzy grammar:
IV. FUZZY GRAMMAR MODULE
HistVar:0#FWD00M&HistVar:0#FWD00SD&HistVar:0#F WD00CBNNV&HistVar:0#FWD00CBNNH&HistVar:0#FW D00CBANV&HistVar:0#FWD00CBANH. 
V. SYSTEM EVALUATION
The feasibility and efficiency of the texture segmentation approach have been studied by performing a set of experiments using different types of textures and materials (leather, fabric, paper, and textures from images database [47] ). Specifically, textures shown in Fig. 9 (a) were submitted to this segmentation procedure. A total of 100 patches for each texture were used. Fig. 9(b) shows the response of each texture rule (light gray bars) as well as the overall response of the rule that characterizes the other textures (dark gray bars).
V. SYSTEM EVALUATION
It can be observed that when a texture is presented to the inference system, it gives a response with a high value (higher than 0.85) for the rule that describes this texture. In contrast, the rules corresponding to the other textures give low response values. This means that the system creates disjoints rules and assures a good classification.
V. SYSTEM EVALUATION
As referred, the system was developed with the purpose to be applied to the cork inspection machine of Fig. 2 in the industrial environment. For that, it used an image size of 1024 × 1024 pixels, and it was developed in C++. A DLL was created to encapsulate the parsing procedure, which was developed with the compilers yacc and lex.
V. SYSTEM EVALUATION
In order to apply the segmentation approach to the target material, initial considerations and parameterizations have been established. They were focused on the following issues of concern.
V. SYSTEM EVALUATION
1) Type of objects-defects and raw material-to analyze and the respective class. These aspects are dependent on the quality demands of the sector and impose the number of classes to use. 2) Dimension of the defects. This aspect determines the image resolution and the analysis scale, meaning the degree of detail with which the analysis is performed. 3) Algorithm to evaluate the homogeneity of the MOTIVE layer. After the texture segmentation, a center of mass evaluation procedure was implemented in accordance with Fig. 10 .
V. SYSTEM EVALUATION
The parameterization of the system for the two situations under consideration-detection of BASE layer and homogeneity of the UPPER layer-is shown in Fig. 11 , showing the number of rules, the window dimensions, and the displacements. The images were acquired with a resolution of 7 pixels/mm.
V. SYSTEM EVALUATION
During the installation phase in the industrial environment, the system was evaluated and tested using a universe of 100 cork samples (cork parquets of 600 × 300 mm), distributed as follows: 44 samples of parquets for evaluation of the BASE layer's visibility in the UPPER layer and 56 samples for evaluation of homogeneity in the visible UPPER layer. Figs. 12-17 show the results of the system application, in order to evaluate the parameters for quality control. Figs. 12 and 13 show graphically the magnitude of the fuzzy rule response for each window under analysis. These graphs exemplify how the rule with the higher value defines the class of the texture that the window belongs. In both cases, the classes are clearly discriminated once response values are apart. Nevertheless, Fig. 13 shows different degrees of performance according to the type of layer. In Fig. 13(a) , it is possible to identify three types of window contents: -only upper; -only motive; -mixture of the previous two. The graph shows well apart response values for the MOTIVE windows and more close values for the UPPER windows. The results for mixture windows depend on the proportion between the two layers. Occasionally, the MOTIVE presents cork pieces with darker areas, which make classification more difficult. This can be observed in Fig. 13(b) (windows 4 and 6) by the proximity between the response values.
V. SYSTEM EVALUATION
Figs. 14-17 show texture images and the segmentation result. In the segmented image, the regions with darker gray level correspond to the presence of BASE [ Fig. 14(b) ], and larger and thicker pieces of cork [ Figs. 15(b), 16(b), and 17(b) ]. In the parquet images, the MOTIVE layer is highlighted by dashed line.
V. SYSTEM EVALUATION
Figs. 14 and 15 exemplify good classification results for the BASE and the MOTIVE layers.
V. SYSTEM EVALUATION
The presence of false detections in images of Figs. 16(b) and 17(b), confirms that the system has a higher difficulty to deal with MOTIVE layer in some parquets. In Fig. 16(b) , the false detections are mainly related with the transition windows. Fig. 17 shows the previously referred case of the presence of darker areas in the MOTIVE layer. Although rare, this is the most difficult situation to classify.
V. SYSTEM EVALUATION
Considering the universe of samples under test high classification rates were achieved, specifically 94% for BASE detection and 90% for surface homogeneity evaluation.
VI. CONCLUSION
In the last decade, great technological improvements have been introduced in the sector of cork transformation. However, some limitations remain concerning the process of quality control. Parquet inspection is actually performed manually with the consequent ambiguity and delay in the production rate. Therefore, an automatic inspection system for the cork parquet was specified and developed, based on computer vision techniques. This paper presented the component of this system that is devoted to the texture analysis.
VI. CONCLUSION
The texture segmentation was based on six features extracted for each detail image of the wavelet transform of a gray scale image and on a fuzzy grammar classifier. Feasibility and flexibility were evaluated performing tests with cork images and also with images from other industrial materials. These tests demonstrated that the system creates disjoints rules and assures good classification.
VI. CONCLUSION
For the parquet inspection, the approach was parameterized to deal with two major quality problems: the visibility of the BASE layer in the UPPER layer and the homogeneity in the visible UPPER layer (distribution of the MOTIVE layer). Wavelet transform and fuzzy grammar revealed to be a suitable approach to deal with these problems and simultaneously with the need to reduce expensive time consuming both in the processing and in the offline learning phase. Good classification rates (higher than 90% for surface homogeneity evaluation and higher than 94% for the base detection) were achieved suggesting the efficiency of the inference system when applied to the great diversity of texture that characterizes the Portuguese industrial sector. Another advantage, when compared to other approaches, was that the learning phase is done with a unique sample of each type of texture.
VI. CONCLUSION
The presented solution enables us to maximize efficiencies and to increase the production rate. Furthermore, dependence of final product quality on human subjectivity was eliminated.
VI. CONCLUSION
The system was already implemented in a cork inspection machine in an industrial environment. Experiments made with this industrial prototype, specifically for the base detection, reveal that the inspection cycle per image is around 170 ms, allowing the desired inspection cycle time of two cork parquets per second. The system performance in situ remains with high classification rates, higher than 90%. Most of these industries do not have data to support a quantitative comparison between human and a machine inspection. Although it depends on the final client, the majority of the cork industries assure the inspection of 100% of the production. However, several academic studies [48] support that a manual inspection allows classification rates of the order of 70% and to guaranty a higher classification rate the same product must be inspected a number of times (around seven). In this context, the obtained results with this prototype indicate that full spreading industrialization is a promising perspective.

{'paper_id': '2144523', 'title': 'Cork Parquet Quality Control Vision System Based on Texture Segmentation and Fuzzy Grammar', 's2_url': 'https://api.semanticscholar.org/CorpusID:2144523', 'source': 'S2ORC'}