You are on page 1of 37

Faculty of Engineering Computer Engineering Department

Texture Recognition

In partial fulfillment of the Requirements for CMP605 Image Processing and Computer Vision

Presented by

Ahmed Mohamed Ahmed El Sheikh Jihad Ibrahim

May 2012

Contents
Abstract ...................................................................................................................................... 4 Acknowledgement ...................................................................................................................... 4 Chapter 1: Introduction ............................................................................................................... 5 1.1 Motivation and Justification ......................................................................................... 5

Applications......................................................................................................................... 5 1.2 Problem Definition ............................................................................................................ 5 1.3 Summary of Approach ....................................................................................................... 8 1.4. Report Overview............................................................................................................... 8 Chapter 2: Literature Survey........................................................................................................ 9 Model-based Approaches [3,11,15] ......................................................................................... 9 Statistical Approaches [3] ...................................................................................................... 11 Structural Approach [3] ......................................................................................................... 14 Transform Methods............................................................................................................... 14 Chapter 3: Necessary Background ............................................................................................. 16 Wavelet Transform................................................................................................................ 16 Singular Value Decomposition ............................................................................................... 20 Chapter 4: System Description .................................................................................................. 21 Selected Approaches ............................................................................................................. 21 Declined Approaches............................................................................................................. 21 System Block Diagram ........................................................................................................... 21 Histogram and GLCM Statistics .............................................................................................. 22 Laws Masks .......................................................................................................................... 23 Wavelet Decomposition ........................................................................................................ 24 Curvelet Decomposition ........................................................................................................ 24 Gabor Filter Bank .................................................................................................................. 24 Singular Value Decomposition ............................................................................................... 24 Classifiers .............................................................................................................................. 25 Classifier Fusion [9] ............................................................................................................... 25

Chapter 5: Results ..................................................................................................................... 27 Histogram and GLCM Statistics .............................................................................................. 27 Laws Masks .......................................................................................................................... 28 Wavelet Decomposition ........................................................................................................ 28 Curvelet Decomposition ........................................................................................................ 29 Gabor Filter Feature .............................................................................................................. 29 Singular Value Decomposition ............................................................................................... 30 Fusion Results ....................................................................................................................... 31 Chapter 6: Conclusion and future work. .................................................................................... 32 Conclusions ........................................................................................................................... 32 Future Work .......................................................................................................................... 32 References ................................................................................................................................ 33 Appendix A. Development Tools and Environment .................................................................... 34 Used Toolboxes and Functions .............................................................................................. 34 Appendix B. Sample MATLAB Functions and Scripts................................................................... 35 FeatureExtract Function ........................................................................................................ 35 Wavelet Feature Function ..................................................................................................... 36 SVD Feature .......................................................................................................................... 37

Abstract
Image texture, defined as a function of the spatial variation in pixel intensities (gray values), is useful in a variety of applications and has been a subject of intense study by many researchers. One immediate application of image texture is the recognition of image regions using texture properties. Texture is the most important visual cue in identifying these types of homogeneous regions. This project is concerned with exploiting various texture analysis techniques. Existing techniques are classified and implemented for comparison purposes. A proposed technique Singular Value Decomposition is examined and compared with the existing. Finally, we sugges t some possible future work in this field. This technique give a good spatial representation that differs from the other techniques and therefore useful in decision fusion. We are classifying between 20 textures, each texture has 40 samples [1], 30 are used for training and 10 for testing. Implementation is done using MATLAB. The highest recognition rate achieved using a single feature is 82% and the highest accuracy using fusion techniques is 93%.

Acknowledgement
We thank Dr. Ahmed for his well guided self-study course and outlined project, from which we have gained significant experience.

Chapter 1: Introduction
1.1 Motivation and Justification
Texture analysis techniques are not only used with textures by its strict meaning, many of the computer vision applications encounter textures by its descriptive meaning. Although, there are many definitions given for a texture in computer vision, we found the following to be the most relevant: A region in an image has a constant texture if a set of local statistics or other local properties of the picture function are constant, slowly varying, or approximately periodic. So, we thought exploiting the various techniques for textural analysis will be a good experience and increase the benefit from the course, given the fact we have no prior knowledge of the problem. Applications Areas of application are endless. In some of the mature domains (such as remote sensing) texture already has played a major role, while in other fields (such as surface inspection) new applications of texture are being found. Texture analysis can be also used in automated inspection, medical image processing, document processing.

1.2 Problem Definition


We are testing the various analysis techniques that show promising results from the literature survey that will be discussed later. Our texture dataset [1] contains 25 types of natural and synthetic textures, each has 40 samples. We are only classifying between 20 of them that are shown in Fig.1. We use 30 samples from each for the training phase and 10 for testing i.e. a total of 600 training samples and 200 testing. We are using neural networks for the classification stage.

Figure 1 Samples of dataset

Figure 2 cont. samples of dataset

1.3 Summary of Approach


The main flow of our system can be summarized in the following diagram

Processing (if necessary)

Analysis

Classification

Resizing Equaliztion

Feature Extraction

Learning phase (targets given) Recognition (targets required)

The input to the above system is the raw grayscale images and the output is the class recognized class (in the recognition phase). A final stage is added to fuse the decision of various classifiers to improve the recognition rate.

1.4. Report Overview


Chapter 2 will be a literature survey for the texture analysis techniques that were previously implemented. Chapter 3 will give some necessary background for the implemented algorithms. Chapter 4 will be a detailed system description. Chapter 5 will discuss the results. And finally, chapter 6 will suggest some future work in the field.

Chapter 2: Literature Survey


Texture recognition techniques can be classified into one of the following categories: Model Based. Statistical. Structural. Transform.

We shall now discuss the concept on which each of them is based and give various example approaches for each.

Model-based Approaches [3,11,15]


Those methods consider texture as random process, which is governed by some parameters. The analysis of texture images is executed, dening a model and considering each texture groups parameters. The estimation of the parameters can serve to classify and to segment textures. This category of analysis offers a good possibility to recreate realistic examples of natural textures. AR Model [3,13,15] The autoregressive (AR) model assumes a local interaction between image pixels in that pixel intensity is a weighted sum of neighboring pixel intensities. Assuming image f is a zero-mean random field, an AR causal model can be defined as

1
Where fs is image intensity at site s, es denotes an independent and identically distributed noise, Ns is a neighborhood of s and is a vector of model parameters. Causal AR models have an advantage of simplicity and efficiency in parameter estimation.

Markov Random Fields Model [3,15] A Markov random field (MRF) is a probabilistic process in which all interactions are local; the probability that a cell is in a given state is entirely determined by probabilities for states of neighboring cells. Let S be a set of locations, here for simplicity, assume S a grid. S={ (i, j) | i, j are integers }. Neighbours of s(i,j) ||S are defined as: ((i, j)) = { (k, l) | 0<(k - i)2 + (l - j)2 < r constant } A subset C of S is a clique if any two different elements of C are neighbours. Example of 8-neighborhood (r = 2):

Figure 3 8-neighborhood and its cliques

Direct interaction occurs only between immediate neighbors. However, global effects can still occur as a result of propagation. Fractal Model [11,14] Its used with natural surfaces that have a statistical quality of roughness and self-similarity at different scales. If the size of the measuring tool is taken as , the measured quantity will be

3
Where D is known as the fractal dimension which Fractal model depends on. Then FD can be defined as: FD= log (Nr)/log(r -1)

Where Nr is the number of non-overlapping copies of a set similar to the original set, scaled down by a ratio r. But fractal dimension is not sufficient to capture all textural properties, that there may be perceptually very different textures that have very similar fractal dimensions.

Another measure, called lacunarity , has been suggested in order to capture the textural property that will let one distinguish between such textures.

Statistical Approaches [3]


Statistical methods analyze the spatial distribution of gray values, by computing local features at each point in the image, and deriving a set of statistics from the distributions of the local features. The reason behind this is the fact that the spatial distribution of gray values is one of the defining qualities of texture. Depending on the number of pixels defining the local feature, statistical methods can be further classified into first- order (one pixel), second-order (two pixels) and higher-order (three or more pixels) statistics. 1st Order Statistics Based Approach (Histogram) [12] First order texture measures are statistics calculated from the original image values, and do not consider pixel neighborhood relationships. Features that can be used with this method are: as mean, variance, dispersion, mean square value or average energy, entropy, skewness and kurtosis. It suffers from the limitation that it provides no information about the relative position of pixels to each other. For example, 2 completely different images each with a 50% black and 50% white pixels (such as a checkerboard and a Salt & Pepper noise pattern) may produce the same gray level histogram. Therefore we cannot distinguish between them using first order statistical analysis. 2nd Order Statistics Based Approach (Co-occurrence Matrices) [10,3] Grey level co-occurrence matrices are two dimensional histograms of occurrence of pairs of grey levels for a given displacement vector. Grey level co-occurrence matrix pd for a d= (dx, dy) displacement vector is defined as follows. The entry (I,j) of pd is the number of occurrences of the pair of gray levels (I,j) and which are a d distance apart.

For example, consider the following 4*4 image containing 3 different grey values and Displacement vector d = (1, 0) 1100 1100 0022 0022 Pd = 402 220 002

Note: Different authors define the co-occurrence matrix a little differently in two ways: By defining the relationship operator p by an angle and distance d, and By ignoring the direction of the position operator and considering only the (bidirectional) relative relationship Features that can be used with this method are:

Figure 4 Texture features of GLCM

x and y are the means, x and y are the standard deviations of Pd(x) and Pd(y)

Laws Energy Filters [2] This method involved the application of simple filters to digital images. The basic filters used were common Gaussian, edge detector and Laplacian-type filters, and were designed to highlight points of high texture energy in the image. By identifying these high energy points, smoothing the various filtered images characterizes textures efficiently. The Laws masks are constructed by convolving together just three basic 1x3 masks:

5
The initial letters of these masks indicate Local averaging, Edge detection and Spot detection. In fact, these basic masks span the entire 1x3 subspace and form a complete set. Similarly, the 1x5 masks obtained by convolving pairs of these 1x3 masks together form a complete set.

Where R5 is Ripple detection and W5 is Wave detection mask. 2D masks can be obtained by outer product of pairs of the above masks. Masks that dont average to zero are not used because they are more sensitive to image intensity than the texture itself. The filtered images are then averaged over larger moving windows to get macro-features of the texture. The average is the absolute sum of all elements in a given window of size (2p+1)x(2p+1).

7
Second level feature extraction can be in the form of statistical measures for the energy matrix.

Structural Approach [3]


This technique aims at representing texture by well-defined primitives (micro-texture) and a hierarchy of spatial arrangements (macro-texture or grammar) of those primitives. To describe the texture, one must define the primitives and the placement rules. The choice of a primitive (from a set of primitives) and the probability of the chosen primitive to be placed at a particular location can be a function of location or the primitives near the location. The advantage of the structural approach is that it provides a good symbolic description of the image; however, this feature is more useful for synthesis than analysis tasks. The abstract descriptions can be ill defined for natural textures because of the variability of both micro- and macrostructure and no clear distinction between them.

Transform Methods
Wavelet Decomposition [4,5] The texture image is decomposed using any type of wavelets up to a certain level of decomposition; producing 4 matrices at each layer from the decomposition of the blur of the previous layer (see the graphical interpretation and the wavelets section in ch.3 for further illustration). Various statistical measures of these resulting matrices are taken for each of the resulting layers. Examples of these statistics are the mean, standard deviation and the covariance. Graphical interpretation

Figure 5 Wavelet decomposition & Produced matrices

LL: Low frequency information (Blur). HL: Horizontal high frequency component (vertical edges). LH: Vertical high frequency component (Horizontal edges). HH: Diagonal high frequency component (oblique edges).

Curvelet Transform [6] Curvelet transform is one of the modified wavelets families. The main difference is that curevelets have an orientation parameter in 2D and higher dimensional spaces. This orientation gives a more sparse representation for curved edges. Yet, this feature is not of significance in our task as there are no clear edge in most of the textures, besides various orientations in the scenery requires averaging over the various curvelet orientations causing some sort of blurring in a curved way.

Figure 6 Curvelet transform

Gabor Filter [5] Gabor filter is also one of wavelets families, but its main advantage is that it achieves minimum uncertainty between the time and frequency domain. Also, it has an orientation parameter like curvelets. The wavelet used has the form of a complex sinusoid modulated by a Gaussian window. Rotated Gaussian Oriented Complex Sinusoid

8 9
Statistics such as mean and standard deviation for each frequency and scale are calculated and averaged over the various orientations.

Chapter 3: Necessary Background


In this chapter we include two of the most essential backgrounds for understanding the implementation of the chosen techniques that were also mentioned previously in the literature survey.

Wavelet Transform
Historical Motivation Fourier Transform FT decomposes a given signal in an orthogonal set of sinusoids of different frequencies.

10
Where xn is the signal in the time domain (TD) and Xk in the frequency domain (FD). These sinusoids have deterministic frequencies but extended throughout the whole time domain. Therefore lacks localization in the time (or space in 2D). Short-Time Fourier Transform (STFT) If we wish to gain some information on our location in the time (space) domain we can perform the FT on a window of the signal.

11
Where w[n] is the windowing function in time domain. A simple rectangular window corresponds to a sinc function in FD. Since multiplication in the TD corresponds to convolution in the FD this results in what is called leakage. The deltas of the frequencies are now wider. Therefore we are now limited by a certain resolution between the frequency and time domain. This resolution is fixed because the window size is fixed.

Figure 7 FT on a window of the signal

Multi-Resolution Analysis (Wavelets) Since STFT has fixed resolution we can use a variable size window to obtain various resolutions. This results in an over complete set such as the wavelets.

12 13
Where is the wavelet basis function, m is the scaling factor and n is the translation factor. The time frequency resolution can be interpreted as the following figure, as we get more localized in tine we lose localization in frequency and vice versa.

Figure 8 Time frequency resolution

This is in contrast to the STFT which has fixed resolution that can be interpreted by the following figure

Figure 9 STFT's fixed resolution

Various modifications to the original wavelets have arisen such as Curvelets, Ridigilets and Gabor filers.

Curvelet Transform This transformation was motivated by the fact that wavelets in 2D dont sparsely represent curved edges. So, the family of wavelets with an orientation parameter was devised to overcome such complication. The space frequency resolution map can be regarded as the following figure

Figure 10 Space frequency resolution map

This can be thought of as taking the time axis of the wavelets resolution map and rotating it towards the frequency axis clockwise, the above figure will be the result. Gabor Filter Gabor thought of this resolution problem as an analogous problem to the Heisenberg Uncertainty Principle and found that tf >= 1/(4). By seeking the equality he found that the wavelet that gives highest resolution in both time and frequency is a complex sinusoid modulated by a Gaussian window (as was shown in the literature survey).

Singular Value Decomposition


The SVD is motivated by the following geometric fact: The image of the unit sphere under any m xn matrix is a hyperellipse.

Figure 11 Unit sphere changes to hyperellipse

First, we define the n singular values of A. These are the lengths of the n principal semiaxes of AS, written 1, 2 ... It is conventional to assume that the singular values are numbered in descending order. Next, we define the n left singular vectors of A These are the unit vectors {u1, u2} oriented in the directions of the principal semiaxes of AS, numbered to correspond with the singular values. Thus the vector iui is the ith largest principal semiaxis of AS. Finally, we define the n right singular vectors of A. These are the unit vectors {v1, v2...} S that are the pre-images of the principal semiaxes of AS, numbered so that Avj = juj This mathematical identity motivated the proposed techniques. As the singular values are thought to be characteristic for a given bases and matrix operating on it.

Chapter 4: System Description


Selected Approaches
Statistical o Histogram and GLCM. o Laws Masks. Transform o Wavelet decomposition. o Curvelet decomposition. o Gabor filter bank. Proposed Technique o Singular Value Decomposition (SVD).

Declined Approaches
Model-based methods. Structural approaches.

Reasoning: The model-based and structural approaches are better used in synthesis than in recognition. The search for the parameters of an assumed model or a building unit along with a placement rule fails in case of natural textures, due to not only the variability in natural scenes but also the variability in the image acquisition view (zooming in and out, inclination and rotation).

System Block Diagram

Read Image

Pre-processing

Image Analysis

Classificaiton

Multiple Classifier Fusion

Final Decision

We shall know describe the implementation procedure used for each approach and the implemented fusion techniques.

Histogram and GLCM Statistics


Procedure 1. Calculate the GLCM using MATLAB command graycomatrix for the four main orientations. 2. Get the statistical properties of the GLCM using the MATLAB command graycoprops, along with the mean and standard deviation. 3. Take the average of the above values to overcome rotations in the scenery. 4. Calculate the histogram of the image. 5. Calculate the mean, variance, skewness, kurtosis, energy and entropy of the histogram. Summary of GLCM Properties [7]

Summary of Histogram Properties [3]

Laws Masks
Procedure 1. Form the required mask by outer product of the following masks:

2. 3. 4. 5. 6. 7.

Calculate the normalization image by convolving with L5L5. Convolve the zero-average 5x5 mask with the image and normalize. Average the convolved image using a 15x15 mask. Do the above steps using the reversed mask. E.g.: E5L5 and L5E5. Take the average of the final two images. Take five statistical parameters for the averaged image; mean, STD, skewness, kurtosis and entropy.

Summary of Laws Masks Properties [8]

Wavelet Decomposition
Procedure [4] 1. Calculate up to the 3rd level Haar decomposition using MATLAB dwt2 command 3 times in succession on the blur. 2. Obtain the mean and STD of the final blur. 3. For each of the high frequency details at each level obtain the mean and STD.

Curvelet Decomposition
Procedure 1. Calculate the curvelet decomposition using the CurveLab Toolbox for MATLAB via warping. 2. For each level of decomposition take the average of the various angles. 3. Calculate the mean and STD for this average.

Gabor Filter Bank


Procedure 1. Filter the image using various scales, orientations and frequencies using MATLAB file exchange central implementation. 2. For each scale and frequency average over all orientations. 3. For each of the above averages calculate the mean and STD.

Singular Value Decomposition


Procedure 1. Split the image into a 5x5 cell. 2. For each cell calculate the SVD. 3. From each cell take the largest 5 singular values.

Classifiers
Classification is done using neural networks trained on the extracted features using the MATLAB nprtool.

Classifier Fusion [9]


Each trained classifier has different knowledge of the dataset. Fusion helps combine these differences to achieve a higher recognition rate. There are various techniques. But we implemented only three for comparison; Confidence, Voting and Decision templates. Confidence Take the decision of the classifier that has the highest soft output. Procedure: For each test sample generate a vector containing the highest output value form all classifiers for each class. Voting Majority count leads to ties. Use the soft outputs to vote. Procedure: Sum the outputs of all classifiers for a given test sample. Decision Templates Its idea is based on the fact that the classifier outputs can be regarded as a second layer of features. Procedure: 1- For each class prepare a matrix containing the average of the outputs of each classifier when this class is introduced for classification. This matrix is called the decision template for this class. 2- When taking the decision, prepare a matrix containing the outputs of all classifiers for the test sample. This matrix is called the decision profile for the test sample. 3- Calculate the Frobenius norm for the difference between the decision profile and the decision templates of all classes and then decide on the minimum.

Diagram for Decision Template Decision Fusion:

Figure 12 Decision template fusion

Note: Although the above techniques enhance the recognition rate as will be shown in the results chapter, they are computationally expensive, especially the decision templates because it acts as a second training/classification phase. So using any of the mentioned techniques is actually a compromise between the required accuracy and the expense of lengthy calculations.

Chapter 5: Results
In this section we will be discussing the results of the previously mentioned techniques, highlighting the main classification errors that each feature causes.

Histogram and GLCM Statistics


Feature vector size: 12 Recognition Rate The various distances for take for the neighboring pixels showed different recognition rates Neighbor Distance: 1-pixel: 69% 4-pixels: 8-pixels: 80% 67%

Confusion The following three classes cause the main confusion. It is very obvious that the Granite and Bark have almost the same Histogram and GLCM distributions. But pebbles confuse with them as a result of the fact that we use neither the whole GLCM nor the Histogram for classification but rather statistics of each of them.

Granite

Bark

Pebbles

Laws Masks
Feature vector size: 70 Recognition rate 79 % Confusion The main confusion is the Granite and Bark, the same as the GLCM and Histogram confusion. This also makes sense since both of these techniques belong to the same category.

Wavelet Decomposition
Feature vector size: 20. Recognition Rate 82 % Confusion Also, Granite and Bark are the main confusing classes, same as Statistical. But here the reasons differ; the high frequencies along the vertical and horizontal directions along with the blur of both classes are quite similar, not to mention their statistics of course. But the fact that wavelet feature shows better performance than the statistical methods is that the wavelet decompositions provide a better representation for the images information than the statistical features. Note: Although the wavelet feature shows better performance, yet it has higher dimensionality than the statistical feature. The feature extraction phase of the WD is almost the same as the statistical methods, but in the classification phase the WD requires more calculations due to the higher dimensionality.

Curvelet Decomposition
Feature vector size: 20 Recognition Rate 73% Confusion Curvelets have an orientation control parameter that differs from the regular wavelets. To overcome the variation in scene rotations during feature extraction averaging is done on the various orientations at a certain level of decomposition. This averaging causes some sort of blurring or brushing in a curved way. This confuses the classifier between the Granite and Carpet classes mainly.

Granite

Carpet

Gabor Filter Feature


Feature vector size: 18 Recognition Rate 75% Confusion The same as curvelet. This is due to averaging along the various orientations. The higher recognition rate is due to the fact that Gabor filter has a control on the frequency of the complex sinusoid of the filter which in turn gives more information.

Singular Value Decomposition


Feature vector size: Recognition Rate 65% Confusion Due to the fact that some textures have very close basis for their vector spaces. The SVD causes confusion such as shown below. Although this feature has poor recognition rate, yet it improves the recognition rate of the fused decision, because its confusion is unquestionable for the other features while it enhances their other decisions. 125

Marble

Floor

Wood 1

Wood 2

Fusion Results
Used Classifiers: Laws, Statistical with 1,4 pixel distances Wavelets, Curvelets and Gabor. SVD. Recognition Rate for the Different Techniques Confidence: 84% Voting: 91.5% Decision templates: 93% The above results may vary when different combinations of the implemented classifiers are used. And as mentioned before these fusion techniques are computationally expensive, yet the increase in the recognition rate over the single classifier accuracy ranges from 2 - 11%.

Chapter 6: Conclusion and future work.


Conclusions
Implementing texture recognition system with the mentioned methods is fully functional. The best performance achieved out of the chosen categories was very close, which means that data representation and compression is similar to some extent. Methods performance was determined with 3 main factors: Recognition rate (direct result), Vector size (cost) and Confusion (drawback). To improve those factors and to get the most accurate results, a new stage was added to the system (Multiple Decision classifier) that leads to significant improvement of the results.

Future Work
Searching for the optimum parameters (e.g. neighbor distance and orientation) for each analysis technique. As using the same parameters for all types of textures might not be the optimum solution. Decision fusion using different types of classifiers like K-Nearest Neighbor and Discriminant Function Analysis. Exploring texture analysis techniques when used with colored images. Expanding the analysis to motion textures.

References
[1] A Sparse Texture Representation Using Local Affine Regions, Svetlana Lazebnik, Cordelia Schmid, and Jean Ponce, IEEE Transactions on Pattern Analysis and Machine Intelligence. [2] Introduction to texture analysis, Machine vision group, physics dept. Royal Holloway, London. [3] Texture Analysis Methods A Review, Andrzej Materka and Michal Strzelecki, Technical University of Lodz, Institute of Electronics. [4] Improving Texture Recognition using Combined GLCM and Wavelet Features, Ranjan Parekh, School of Education Technology, Jadavpur University, Kolkata, India. [5] Brief review of invariant texture analysis methods, Jianguo Zhang, Tieniu Tan, National Laboratory of Pattern Recognition (NLPR), Institute of Automation, Chinese Academy of Sciences. [6] Content Based Image Retrieval Using Curvelet Transform, Ishrat Jahan Sumana, Md. Monirul Islam, Dengsheng Zhang and Guojun Lu, Gippsland School of Information Technology, Monash University, Churchill, Victoria 3842, Australia. [7] Texture Analysis, Mihran Tuceryan, Department of Computer and Information Science, Indiana University -Purdue University at Indianapolis, 723 W. Michigan St. Indianapolis, IN 46202-5132. [8] Laws masks descriptors applied to bone texture analysis: an innovative and discriminant tool in osteoporosis, M. Rachidi & A. Marchadier & C. Gadois & E. Lespessailles & C. Chappard & C. L. Benhamou. [9] Switching Between Selection and Fusion in Combining Classifiers: An Experiment, Ludmila I. Kuncheva. [10] Introduction to Texture Analysis, E. R. Davies, Machine Vision Group, Department of Physics Royal Holloway, University of London. [11] Chapter 5 Texture recognition, x Llad Bardera , Universitat de Girona. Departament d'Electrnica, Informtica i Automtica. [12] A comparative study of texture analysis algorithms in textile inspection applications, Ibarra Pico, Cuenca Asensi, Garca Crespi, Lorenzo Quintanilla, Morales Benavente, Universidad de Alicante, Departamento de Tecnologa Informtica y Computacin, Campus de San Vicente [13] A regularized simultaneous autoregressive model for texture classification, Yao-wei ,Yan-fei , Wen Yong ; 3 Institute of Computing Technology, Graduate School of Chinese Academy of Science. [14] Texture description using fractal energy features and energy features, t. kasparis, n. s. tzannes, m. ba~~iouni* and q. chen department of electrical and computer engineering and 2department of computer science, university of central florida, orlando, fl 32816, u.s.a. [15] Brief review of invariant texture analysis methods, Jianguo Zhang, Tieniu Tan, National Laboratory of Pattern Recognition (NLPR), Institute of Automation, Chinese Academy of Sciences, Beijing, Peoples Republic of China

Appendix A. Development Tools and Environment


The project is implemented completely using MATLAB.

Used Toolboxes and Functions


1- Wavelet Toolbox Used for calculating the 2D decomposition of the images using Haar wavelets. 2- CurveLab Toolbox It is a free Toolbox for academic use only obtained from: http://www.curvelet.org/software.html This is used to calculate the Curvelet decomposition for the given images. 3- Gabor Filter Functions A function shared at the MATLAB file exchange central. It can be obtained from the following thread: http://www.mathworks.com/matlabcentral/fileexchange/5237 4- Statistics Toolbox Used for calculating the various statistics as the 2d mean and STD. Also, higher order statistics such as skewness, kurtosis and entropy. 5- Neural Network Toolbox Used for training feed-forward neural networks used for classification.

Appendix B. Sample MATLAB Functions and Scripts


FeatureExtract Function
This function takes a function handle to the desired function for feature extraction, which returns a feature vector for a given image, and outputs a mat file containing easily accessed matrices and corresponding target matrices which are ready for training and testing. Functions Code
function FeatureExtract(VectorSize, TrainSamples, FeatureFunction, OutFileName) %% Data Container Initialization NumberOfTextures = 20; TrainCell = cell(NumberOfTextures,1); % Number of Textures TestCell = cell(NumberOfTextures,1); % Number of Textures [ TrainCell{:} ] = deal( zeros(VectorSize, TrainSamples) ); [ TestCell{:} ] = deal( zeros(VectorSize, 40 - TrainSamples) ); TrainTargets = zeros(NumberOfTextures, TrainSamples * NumberOfTextures); TestTargets = zeros(NumberOfTextures, (40 - TrainSamples) * NumberOfTextures); FHandle = str2func(FeatureFunction); %% Feature Extraction Exclude = [15 7 4 3 21]; counter = 1; for t = 1:25%NumberOfTextures if ~isempty(Exclude(Exclude == t)), continue; end; %% Train Samples for i = 1:TrainSamples Tno = num2str(t,'%02d'); I = imread(['Images/T' Tno '/T' Tno '_' num2str(i,'%02d') '.jpg']); TrainCell{counter}(:,i) = FHandle(I); % Feature Extracting Fucntion end Loc = (counter-1)*TrainSamples + 1; Target = zeros(NumberOfTextures,1); Target(counter) = 1; TrainTargets(:, Loc : Loc + TrainSamples - 1) = repmat( Target, 1, TrainSamples); %% Test Samples for j = TrainSamples + 1: 40 Tno = num2str(t,'%02d'); I = imread(['Images/T' Tno '/T' Tno '_' num2str(j,'%02d') '.jpg']); TestCell{counter}(:,j-TrainSamples) = FHandle(I); % Feature Extracting Fucntion end Loc = (counter-1) * (40 - TrainSamples) + 1; Target = zeros(NumberOfTextures, 1); Target(counter) = 1; TestTargets(:, Loc : Loc + 40 - TrainSamples - 1) = repmat( Target, 1, 40 - TrainSamples); disp(['Texture number ' Tno ' is done']);

counter = counter + 1; end %% Saving The Data TrainMat = [TrainCell{:}]; TestMat = [TestCell{:}]; save(OutFileName, 'TrainCell', 'TrainMat', 'TrainTargets', 'TestCell', 'TestMat', 'TestTargets'); % Feature Name of Saved Data end

Wavelet Feature Function


This function takes an image and returns a feature vector of size 20. Functions code
function v = WaveletFeature(I) %Vector Size is 20 V = cell(3,1); H = cell(3,1); D = cell(3,1); B = cell(3,1); [B{1}, H{1}, V{1}, D{1}] = dwt2(I,'haar'); [B{2}, H{2}, V{2}, D{2}] = dwt2(B{1},'haar'); [B{3}, H{3}, V{3}, D{3}] = dwt2(B{2},'haar'); v = [mean2(B{3}); std2(B{3})]; for i = 1:3 CD = cov(D{i}); CH = cov(H{i}); CV = cov(V{i}); DD = diag(CD); DH = diag(CH); DV = diag(CV); RD = CD./sqrt(DD*DD'); RH = CH./sqrt(DH*DH'); RV = CV./sqrt(DV*DV'); v = [v; mean2(RH); std2(H{i}); mean2(RV); std2(V{i}); mean2(RD); std2(D{i})]; end end

SVD Feature
This function takes an image and returns a feature vector of size 125. Functions code
function v = SVDFeature(I) Id = double(I); ColDiv = 5; RowDiv = 5; [Row Col] = size(I); C = mat2cell(Id, Row/RowDiv*ones(1,RowDiv), Col/ColDiv*ones(1,RowDiv)); v = []; for i = 1:ColDiv for j = 1: RowDiv d = svd(C{i,j}); v = [ v; d(1:5) ]; end end end

You might also like