Thesis Proposal - AUC DAR Repository

The American University in Cairo
School of Sciences and Engineering
Texture Classification
Using Transform Analysis
A Thesis Submitted to
The Computer Science Department
In partial fulfillment of the requirements for the degree of
Master of Science in Computer Science
By
Mary Fouad Habib
B.Sc. Computer Science
Under the supervision of
Prof. Dr. Amr Goneid
May 2003
The American University in Cairo
Texture Classification Using Transform Analysis
A thesis Submitted by
Mary Fouad Habib
To the Department of Computer Science
May 2003
In partial fulfillment of the requirements for
The degree of Master of Science
Has been approved by
Dr. Amr Goneid
Thesis Committee Chair / Advisor
Affiliation
_________________________________
_________________________________________________________
Dr.
Thesis Committee Reader / examiner
Affiliation
_________________________________
_________________________________________________________
Dr.
Thesis Committee Reader / examiner
Affiliation
_________________________________
_________________________________________________________
Dr.
Thesis Committee Reader / examiner
Affiliation
_________________________________
_________________________________________________________
_______________
_______________
Department Chair /
Program Director
Date
________________ ________________
Dean
Date
Casting all your care upon him; for he careth for you
--- 1 Peter 5:6-7
To God My Lord
A man is not old until regrets take the place of dreams
--- John Barrymore
Indifference is isolation. In difference is texture and wonder
--- Edwin Schlossberg
To my supervisor Dr. Goneid
Acknowledgement
I would like to thank my supervisor Dr. Amr Goneid for the amazing help and
support he provided me. I wish one day I am half as good in image processing and
machine vision.
Special thanks goes to my parents for their strong belief in good education and for
supporting me all those years.
I would also like to thank all those who have given time in reading and assessing this
thesis.
Thank you all….
Mary Habib
i
Abstract
The work presented in this thesis deals with the application of spectral
methods for texture classification. The aim of the present work is to introduce a
hybrid methodology for texture classification based on a spatial domain global preclassifier together with a spectral classifier that utilizes multiresolution transform
analysis. The reason for developing a spatial pre-classifier is that many
discriminating features of textures are present in the spatial domain of the texture. Of
these, global features such as intensity histograms and entropies can still add
significant information to the texture classification process. The pre-classifier uses
texture intensity histograms to derive histogram moments that serve as global
features.
A spectral classifier that uses Hartley transform follows the pre-classifier. The
choice of such transform was due to the fact that the Fast Hartley Transform has
many advantages over the other transforms since it results in real valued arrays and
requires less memory space and computational complexity.
To test the performance of the whole classifier, 900 texture images were
generated using mathematical texture generating functions. The images generated
were of three different classes and each class is sub-classified into three sub-classes.
Half of the generated samples was used to build the classifier, while the other half
was used to test it.
The pre-classifier was designed to identify texture classes using an Euclidean
distance matching for 4 statistical moments of the intensity histograms. The preclassifier matching accuracy is found to be 99.89%.
The spectral classifier is designed on the basis of the Hartley transform to
determine the image sub-class. Initially, a full resolution Hartley transform was used
to obtain two orthogonal power spectral vectors. Peaks in these two vectors were
detected after applying a 10% threshold and the highest 4 peaks for each image are
selected and saved in position lookup tables. The matching accuracy obtained using
the two classification phases (pre-classifier and spectral classifier) is 99.56%.
The accuracy achieved for the single resolution classifier is high but that was
achieved on the expense of space for the lookup tables. In order to investigate the
effect of lowering the resolution on the size of the information needed for matching
the textures, we have applied a multiresolution technique to the Hartley Transform
in a restricted way by computing the Hartley spectra in decreasing resolution. In
ii
particular, a one-step resolution decrease achieves 99% matching efficiency while
saving memory space by 40%. This is a minor sacrifice of less than 1% in the
matching efficiency with a considerable decrease in the complexity of the present
methodology.
Index Terms – Pattern Analysis, Texture Classification, Segmentation of Textured
Images, Fourier Transform, Multiresolution Analysis, Hartley Transform.
iii
Table of Contents
Acknowledgment
i
Abstract
ii
List of Tables
vii
List of Figures
viii
1. Introduction
1
1.1. Applications of Texture Classification
3
1.2. Principal Approaches
3
1.2.1.
Statistical Approaches
3
1.2.2.
Structural Approaches
4
1.2.3.
Spectral Approaches
4
1.3. Thesis Objectives and Organization
5
2. Literature Survey
7
2.1. Introduction
8
2.2. Statistical Approaches
8
2.2.1.
The Co-occurrence Matrix
9
2.3. Spectral Approaches
10
2.4. Multiresolution Spectral Approaches
11
3. Transform Methods for Texture Analysis
14
3.1. Introduction
15
3.2. The Fourier Transform (FT)
15
3.3. Windowed Fourier Transform (WFT)
18
3.4. Multiresolution Wavelet Transform (MWT)
18
3.5. Multiresolution Fourier Transform (MFT)
19
iv
4. A pre-classifier for Texture using Spatial Histogram Moments
21
4.1. Introduction
22
4.2. Generating Texture Images
22
4.2.1.
Fxy1
24
4.2.2.
Fxy2
25
4.2.3.
Fxy3
26
4.3. Moments
28
4.3.1.
Moments Theory
28
4.3.2.
Applying Moments on the Sample Images
29
4.3.3.
Deduction of an Image Class from its Moment Value
31
4.4. Results
32
4.5. Conclusion
34
5. A classifier for Texture using Transform Analysis
35
5.1. Introduction
36
5.2. The Fast Hartley Transform
36
5.3. Applying the Fast Hartley Transform on the Sample Images
38
5.4. Deduction of an Image Sub-Class from its Hartley Transform
40
5.5. Results of the Hartley Transform
41
5.6. Conclusion
41
6. A classifier for Texture using Multiresolution Hartley Transform
43
6.1. Introduction
44
6.2. Multiresolution Hartley Transform
44
6.3. Applying the Multiresolution Hartley Transform on the Sample Images
45
6.4. Deduction of the Sub-Class from an Image Multiresolution Hartley
Transform
46
6.5. Results of the Multiresolution Hartley Transform
46
6.6. Conclusion
47
7. Conclusion and Future Work
48
7.1. Summary and Conclusion
49
7.2. Future Work
51
v
References
52
Appendix A: The Matlab Code
56
a. Thesis.M
59
b. Preclassifier.M
62
c. Preclassifierfv.M
63
d. Preclassifierfvtest.M
64
e. Classifier.M
65
f.
Classifierfv.M
67
g. Classifierfvtest.M
68
h. Multiresolution.M
71
i.
Multiresolutionfv.M
73
j.
Multiresolutionfvtest.M
74
k. Fxy1
77
l.
Fxy2
78
m. Fxy3
79
Appendix B: Classifier Lookup Tables
80
Appendix C: Multiresolution Hartley Transform Lookup Tables
87
vi
List of Tables
Table 1
Moment Values for Fxy1 Images
Table 2
Moment Values for Fxy2 Images
Table 3
Moment Values for Fxy3 Images
Table 4
Moments Matching Results
Table 5
Hartley Transform Results
Table 6
Multiresolution Hartley Transform Results
Table 7
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy1LL
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy1MM
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy1HH
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2LL
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2MM
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2HH
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3LL
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3MM
Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3HH
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy1LL
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy1MM
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy1HH
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy2LL
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy2MM
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy2HH
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy3LL
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy3MM
Positions of the Highest 3 Peaks in Multiresolution HT Images
Fxy3HH
Table 8
Table 9
Table 10
Table 11
Table 12
Table 13
Table 14
Table 15
Table 16
Table 17
Table 18
Table 19
Table 20
Table 21
Table 22
Table 23
Table 24
vii
List of Figures
Figure 1
Figure 2
The amplitude and phase angle of a sine wave at a particular
frequency
Multiresolution Fourier Transform
Figure 3
Image Classification
Figure 4
Sample Images for Fxy1LL
Figure 5
Sample Images for Fxy1MM
Figure 6
Sample Images for Fxy1HH
Figure 7
Sample Images for Fxy2LL
Figure 8
Sample Images for Fxy2MM
Figure 9
Sample Images for Fxy2HH
Figure 10
Sample Images for Fxy3LL
Figure 11
Sample Images for Fxy3MM
Figure 12
Sample Images for Fxy3HH
Figure 13
Image Gray Level Histogram
Figure 14
Sample Image Grey Level Histogram for Fxy1
Figure 15
Sample Image Grey Level Histogram for Fxy2
Figure 16
Sample Image Grey Level Histogram for Fxy3
Figure 17
Sample Image PDF plots for LL sub-class
Figure 18
Second Moment Chart
Figure 19
Third Moment Chart
Figure 20
Fourth Moment Chart
Figure 21
Fifth Moment Chart
Figure 22
Samples of the Hartley Power Spectrum PDF (50 samples each)
Figure 23
Sample of u and v projection spectra for Fxy1LL
Figure 24
Sample of u and v projection spectra for Fxy1MM
Figure 25
Sample of u and v projection spectra for Fxy1HH
Figure 26
Matlab Code Block Diagram a
Figure 27
Matlab Code Block Diagram b
viii
Chapter 1
Introduction
1
Chapter 1
Introduction
The description of a region in an image is one of the major objectives in image
processing and pattern analysis. Through proper region descriptors, a region may be
segmented, classified, recognized or even synthesized. Theoretically, image
segmentation is well defined. An image consists of a matrix of pixels, and each pixel
is labeled. A connected group of pixels that share the same label is called a region.
Ideally, each region represents an object in the image. A Region can be represented
and described either through its external characteristics such as boundary and
geometric structure or through its internal characteristics such as color and texture.
In textures, segmentation is defined as one or more basic local patterns that are
repeated in a periodic manner.
An important approach to region description is to produce quantifiable
measures of its texture content. It is required to partition an image into regions of
homogeneous textures, but it is not always easy to find out if two texture samples are
similar to each other. The segmentation of textures requires the identification of
proper texture-specific features with good discriminative power. Although no formal
definition of texture exists [24], we may intuitively consider texture descriptors to
provide measures of some properties such as smoothness, coarseness and regularity
of some pattern.
Traditionally, the three principal approaches used in image processing to
describe the texture of a region are Statistical, Structural and Spectral approaches
[24]. Statistical approaches attempt to describe texture as smooth, coarse, grainy and
so on. Structural analysis however, bases the classification of textures on a repeated
basic texture block and generates the rules for replicating it over the image. Spectral
methods use transform analysis to detect global periodicities in the region by
identifying prominent energy peaks in the spectrum produced by a mathematical
transform like the Fourier Transform. Regardless of the selected approach, most
texture classifiers contain some element of statistical calculations. Depending on the
application, the statistical approach some time suffices or an additional approach is
required.
2
1.1 Applications of Texture Classification
The importance of texture analysis lies in their significance in many
applications including remote sensing, industrial and biomedical surface inspection,
robotics, ground classification, segmentation of satellite or aerial imagery, document
analysis, scene analysis, texture synthesis for computer graphics and animation,
biometric person authentication, content-based image retrieval, model-based image
coding and textiles, virtual catalogues, garment design etc.
In Medical Applications, texture classification is used to detect cancer of the colon,
early detection of liver diseases and is used in minimal invasive surgery.
Even though there are many potential areas of application for texture analysis, only a
limited number of successful exploitations of texture exist so far. A major problem is
that the textures in the real world are often not uniform, due to changes in
orientation, scale or other visual appearance.
1.2 Principal Approaches
The three principal approaches used in image processing to describe the
texture of a region are Statistical, Structural and Spectral approaches.
1.2.1 Statistical Approaches
To describe the texture as smooth, coarse or grainy, statistical analysis
calculates the image variance, mean and higher degree moments. The most efficient
and popular calculations in statistical analysis are the moments described in details
in section 4.3. Additionally, two commonly statistical measures are used; the contrast
and entropy. The contrast weights the probability of occurrence of each gray-level
difference with the square of that difference. Thus, small differences receive little
weight, while large differences are weighted very heavily. The value assigned to a
neighborhood will therefore be low if the neighborhood contains mostly pixels of
relatively equivalent brightness, and large if the neighborhood contains mostly pixels
of very different brightness. Entropy is a measure of randomness, and is highest
when all gray-level differences are equally likely and is lowest when only one graylevel difference is possible. In almost all applications, some statistical element is
utilized. In some cases, in texture classification using spectral analysis, after
3
converting the original image to its frequency domain using a transform analysis,
moments and/or entropy is calculated for the transformed image. So the knowledge
of statistical approaches and in particular moments and entropy calculations is
indispensable to all texture analysis applications.
1.2.2 Structural Approaches
They represent texture by well-defined primitives (micro-textures) and
hierarchy of spatial arrangements (macro-textures) of those primitives. Those
primitives are called textels or textons. To describe the texture, one must define the
textons and the placement rules. These rules are typically relational descriptions, for
 aA , b 
 cA , etc… The advantage of the structural
 a , a 
example: S 
approach is that it provides a good symbolic description of the image; however, this
feature is more useful for synthesis than analysis tasks. It also works well if the
texture consists of bricks or piles of coins. Conversely it can be ill defined for natural
textures because of the variability of both micro and macro structure and no clear
distinction between them. Structural approaches are popular in model-based image
coding, textiles and garment design.
1.2.3 Spectral Approaches
Spectral approaches deal with the arrangement of image primitives, such as
the description of the texture based on the regularity spaced parallel lines. Prominent
peaks in the spectrum give the principal direction of the texture patterns. The
location of the peaks in the frequency plane gives the fundamental spatial period of
the patterns. Transform methods of texture analysis, such as the Fourier Transform
and the Wavelet Transform represent an image in a space whose co-ordinate system
has an interpretation that is closely related to the characteristics of a texture (such as
frequency or size). Transforms are discussed in details in chapter 3 and are deployed
throughout this thesis document.
Traditional spectral methods for texture analysis like the Fourier Transform
use a fixed scale and frequency resolution over the entire region. In the last decade,
such methods have gone through major modifications through multiresolution
transforms. In these transforms, scale and frequency are changed to allow local
analysis to be carried out over different scales [29]. This allows to determine texture
properties on different scales and hence to give better description of the texture
4
especially in the presence of large and small features in the same region. Most
medical applications and natural image texture classifiers use spectral analysis.
1.3 Thesis Objectives and Organization
The work presented in this thesis investigates the spectral approach to texture
classification based on multiresolution transform analysis. The most optimal known
transform is the Karhunen-Loeve transform (KLT) but it is difficult to compute in
real time [33]. In contrast, the Fast Fourier Transform (FFT), and other transforms like
the Walsh Hadamard transform and the Haar transform belong to the class of fast
transforms that are independent of the image statistics. Transforms such as the
Walsh Hadamard and Haar can be implemented quickly however they are usually
not as efficient as the Discrete Fourier Transform.
Although transform based texture analysis techniques such as the Fast
Fourier Transform and the Wavelet Transform are widely used, the high cost
associated with the Wavelet Transform suggests that spectral approaches to texture
classification may still favor FFT-based transform analysis. In this respect, the
Hartley Transform suggests a better alternative to the broadly used Fast Fourier
Transform. Moreover, viewing texture features in different spectral resolutions will
provide further means to enhance the classification efficiency.
On the other hand, many discriminating features of textures are present in the
spatial domain of the texture. Of these, global features such as intensity histograms
and entropies can still add significant information to the texture classification
process.
The objective of the present work is to introduce a hybrid methodology for
texture classification based on a spatial domain global pre-classifier together with a
spectral classifier that utilizes multiresolution transform analysis. The pre-classifier
uses texture intensity histograms to derive histogram moments that serve as global
features. A spectral classifier that uses multiresolution Hartley transform follows the
pre-classifier. Although the Fast Hartley Transform has been recently used in texture
classification papers, no multiresolution analysis for the Hartley Transform has yet
been considered.
5
The present thesis is organized in seven chapters. Chapter 2 is a survey on the
previous work in texture classification. Chapter 3 presents an overview of transform
(spectral) methods used for texture analysis. Chapters 4, 5 and 6 present the actual
thesis work that develops the introduced methodology. Chapter 4 develops the
spatial domain global classification methodology (the pre-classifier) based on a
mathematical histogram moment function to identify texture classes. Chapter 5
presents a comparison between different transforms and shows that the Fast Hartley
Transform (FHT) provides better computational efficiency. Also in chapter 5, we
develop the spectral classifier using the Fast Hartley Transform to identify texture
sub-classes. The possibility of the use of a Multiresolution Fast Hartley Transform in
texture analysis is investigated in chapter 6 and is used to identify textures subclasses. Conclusions and future work are presented in chapter 7.
6
Chapter 2
Literature Survey
7
Chapter 2
Literature Survey
2.1 Introduction
The analysis of textures continues to generate interest because of the limited
success most of the presented methods of analysis have met [21]. Most of the debate
has been centered on the issue of analyzing texture using Statistical, Structural or
Spectral methods [2, 16, 20, 22, 24, 25]. It would be useful to develop a model with
more power than traditional techniques, but which does not require massive
computational resources. Most of the previous work lies in the statistical, spectral
and multiresolution spectral approaches.
2.2 Statistical Approaches
In 1981 Julesz has studied human texture perception and proposed the texton
theory based on first order measures of local image features [12, 13]. Textons are
micro-textures that form a hierarchy of spatial arrangements (macro-textures).
Another psychophysicist, Beck et al. in 1983 [3], has proposed a theory based on first
order statistics of attributes of texture elements. Murino et al. [32] present a texture
classification scheme that is based on using Higher Order Statistics (HOS) for
defining discriminatory features. The main advantage of using HOS parameters lies
in their insensitivity to the Gaussian noise, especially in the third order statistics.
Jernigan and D’Astous [14] applied entropy measure on the normalized power
spectrum in the frequency domain. For highly structured distributions, they get a
low entropy value, and for more random distributions they give higher entropy
value. By treating the image spectrum within a region as a probability distribution,
an entropy measure is obtained that reflects the distribution of spectral components.
For discrimination between two textures, an entropy vector is obtained from
different parts of the texture. The distance between entropy vectors of two regions
shows the dissimilarity between them.
8
2.2.1 The Co-occurrence Matrix:
One of the most popular statistical approaches for texture classifiers is the cooccurrence matrix [24]. Measures of texture using only histograms carry no
information regarding the relative position of pixels with respect to each other. One
way to solve this drawback is to use a co-occurrence Matrix which is calculated as
follows:
Let P be a position operator and let A be a k x k matrix whose element a ij is the
number of times the gray level z i occurs (in the position specified by P) relative to the
gray level z j . For example consider the below image matrix with three gray levels
from 0 to 2
0
0
0
1
2
1
1
0
1
1
2
2
1
0
0
1
1
0
2
0
0
0
1
0
1
Let the position operator P be defined as one pixel to the right and one pixel below.
4 2 1
Therefore: A  2 3 2


0 2 0
z1  0, z 2  1 and z 3  2
Therefore
a11 = Total points arranged such that the top left is 0 and the bottom right is 0 = 4
a12 = Total points arranged such that the top left is 0 and the bottom right is 1 = 2
And so on…
The size of A is determined by the number of distinct gray levels in the input image.
Let n be the total number of point pairs in the image that satisfy P.
In this example n = 16.
If a matrix C is formed by dividing every element of A by n then cij is an
estimate of the joint probability that a pair of points satisfying P will have values
9
( zi , z j ). The matrix C is called the gray level co-occurrence matrix. Because C
depends on P the presence of a given texture pattern may be detected by choosing an
appropriate position operator. For instance the operator used in this example is
sensitive to bands of constant intensity running at  45o . A set of descriptors useful
for this purpose includes:
1. Maximum Probability: max ( cij ) gives an indication of the strongest response to
P.
2. Element Difference Moment of order k,
(i  j)
i
k
cij that has a relatively low
j
value when the high values of C are near the main diagonal because the
differences (i - j) are smaller there.
3. Inverse element difference moment of order k
cij
 (i  j)
i
k
where i  j that has
j
a relatively high value when the high values of C are near the main diagonal.
4. Entropy, 
c
ij
i
log cij the measure of randomness achieving its highest
j
value when all the elements of C are equal.
5. Uniformity,
c
2
ij
i
is lowest when cij are all equal.
j
The texture of an unknown region is determined by how closely its descriptors
match.
2.3 Spectral Approaches
He and Wang [6] proposed a new set of texture measurements derived from
the spectrum of an image. They stated that a texture image is considered as a set of
small units, known as texture units, which characterize the local texture information
for a pixel and its neighborhood. Texture spectrum is termed as the frequency
distribution of all texture units. Based on texture spectrum, various features are
extracted from a texture image. The features extracted include: black-white
symmetry, geometric symmetry, degree of direction, orientational features, and
central symmetry. These features extract textural information of an image with a
complete set of texture characteristics in all eight directions instead of using only the
10
row texture spectrum as used in other studies. The authors performed experiments
to prove the validity of the method. Four orientational features, one centralsymmetry feature and one directionality feature were used to discriminate between
six different textures from the Brodatz album [19]. The textures were discriminated
successfully by using these measures.
The most popular spectral transform methods are discussed in details in chapters 3
and 5.
2.4 Multiresolution Spectral Approaches
With regard to spectral methods, it may be true that information contained in
a spectrum, such as the Fourier Spectrum, is capable of accurately describing the
periodic patterns in a texture region [6]. On the other hand, most traditional
approaches to texture analysis are restricted to the analysis of spatial interaction over
relatively small neighborhoods. Therefore their performance is best for segmenting
micro textures [10].
Experimental evidence on human vision supports the notion of spatial
frequency analysis that maximizes the simultaneous localization of energy in both
spatial and frequency domains [10]. These findings have motivated several
important studies in texture analysis namely Multiresolution Algorithms [10, 11, 29,
30]. Chen and Chen [5] detail the traditional Gabor filter originally proposed by
Gabor [7] and propose a modified version that works at different image resolutions.
The traditional Gabor filter is applied to an image for extracting texture by
convolving them. The procedure involves taking the Fourier Transform of the image
and the Gabor function, taking the convolution, and then taking an inverse
transform. By this process, different frequency sub-bands are highlighted depending
on the Gabor filter parameters and the resultant image can be analyzed for detecting
features that describe texture properties corresponding to different frequencies.
In the case of multiresolution Gabor filters, low-pass filter is applied as the
finest resolution (level 0), the next high-pass filter at level 1 by sub-sampling the
image, and so on. At each step, the Gabor filter is convolved in four separate
directions, and in the resultant image, the authors compute mean and variance as
texture features. The system is 58% faster in terms of computational time compared
11
to calculating the same features on standard Gabor filter implementation. In their
experiments, nine test images of size 512x512 pixels are further subdivided into a
total of nine parts giving a total of 81 sub-images. The single nearest neighbor
classification shows that both the multiresolution and traditional Gabor filters
achieve the same accuracy of 98.8%.
Tao et al. in 1993 [29] introduced the Multiresolution Fourier Transform and
in 1995 [30] he introduced the Windowed Fourier Transform in a two-component
model of texture for analysis. The Windowed Fourier Transform was used later in
1997 by Robert Azencott et al. [26] in Texture Classification using Windowed Fourier
Filters and is discussed in details in chapter 3.
Raafat et al. in 1998 [10] used the Wavelet Packets in unsupervised texture
classification and is also discussed in chapter 3. Tolba et al. [1] also discussed the
Hartley Transform as a spectral tool for texture classification. The Hartley Transform
is discussed in chapter 5. Pichler et al. [18] compare wavelet transforms with
adaptive Gabor filtering feature extraction and report excellent results using Gabor
techniques. However, the computational requirements are much larger for these than
needed for wavelet transform, and in certain applications accuracy may be
compromised for a faster algorithm.
Randen and Husoy [27] provide a detailed comparative study of various
filtering approaches to texture extraction. The basic assumption for most filtering
approaches is that the energy distribution in the frequency domain defines a texture.
Hence, if the frequency spectrum is decomposed into sufficient number of subbands, the spectral energy signatures for these are very different for different
textures. The approaches compared in this study include Law’s masks, ring/wedge
filters, dyadic Gabor filter banks, wavelet transforms, wavelet packets and frames,
quadrature mirror filters (QMF), discrete cosine transform (DCT), eigen filters,
optimized Gabor filters, linear predictors and optimized finite impulse response
filters. The experiments were conducted on composite texture images. The authors
find that no clear hierarchy of classification performances is observed. Different
methods perform better on different images. The traditional Law’s method and
ring/wedge filters never stand out. The poor performances are also observed for
Gabor filter bank and DCT. DCT however has the least computational complexity of
all methods. The QMF and wavelet frame approaches are among the best for most
12
images. Co-occurrence matrix method is also compared and found to be the worst in
all experiments.
Four filtering methods of texture discrimination have been compared by
Chen and Chen [4]. These methods include Fourier Transform, spatial filter, Gabor
filter and wavelet transform. A total of six texture images are divided into one
hundred 128x128 pixel sub-images from each texture giving a data set of 600 images.
They found that wavelet and Gabor features perform equally well but the wavelet
method is computationally less expensive.
13
Chapter 3
Transform Methods for Texture Analysis
14
Chapter 3
Transform Methods for Texture Analysis
3.1 Introduction
Image processing and analysis based on continuous or discrete image
transforms is a classic processing technique. Transforms are widely used in image
filtering, image data compression, image description, etc. The transforms discussed
in this chapter are the Fourier Transform (FT), the Windowed Fourier Transform
(WFT), the Multiresolution Wavelet Transform (MWT) and the Multiresolution
Fourier Transform (MFT).
3.2 The Fourier Transform (FT)
The purpose of this section is to provide an overview of the Fourier
Transform since most of the transforms discussed in this thesis are based on Fourier
Transform or at least refer to it. It is also one of the most widely used transforms in
texture segmentation. Later in the section, it is also mentioned some of its drawbacks
in image analysis and the need for improvement.
The Fourier Transform is an important image processing tool that is used to
decompose an image into its sine and cosine components [24]. The output of the
transformation represents the image in the Fourier or frequency domain, while the
input image is the spatial domain equivalent. In the Fourier domain image, each
point represents particular frequency contained in the spatial domain image.
Since we are only concerned with digital images, this discussion is restricted
to Discrete Fourier Transform (DFT). The DFT is the sampled Fourier Transform and
therefore does not contain all frequencies forming an image but only a set of samples
that is large enough to fully describe the spatial domain image. The number of
frequencies corresponds to the number of pixels in the spatial domain image, i.e. the
images in the spatial and Fourier domain are of the same size.
For a square image of size N x N, the two dimensional DFT is given by:
15
F ( u, v ) 
1
N
N 1 N 1
 f ( x, y )e
 j 2  ( ux  vy ) / N
3.1
x 0 y 0
Where f ( x, y ) is the image in the spatial domain and the exponential term is the base
function corresponding to each point in the F (u, v ) in the Fourier space. The equation
can be interpreted as: The value of each point F (u, v ) is obtained by multiplying the
spatial image with the corresponding base function and summing the result. The
base function is composed of sine and cosine waves with increasing frequencies, i.e.
F (0,0) represents the component of the image which corresponds to the average
brightness and F ( N  1, N  1) represents the highest frequency.
In a similar way, the Fourier image can be re-transformed to the spatial domain. The
inverse Fourier Transform is given by:
f ( x, y ) 
1
N
N 1 N 1
 F (u, v )e
j 2  ( ux  vy ) / N
3.2
u 0 v 0
To obtain the result for the above equation, a double sum has to be calculated for
each image point. However because the Fourier Transform is separable, to decrease
the number of required computations, it can be re-written as:
F ( u, v ) 
1
N
N 1

e  j 2 ux / N
x 0
N 1
 f ( x, y )e
 j 2 vy / N
3.3
y 0
And
f ( x, y ) 
1
N
N 1

u 0
e j 2 ux / N
N 1
 F (u, v )e
j 2 vy / N
3.4
v 0
Even with these computational savings, the DFT has N 2 complexity. This can be
reduced to N log 2 N if we employ the Fast Fourier Transform (FFT) [24]. The FFT
restricts the size of the input image to N  2 n where n is an integer.
Usually the dynamic range of the Fourier coefficients (the intensity values in the
Fourier image) is too large to be displayed on the screen. Therefore a logarithmic
transformation is applied to the image before it is displayed.
16
The Fourier Transform produces a complex number valued output image
which can be displayed with two images either with the real and imaginary part or
with magnitude and phase. The magnitude contains most of the information of the
geometric structure of the spatial domain.
The magnitude F (u, v )  R 2 (u, v )  I 2 (u, v )
3.5
It is also called the Fourier spectrum of f ( x, y ) , where R(u, v) and I (u, v ) are the real
and imaginary components of F (u, v ) , respectively.
The phase angle  (u, v )  tan 1
I (u, v )
R ( u, v )
3.6
f(x)
x
Figure 1: The amplitude and phase angle of a sine wave at a particular frequency
The variables u and v appearing in the Fourier Transform are often called the
frequency variables since the expression of the exponential term
e  j 2 ux  cos 2ux  j sin 2ux
3.7
And thus F (u, v ) is composed of the sum of sine and cosine terms and that each
value of u and v determines the frequency of its corresponding sine and cosine pair.
The Fourier Transform is based on global information, therefore when using
FFT analysis to study the frequency spectrum, there are limits on the detection of
small features in the presence of large ones [29]. This is a major drawback since small
features are just as important for image analysis as large features. The Windowed
Fourier Transform addresses this drawback. It combines both the spatial and
17
frequency domain dividing the images into small windows so that small features are
also detected.
3.3 Windowed Fourier Transform (WFT)
The Windowed Fourier Transform multiplies the Fourier Transform
sinusoidal waves by a window which is localized in space [29]. Therefore we are
looking at the image from narrow windows. The window function is first located at x
= 0 and keeps shifting till the end of the x-axis of the image. Let’s suppose the width
of the window is w, then every time the window shifts w pixels to the right till it hits
the end of the x-axis. The window function and the image are multiplied producing
another image, whose Fourier Transform is to be taken. So while the Fourier
Transform analyses the entire image to infinite sines and cosines to see how many
frequencies the image contains, windowed analysis compares segments of the image
and when the segment is analyzed the window slides along the image to analyze
another segment.
Although Windowed Fourier Transform solved the issue regarding small
features, it still has a major drawback. The size of the window is fixed and therefore
it will be difficult to capture a single feature whose size is larger than the window’s
size. And if we increase the size of the window we will be missing the small features.
So while solving the issue of small features, the issue of large features is raised.
Multiresolution Transforms, solve this problem. In Multiresolution, the size of the
window is not fixed. So for detecting small features in the image, only narrow
windows are selected and for detecting large features, larger windows are selected.
First in section 3.4 we discuss the Wavelet Transforms since they are multiresolution
by nature then in section 3.5 we discuss the Multiresolution Fourier Transform.
3.4 Multiresolution Wavelet Transform (MWT)
A Wavelet is a small wave that provides information on the energy content of
the image over different spatial frequency bands and orientations [18]. Wavelet
Transform cuts up complicated functions into simpler frequency components, and
then studies each component separately with a resolution matched to its scale. The
18
width of the window is changed and the transform is computed for every spectral
component. The size of the window is changed according to the wavelet when it is
stretched or compressed. The wavelet transform filters the image with a set of
transitions and dilations using a basic function  which is used to create a family of
wavelets  ( au  b) where a and b are real numbers such that a dilates the function
 and b translates it (here we use one dimensional representation for simplicity).
 a , b (u )  a
1 / 2

ub
a
3.8
Where  (u) is called the mother wavelet.
u
The basic wavelet  (u) is scaled as  ( ) which is dilated if a  1 to search for large
a
features and compressed if a  1 to search for small fine details.
Although the wavelet transform is able to detect both small features and large
features at the same time, through stretching and narrowing the window used, its
computation time is N 2 which makes it very expensive to use.
3.5 Multiresolution Fourier Transform (MFT)
The Multiresolution Fourier Transform is the generalization of the Wavelet
and Windowed Fourier Transforms in which scale and frequency are independently
changed allowing local Fourier analysis to be carried out over different scales [29]. By
using Multiresolution Fourier Transform it is also possible to identify the smallest
scale which gives acceptable results in the matching process. The size of the ideal
prototype will vary according to the structure within a given texture. The MFT
corresponds to the Discrete Fourier Transform of the region defined by a window
wn ( j ) centered on the point  i (n ) where the spatial range changes with the index n.
x* (i (n),j (n), n) 
 w (
n
k
 i ( n)) x(k ) exp[  j wj ( n).k ]
k
19
3.9
The Multiresolution FT is as follows:

Multiple resolutions (scales) are generated for the test image as shown below
in figure 2

For each resolution, Fast Fourier Transfer is applied

A confidence level is assigned to the prominent features (peaks) in the
applied FFT

A vote is made for the set of highest confidence levels and their
corresponding resolutions
FFT
FFT
FFT
Figure 2: Multiresolution Fourier Transform
Following this procedure, Multiresolution Fourier Transform is able to detect both
large features and small features and its time complexity is N log 2 N .
Working with the imaginary part in the Fourier domain is complicated and it
consumes large space in memory. It would be easier to work with a similar algorithm
like the Multiresolution Fourier Transform that does not include imaginary values
and be able to detect small and large features. In chapter 5, the Hartley Transform is
introduced. It is very similar to the Fourier Transform but unlike the Fourier
Transform, it deals with real values only. In chapter 6 an attempt is made to apply
the multiresolution techniques to the Hartley Transform.
20
Chapter 4
A Pre-classifier for Texture Using
Spatial Histogram Moments
21
Chapter 4
A Pre-Classifier for Texture
Using
Spatial Histogram Moments
4.1 Introduction
In the present work, we introduce a hybrid methodology for texture
classification. According to this methodology, the texture classification process is
divided into two phases. The first phase is a pre-classifier (explained in this chapter)
based on a mathematical moment function that is derived from global spatial domain
intensity histograms. The second phase is a spectral classifier based on the Hartley
Transform and multiresolution analysis (discussed later in chapters 5 and 6).
In order to test the proposed method, texture images were synthesized using
mathematical texture generating functions. An image belongs to a class and a subclass. The class being the mathematical function and the sub class is the frequency
range, discussed later in section 4.2. The pre-classifier input is the sample image and
its output is the image class. The output of the pre-classifier (the image class) plus the
original image are fed into the classifier that determines the image sub-class. With
the pre-classifier and the classifier output information, the process of matching two
sample textures is achieved by comparison of both classes and sub-classes.
4.2 Generating Texture Images
In order to test the different texture descriptors, we need to generate simple
synthetic textures with “known properties”. Periodic functions such as sine and
cosine can be combined to generate some simple textures. If the image height is n
rows, and width is m columns, then the x-values will be {0 to m-1} and the y values
will be {0 to n-1}. The x-vector is x = 0 : m-1 and the y-vector will be y = 0 : n-1. If f(x)
is the value of a periodic function at a value of x, then Fx = f(x) is a row vector of size
m representing the variation in x-direction. The corresponding row vector in the y-
22
direction is Fy = f(y) with size n. Multiplying the two vectors will generate the n x m
matrix, i.e.
F = FyT Fx
For the values of this matrix to represent gray levels, we normalize the values to the
maximum value in the whole matrix, so that all values are between {0 and 1}.
900 texture images are generated for the purpose of building and testing the
performance of the pre-classifier and the classifier. The samples used for training the
classifiers are classified into three classes: Fxy1, Fxy2 and Fxy3. Each class is subclassified further more into three sub-classes: Fxy1LL for low frequencies in both the
x-axis and the y-axis, Fxy1MM for mid frequencies in both axis and Fxy1HH for high
frequencies. Similar sub-classes are generated for Fxy2 and Fxy3. The task of the preclassifier is to determine if the image belongs to Fxy1, Fxy2 or Fxy3. The task of the
classifier is to identify the image frequency sub-class LL, MM or HH. Below, figure 3,
explains how the images are classified in the system.
900
images
450
samples
150
Fxy1
50
LL
50
HH
50
MM
150
Fxy2
50
LL
50
MM
50
HH
450
test
150
Fxy3
50
LL
150
Fxy1
50
HH
50
LL
50
MM
50
HH
50
MM
Figure 3: Image Classification
23
150
Fxy2
50
LL
50
MM
50
HH
150
Fxy3
50
LL
50
HH
50
MM
Three mathematical functions are used to generate the texture images
4.2.1 Fxy1
Fxy1  (1  sin( 2ux))T  (1  sin( 2vy))

4.1
x is a matrix that ranges from 0 to 255 and y is a matrix that ranges from 0
to 255 generating a 256x256 image

u and v range from 0.045 to 0.055 for low frequencies and from 0.145 to
0.1549 for mid frequencies and from 0.295 to 0.29995 for high frequencies

100 images (50 samples and 50 test images) are generated for each
frequency range (sub-class) by varying the frequency in that range.
Figures 4, 5 and 6 are sample images from Fxy1LL, Fxy1MM and Fxy1HH
respectively. The matlab code for generating Fxy1 images is listed in Appendix
A section k.
Figure 4: Sample Images for Fxy1LL
Figure 5: Sample Images for Fxy1MM
24
Figure 6: Sample Images for Fxy1HH
4.2.2 Fxy2
Fxy2  (1  sin( 2ux)  sin( 4ux))T  (1  sin( 2vx)  sin( 4vx))
4.2
Frequency classes similar to Fxy1 were used, and 100 texture images were
generated for each class (50 samples and 50 test images).
Figures 7, 8 and 9 show sample images of Fxy2LL, Fxy2MM and Fxy2HH
respectively, the matlab code for generating Fxy2 images is listed in Appendix A
section l.
Figure 7: Sample Images for Fxy2LL
25
Figure 8: Sample Images for Fxy2MM
Figure 9: Sample Images for Fxy2HH
4.2.3 Fxy3
Fxy3  (2.7  sin( 2ux)  cos(3ux))T  (2.7  sin( 2vx)  cos(3vx))

4.3
u and v range from 0.045 to 0.055 for low frequencies and from 0.145 to 0.1549
for mid frequencies and from 0.295 to 0.297 for high frequencies
Figures 10, 11 and 12 show sample images of Fxy3LL, Fxy3MM and Fxy3HH
respectively, the matlab code for generating Fxy3 images is listed in Appendix A
section M
26
Figure 10: Sample Images for Fxy3LL
Figure 11: Sample Images for Fxy3MM
Figure 12: Sample Images for Fxy3HH
27
4.3 Moments
In this section we introduce the theory of moments followed by how the
classifier utilizes moments in generating and determining sample image classes.
4.3.1 Moments Theory
The moments of the gray level histogram of an image are described as
follows: Let z be a real variable denoting the gray levels and let
p ( z i ),
i  1,2,..., L be the corresponding histogram where L is the number of distinct gray
levels (as shown in figure 13)
Figure 13: Image Gray Level Histogram
The nth moment of z about the mean is  n ( z ) 
L
( z
i
 m) n p( zi )
4.4
i 1
Where m is the mean value of z (the average intensity) m 
L
 z p( z )
i
i
4.5
i 1
L
 0  1 since
 p( z )  1
4.6
i
i 1
L
L
L
i 1
i 1
i 1
1  0 since n ( z )   ( zi  m ) p( zi )   zi p( zi )  m  p( zi )  m  m  0
28
4.7
The second moment is the variance  2 ( z ) . The variance is important for texture
description because it measures the gray level contrast (spread) which is used in
measuring the relative smoothness of the texture. The third moment is a measure of
skewness of the histogram. The fourth moment is a measure of its relative flatness.
4.3.2 Applying Moments on Sample Images
As mentioned in section 4.2, Fxy sample images are grouped under three
classes. Each class contains 150 images (50 for each sub class). For the pre-classifier to
function, all 450 training images are scanned and their moment values are recorded.
For each image, the histogram is extracted and normalized. Figures 14, 15 and 16
show sample images grey level histograms for Fxy1, Fxy2 and Fxy3 respectively.
Figure 14: Sample Image Grey Level Histogram for Fxy1
Figure 15: Sample Image Grey Level Histogram for Fxy2
29
Figure 16: Sample Image Grey Level Histogram for Fxy3
Normalizing the histogram (converting the histogram from pure gray scale values to
a probability density function, PDF) is achieved by dividing each value in the
histogram by the total sum and normalizing the gray level scale to {0,1.0}. Examples
of these PDFs are given in figure 17 for three sample textures representing Fxy1,
Fxy2, Fxy3 at u = 0.05 and v = 0.05.
Fxy1
Fxy2
Fxy3
Figure 17: Sample Image PDF plots for LL sub-class
The second, third, fourth and fifth moments are calculated for each PDF and
saved in a 1x4 matrix. At the end of the process, there is a 150x4 matrix for each class.
As discussed earlier  0  1 and 1  0 consequently moments of degrees zero and one
are not included in the calculations. To save memory space, not all 150x4 values are
30
recorded, only the average, minimum and maximum values for each moment degree
is recorded. Therefore for each class only twelve values are saved (3x4). Tables 1, 2
and 3 show moment values for each class, where m2 stands for the second moment,
m3 for the third moment, etc… Also a1 stands for the average value for all 150
images, l1 stands for the least value and g1 stands for the greatest value.
Table 1: Moment Values for Fxy1 Images
m2
m3
m4
m5
a1
0.9009
0.2817
0.0955
0.0332
L1
0.8732
0.2688
0.0907
0.0315
g1
0.9232
0.2943
0.1014
0.0367
Table 2: Moment Values for Fxy2 Images
m2
m3
m4
m5
a2
0.7536
0.2183
0.0748
0.0269
l2
0.7485
0.2156
0.0732
0.0259
g2
0.8035
0.2339
0.0783
0.0281
Table 3: Moment Values for Fxy3 Images
m2
m3
m4
m5
a3
0.8513
0.2430
0.0796
0.0276
l3
0.8401
0.2380
0.0778
0.0270
g3
0.8589
0.2473
0.0816
0.0285
4.3.3 Deduction of an Image Class from its Moment Value
To determine a sample image class, the following procedure is followed:
a. Normalize the sample image histogram.
b. Calculate the second, third, fourth and fifth moments of the normalized
histogram and save them in matrix mom where mom(1) is the second degree
moment, mom(2) is the third degree moment, etc…
c. Retrieve the three moment values tables for all three classes (tables 1, 2 and 3)
d. Apply the minimum distance (Euclidian) classifier
31
Dxyi  (mom(1)  ai(1)) 2  (mom(2)  ai(2)) 2  (mom(3)  ai(3)) 2  (mom(4)  ai(4)) 2
4.8
Where i denotes the class index
e. The minimum value (min (Dxy1, Dxy2, Dxy3)) suggests the class.
The pre-classifier modules were implemented as given in Appendix A sections b, c
and d. Preclassifier.m calculates the moment values for all training images and saves
the average, least and greatest values for all three classes. Preclassifierfv.m
determines a sample image’s class. The input is any sample image and the output is
the image class, fxy1, fxy2 or fxy3. Preclassifierfvtest.m tests all sample images and
produces the result.
4.4 Results
If we analyze tables 1, 2 and 3 we find that moment values for fxy1, fxy2 and
fxy3 are almost separable and that the small intersection between them increases
with the moment degree. Subsequently, in the second moment, there is almost no
intersection between the three classes, in the third moment fxy2 and fxy3 are sharing
the same border, in the fourth moment, fxy2 and fxy3 are intersecting and in the fifth
moment, fxy3 is almost in the range of fxy2. The synthesized sample images give
excellent discriminating results using the second moment, but that is not generally
the case in for example, natural images. Therefore for compatibility and future image
migration, all four moments are incorporated. Figures 18, 19, 20 and 21 show the
intersection between the three classes for all four moments.
4
3
2
1
0
fxy1
Moment Values
Figure 18: Second Moment Chart
32
0.
92
0.
9
0.
88
0.
86
0.
84
0.
82
0.
8
0.
78
fxy2
0.
76
0.
74
Fxy
Second Moment
fxy3
Third Moment
fxy1
29
2
fxy3
0.
28
6
0.
28
0.
27
4
0.
26
8
0.
26
2
0.
25
6
25
0.
0.
24
4
0.
23
8
0.
23
2
0.
0.
0.
0.
22
22
6
fxy2
21
4
Fxy
4
3
2
1
0
Moment Values
Figure 19: Third Moment Chart
4
3
2
1
0
fxy1
07
8
0.
08
0.
08
2
0.
08
4
0.
08
6
0.
08
8
0.
09
0.
09
2
0.
09
4
0.
09
6
0.
09
8
0.
1
0.
10
2
fxy3
0.
07
6
0.
07
4
0.
0.
0.
07
2
fxy2
07
Fxy
Fourth Moment
Moment Values
Figure 20: Fourth Moment Chart
4
3
2
1
0
fxy1
03
6
fxy3
0.
03
44
0.
03
28
0.
03
12
0.
02
96
0.
02
8
0.
02
64
0.
02
48
0.
02
32
0.
02
16
fxy2
0.
0.
02
Fxy
Fifth Moment
Moment Values
Figure 21: Fifth Moment Chart
All 450 test images are fed into the module Preclassifierfvtest.M listed in
Appendix A section d. Each image moment value is calculated and checked against
tables 1, 2 and 3. The minimum distance is calculated and the image class is
identified. If the image class is not correct, the image name and its wrong class is
33
saved in matrix err. The results obtained for the 450 test textures are shown in Table
4, which indicates an average classification accuracy of 99.89%.
Table 4: Moments Matching Results
Image Class
Accuracy
Fxy1
Fxy2
Fxy3
100%
99.67%
100%
4.5 Conclusion
It was decided early on that the pre-classifier is based on statistical analysis
and the classifier on transform analysis. It should be mentioned that our initial choice
to statistical analysis was entropy measures, but entropy values did not give any
discriminating results. This is most probably due to the fact that all three classes
contain close amounts of information and the frequency ranges are almost similar.
The mean value or the median or simple histogram calculations were not enough to
detect the image class. Taking moment degrees gave excellent results especially the
second moment. As mentioned above, third, fourth and fifth moments are only
incorporated for compatibility and future image migration. Since moment values do
not occupy large memory space and their computation speed is very fast, we were
encouraged to keep all four degrees in the system.
The main motivation of this thesis document is transform analysis and the
collaboration between the pre-classifier and the classifier. If other images were
chosen like natural images or medical images, the focus would all go to how these
particular images are recognized. Later on, both the pre-classifier and the classifier
can be utilized for other images. Changing image frequency in each class to generate
sub-classes serves the purpose of testing the classifier. For the sub-classifier, all
images belonging to the same class have the same range of moment values regardless
of their sub-class.
34
Chapter 5
A classifier for Texture using
Transform Analysis
35
Chapter 5
A Classifier for Texture
Using
Transform Analysis
5.1 Introduction
In chapter 3 several transform analysis methods were discussed and it was
mentioned that the Multiresolution Fourier Transform is the least expensive
algorithm to follow. It is also better than the normal Fourier Transform in that it can
detect both small and large features in the image. One of the major drawbacks in the
Fourier Transform is working with imaginary numbers because they are complicated
to handle and occupy large memory space. Here in this chapter the Hartley
Transform is discussed in details. It is very similar to the Fourier Transform but it
deals with real values only. The spectral classifier used in the present work is based
on the Hartley Transform. For test purposes, and similar to the case of the statistical
pre-classifier, all training images were used and the Hartley Transform is generated
for each image. The function of the spectral classifier is to determine the image sub
class LL, MM or HH.
5.2 The Fast Hartley Transform
The Hartley Transform was discovered by R.V.L Hartley back in 1942. The
'fast' version of it appeared in a book by Ronald Bracewell in 1984 [28]. The basic
structure is very similar to the Fourier Transform. The Discrete Fourier Transform
(DFT) transforms a sequence of real numbers from the spatial domain into a
sequence of complex numbers in the frequency domain [1]. Half of the numbers in
the frequency domain are redundant because the information in the negative
frequencies repeats the information in the positive frequencies.
36
In other words, if x f (k ) is the Fourier Transform of a real sequence of real numbers,
then
Real ( x f (k ) ) = Real ( x f (  k ) )
5.1
and
Imag ( x f (k ) ) = Imag (  x f (  k ) )
5.2
The Hartley Transform can be viewed as an algorithm that removes redundancy in
the Fourier domain by replacing the numbers through the relation
xn (k ) = Real ( x f (k ) ) – Imag ( x f (k ) )
5.3
Where xn (k ) , is the Hartley Transform of a sequence and x f (k ) is the Fourier
Transform of the same sequence
The Hartley Transform therefore results in real numbers and no information is lost
since data in the Hartley domain can be converted back to the Fourier domain by the
relations
Real ( x f (k ) ) = ( xn (k ) + xn ( k ) ) / 2
5.4
Imag ( x f (k ) ) = ( xn (k ) – xn ( k ) ) / 2
5.5
Since no information gets lost in the transform, the real sequence in the frequency
domain uses the minimum required memory space. The frequency representation is
real, which means the Hartley Transform requires fewer multiplications.
Hence, the real Hartley Transform is defined entirely in real numbers and the
forward and reverse transforms are identical. Finally the FFT is directly obtainable
for the Hartley Transform by straight forward sums and differences [1].
The two dimensional discrete Hartley Transform H (u, v ) of an image f ( x, y ) of size
MxN is defined by:
37
H ( u, v ) 
1
MN
 
M 1
N 1
x 0
y 0
f ( x, y )cas[2 (ux / m  vy / N )]
5.6
H (u, v )cas[2 (ux / m  vy / N )]
5.7
and
f ( x, y ) 
 
M 1
N 1
x 0
y 0
Where cas( x)  cos( x)  sin( x)
5.8
The Fast Hartley Transform has recently become of popular use in image
compression, computation of geometric moments, image reconstruction, adaptive
filtering, interpolation, convolution, correlation and signal processing.
5.3 Applying the Fast Hartley Transform on the Sample Images
Similar to the pre-classifier, the classifier examines feature data that describes
each image. This data determines the image sub-class. The procedure to generate this
data is as follows:
a. Each image is loaded into a matrix and the Hartley Transform is applied to
each image producing a new matrix
b. Normalize the new matrix
c. Sum the columns and the rows and store results into two vectors,
representing the x-frequency and y-frequency projections, respectively
d. Extract the position of the highest 4 peaks from the above vectors.
e. Sort those positions and save them in a 1x4 position matrix
f.
To get true peaks, small peaks are removed by applying a 10% threshold on
the graph
g. Repeat the process to all images that belong to the same sub-class
h. At the end of this process, the position matrix size is 50  4 . Keeping only
unique rows reduces the size of this matrix, such that if two images in the
same sub-class have the same 1x4 position matrix, the row is saved only once.
i.
Save the matrix under the sub-class name and reset all data for the next subclass
The matlab code for the classifier is in Appendix A section e
38
The Hartley power spectrum is computed as:
P(u,v) = | F(u,v)|2
These u and v values cover the frequency ranges 0 <= u < ½ and 0 <= v < ½, where ½
is the Nyquist frequency. Such power spectrum can be visualized as a grey level
image by dividing it by the maximum power. Also, it can be considered as a random
variable so that a 2-D PDF can be computed by normalization by the sum of all the
powers in the matrix.
Figure 22 shows samples of the Hartley power spectrum PDF for Fxy1LL, Fxy2MM
and Fxy3HH, respectively.
Figure 22: Samples of the Hartley Power Spectrum PDF (50 samples each)
The u and v projection spectra corresponding to the above samples are shown in
figures 23, 24 and 25, respectively.
Figure 23: Sample of u and v projection spectra for Fxy1LL
39
Figure 24: Sample of u and v projection spectra for Fxy2MM
Figure 25: Sample of u and v projection spectra for Fxy3HH
5.4 Deduction of an Image Sub-Class from its Hartley Transform
The position matrix of each sub-class acts as a lookup table for the
classifier. The Hartley Transform is generated for the sample image and its position
matrix is extracted. This matrix is checked against the saved position matrices (look
up tables) of the sub-classes. Only three tables are checked since the texture superclass (Fxy1, Fxy2 or Fxy3) is already determined by the pre-classifier. A minimum
Euclidean distance is used to determine the most probable position of the entry in a
given lookup table. The table that gives the highest probability for the sample image
position matrix determines the sub-class (LL, MM, or HH). The Matlab code for
determining the image sub-class is given in Appendix A section f. The 9 classifier
lookup tables are given in Appendix B.
40
5.5 Results of the Hartley Transform
In the worst-case scenario, the sample image position matrix is checked 107
times (total number of rows of the three lookup tables of fxy2) till a decision is made
about its sub-class. Still this is considered a major drawback in this algorithm. This
number is decreased by 40% in chapter 6. Decreasing lookup tables saves both
memory space and computation speed.
All 450 test images are fed into the module classifierfvtest.M listed in
Appendix A section g. The results obtained are shown in Table 5, which indicates an
average accuracy of about 99.56%.
Table 5: Hartley Transform Results
Image Class
Image Sub-Class
Accuracy
Fxy1
LL
100%
Fxy1
MM
100%
Fxy1
HH
100%
Fxy2
LL
99%
Fxy2
MM
99%
Fxy2
HH
100%
Fxy3
LL
99%
Fxy3
MM
99%
Fxy3
HH
100%
This high accuracy would have decreased, if the pre-classifier did not feed the
classifier with the class name, since sub classes that have close frequencies could
produce a mismatch of the input texture.
5.6 Conclusion
Most transform analyses were investigated before the decision was made to
use the Hartley Transform. Karhunen-Loeve transform (KLT) is difficult to compute
in real time [32]. The Walsh Hadamard transform and the Haar transform are usually
41
not as efficient as the Discrete Fourier Transform. The multiresolution wavelet
transform has a high computation complexity. The Fourier Transform seemed to be
the best solution and it is very popular in texture classification, but working with
imaginary numbers is a drawback and the phase shifting resulting from imaginary
numbers complicates the process of classification. The Hartley Transform solves this
issue and it gives high accuracy results to texture classification. This high accuracy is
partially due to the fact that we are using look up tables. The draw back of lookup
tables is the occupied memory space. We tried to reduce this memory space by
removing duplicates so instead of having 50 rows for each sub class there are 20 rows
for fxy1LL, 21 for fxy1 MM, 11 for fxy1 HH, 42 for fxy2 LL, 39 for fxy2 MM, 26 for
fxy2 HH, 30 for fxy3 LL, 30 for fxy3 MM and 8 for fxy3 HH, resulting in
approximately 50% reduction of memory space. This number is reduced further in
chapter 6 using our approach of multiresolution analysis.
42
Chapter 6
A classifier for Texture using
Multiresolution Hartley Transform
43
Chapter 6
A classifier for Texture using
Multiresolution Hartley Transform
6.1 Introduction
The accuracy achieved for the single resolution classifier of chapter 5 was
high on the expense of space for the look-up tables. In the present work, we extend
the multiresolution techniques to the Hartley Transform in a restricted way by
computing the Hartley spectra in decreasing resolution. The purpose is to investigate
the effect of lowering the resolution on the size of the information needed for
matching the textures. In section 6.3, the classifier is modified to operate on this
methodology. Section 6.4 shows the results of using the standard multiresolution and
the new approach. Both results are compared against the normal Hartley Transform
used in Chapter 5.
6.2 Multiresolution Hartley Transform
The Multiresolution Hartley Transform is very similar to the Multiresolution
Fourier Transform. Scale and frequency are independently changed allowing local
Hartley Transform analysis to be carried out over different scales. Also like the
Multiresolution Fourier Transform, the size of the ideal prototype will vary
according to the structure within a given texture. Multiple resolutions are generated
for the test images using a 3x3 low pass Gaussian filter. For each resolution the
Hartley Transform is applied. To get true prominent peaks, a threshold is applied to
remove small peaks. So for each image there is more than one Hartley Transform
spectrum. Each spectrum corresponds to a certain resolution. Therefore for each subclass, there is more than one lookup table that corresponds to a particular resolution.
44
6.3 Applying the Multiresolution Fast Hartley Transform on the Sample
Textures
Similar to the previous classifier, this classifier determines the image sub-class.
The procedure to generate new lookup tables is as follows (points from a to d are
exactly like the previous single resolution classifier):
a. Each image is loaded into a matrix and the Hartley Transform is applied to each
image producing a new matrix
b. Normalize the new matrix
c. Sum the columns and the rows and store sums into two orthogonal vectors.
Extract the positions of the highest 4 peaks from the vectors
d. Sort those positions and save them in a 1x4 position matrix.
e. To get true peaks, small peaks are removed by applying a 10% threshold on the
graph.
f.
Change the image resolution by applying a 3x3 low pass Gaussian filter. Repeat
points a to d for the new resolution.
g. Keep changing the image resolution and apply points a to d till the total number
of highest peaks recorded becomes less than 3 peaks.
h. Repeat the process to all images that belong to the same sub-class
i.
At the end of this process, the position matrix size for each resolution is 50  4 .
The size of this matrix is reduced by keeping only unique rows, so if two images
in the same sub-class have the same 1x4 position matrix, the row is saved only
once.
j.
For each resolution, save the matrix under both the sub-class name and the
resolution name and reset all data for the next sub-class.
By applying this procedure to the sample textures three resolutions were obtained:
The original image resolution, a first level resolution that is achieved by applying a
3x3 low pass Gaussian filter once and a second level resolution that is achieved by
applying a 3x3 low pass Gaussian filter one more time. Further decrease of the
resolution produced too few peaks and in some images all peaks completely
disappeared. For this reason, only the first three resolutions are considered reliable.
The Matlab code for the multiresolution classifier is in Appendix A section h.
45
6.4 Deduction of an Image Sub-Class from its Multiresolution Hartley
Transform
Each image will have three different resolutions. For each resolution,
Hartley Transform is generated and its position matrix is extracted. So each image
will have three position matrices. The lookup tables are saved by their class name
and their resolution number. Therefore, for each image, 9 tables are checked, 3
resolutions for each image subclass. The tables that contain the sample image
position matrices determine the sub-class. This technique results in a much better
accuracy, but the problem we faced in the previous section was not accuracy, but the
required memory. Therefore, our approach is to investigate which resolution will
give a satisfactory trade-off between accuracy and lookup table size.
When applying a 3x3 low pass Gaussian filter to an image, the number of highest
peaks decreases and the number of rows in the lookup tables decreases accordingly.
Since this leads to a loss in information, the accuracy of results is also affected. For
example, when applying a 3x3 low pass Gaussian filter once on the Fxy images, the
total number of peaks are reduced to 3 peaks, total size of lookup tables decreased by
40% and the accuracy of results is 99%. When applying the 3x3 low pass Gaussian
filter one more time, total number of peaks remained 3 but accuracy went down to
82%. When applying the 3x3 low pass Gaussian filter a third time, accuracy
deteriorated and the total number of peaks for some images were none. So a vote for
a first level resolution is made. In this case we managed to reduce memory space by
40%, achieve 99% accuracy and increase computation speed.
The Matlab code for determining image sub-classes using one step resolution
decrease is listed in Appendix A, section i. The 9 classifier lookup tables after
applying the 3x3 low pass Gaussian filter once are given in Appendix C.
6.5 Results of the Multiresolution Hartley Transform
All test images were fed into the module multiresolutionfvtest.M listed in
Appendix A section j. 100% accuracy is achieved when nine lookup tables were
generated for each class using three resolutions in a classical multiresolution
46
approach. However, the memory space is increased by 100% and computation time
deteriorated.
When we apply a 3x3 low pass Gaussian filter only once on the image, we obtain the
results given in Table 6, the average matching accuracy in this case is about 99%. By
using such one-step resolution decrease, the lookup table sizes were reduced to 11
rows for fxy1LL, 12 for fxy1 MM, 8 for fxy1 HH, 20 for fxy2 LL, 19 for fxy2 MM, 14
for fxy2 HH, 15 for fxy3 LL, 16 for fxy3 MM and 6 for fxy3 HH. Moreover only three
position peaks are saved instead of four. Compared to the lookup tables of the
Hartley Transform in chapter 5 the total size is reduced by about 40%.
Table 6: Multiresolution Hartley Transform Results
Image Class
Image Sub-Class
Accuracy
Fxy1
LL
100%
Fxy1
MM
99%
Fxy1
HH
100%
Fxy2
LL
99%
Fxy2
MM
95%
Fxy2
HH
100%
Fxy3
LL
99%
Fxy3
MM
99%
Fxy3
HH
100%
6.6 Conclusion
In this chapter we investigated the effect of decreasing the resolution of the
Hartley spectra on the matching efficiency of the texture classifier. It was shown that
Multiresolution analysis still maintains the high accuracy achieved with the full
resolution analysis while achieving a considerable reduction in the memory occupied
by the lookup tables. In particular, a one-step resolution decrease saves memory
space by 40% and with a minor sacrifice of less than 1% in the matching efficiency.
47
Chapter 7
Conclusion and Future Work
48
Chapter 7
Conclusion and Future Work
7.1 Summary and Conclusion
The work presented in this thesis deals with the application of spectral
methods for texture classification. The aim of the present work was to introduce a
hybrid methodology for texture classification based on a spatial domain global preclassifier together with a spectral classifier that utilizes multiresolution transform
analysis. The reason for developing a spatial pre-classifier is that many
discriminating features of textures are present in the spatial domain of the texture. Of
these, global features such as intensity histograms and entropies can still add
significant information to the texture classification process. The pre-classifier uses
texture intensity histograms to derive histogram moments that serve as global
features.
A spectral classifier that uses Hartley transform follows the pre-classifier.
Although transform based texture analysis techniques such as the Fast Fourier
Transform and the Wavelet Transform are widely used, the high cost associated with
the Wavelet Transform suggests that spectral approaches to texture classification
may still favor FFT-based transform analysis. In this respect, the Hartley Transform
suggests a better alternative to the broadly used Fast Fourier Transform. The choice
of such transform was due to the fact that the Fast Hartley Transform has many
advantages over the other transforms since it results in real valued arrays and
requires less memory space. In addition, the Fourier Transform power spectrum can
be computed from the Fast Hartley Transform and the computation requirements are
low. The forward and reverse transforms are identical (one algorithm) and the Fast
Fourier Transform is directly obtainable for the Hartley Transform by simple sums
and differences.
To build the classifier and test its performance, 900 texture images were
generated using mathematical texture generating functions. The images generated
were of three different types or classes (Fxy1, Fxy2 and Fxy3) and each class is sub-
49
classified into three sub-classes (LL, MM and HH). Each sub-class contains 100
images.
The pre-classifier was designed to identify texture classes. This pre-classifier
is based on statistical moments. Three modules were implemented to serve this
function. The first module scans all training images and generates 4 moment degrees
for each image intensity histogram. Data is gathered for each class saving the
average, minimum and maximum value for each moment degree. For each class,
data is saved in a separate table. The second module takes as an input any sample
image and compares its moment values to the saved tables using an Euclidean
distance classifier. Its output is the texture class; Fxy1, Fxy2 or Fxy3. The third
module examines all test images and generates an accuracy report; the classification
efficiency. The pre-classifier matching accuracy is found to be 99.89% for the 450 test
images.
The spectral classifier is designed on the basis of the Hartley transform to
determine the image sub-class. Initially, a full resolution Hartley transform was used
to obtain two orthogonal power spectral vectors. Peaks in these two vectors were
detected after applying a 10% threshold and the highest 4 peaks for each image are
selected and saved in a position matrix. Three modules were designed for this
purpose. The output of the first module is position matrices for each sub class. The
second module, takes as an input any sample image and its output is the image subclass LL, MM or HH. This module generates the position matrix of the sample image
and compares it to the saved tables by looking up the position matrix in the table
rows. The third module tests the matching of the sample textures. The matching
accuracy obtained using the two classification phases (pre-classifier and spectral
classifier) is 99.56%.
The accuracy achieved for the single resolution classifier is high but that was
achieved on the expense of space for the look-up tables. In order to investigate the
effect of lowering the resolution on the size of the information needed in for
matching the textures, we have applied a multiresolution technique to the Hartley
Transform in a restricted way by computing the Hartley spectra in decreasing
resolution. The characteristic spectra of each texture image were determined for three
different resolutions: full resolution and two successively lowered resolutions using
a 3x3 low pass Gaussian filter. For each resolution a position matrix is generated, so
for each sub class, three lookup tables are generated, one table for each resolution. It
50
was found that Multiresolution analysis still maintains the high accuracy achieved
with the full resolution analysis while achieving a considerable reduction in the
memory occupied by the lookup tables. In particular, a one-step resolution decrease
achieves 99% matching efficiency while saving memory space by 40%. This is a
minor sacrifice of less than 1% in the matching efficiency with a considerable
decrease in the complexity of the present methodology.
7.2 Future Work
My original inclination was to work on medical images, and learn about
transform analysis as well. This was hard to achieve since working on medical
images would occupy most of the time trying to understand medical texture specific
properties that need to be incorporated in the texture classifiers. So the first thing I
would like to do is apply this system to medical images.
I would also like to implement the He and Wang [6] proposed measurements on the
Multiresolution Hartley Transform. In this current system only row texture spectrum
is used. He and Wang extracted textural information in all eight directions and
proved better results on the natural images of the Brodatz album. The migration of
this technique to medical images has not yet been implemented, but I believe it might
give good results.
51
References
52
References
[1] A. S. Tolba et al., Adaptive Texture Classification with Hartley Transform and
Application to Visual Inspection, Microcomputer Applications, Vol. 18, No. 2,
1999
[2] B. Jules, Experiments in the Visual Perception of Texture, Science Amer., 3443, 1975
[3] B. Jules et al., A Theory of Textural Segmentation in Human and Machine
Vision, Academic Press, New York, 1983
[4] C.C. Chen and D.C. Chen, Filtering methods for texture discrimination,
Pattern Recognition Letters, vol. 20, 783-790, 1999
[5] C.C. Chen and D.C. Chen, Multi-resolutional Gabor filter in texture analysis,
Pattern Recognition Letters, vol. 17, 1069-1076, 1996
[6] D.C. He and L. Wang, Texture features based on texture spectrum, Pattern
Recognition, no. 5, 391-399, 1991
[7] D. Gabor, Theory of communication, Journal of Institute of Electrical
Engineers, vol. 93, 429-459, 1946
[8] D. Wackerly et al., Mathematical Statistics with Applications, Duxbury
Press, Boston, 1995
[9]
H.
Voorhees,
Finding
Texture
Boundaries
in
Images,
ftp://publications.ai.mit.edu/ai-publications/500-999/AITR-968.ps, 1987
[10] H. Raafat et al., Unsupervised Texture Classification using wavelet Packets,
Proceedings of the IASTED International Conference, Signal and Image
Processing, 817-820, 1998
[11] J-F Liu and J. Lee, An Efficient and Effective Texture Classification Approach
using a New Wavelet Theory, Proc Of ICPR’96, 820-824, 1996
[12] J. Beck, Textons, the Elements of Texture Perception, and Their Interactions,
Nature, 290: 91-97, 1981
[13] J. Beck and Bergen, J. R., Textons, the fundamental elements in preattentive
vision and perception of textures, The Bell System Technical Journal, 62:16191645, 1983
[14] M.E. Jernigan and F. D'astous, Entropy-based texture analysis in the spatial
frequency domain, IEEE Transactions on Pattern Analysis and Machine
Intelligence, vol. 6, no. 2, 237-243, 1984
53
[15] M. Mortenson, Computer Graphics Handbook, Industrial Press, New
York, 1990
[16] Michael Seul et al., Practical Algorithms for Image Analysis description,
examples and Code, Cambridge University Press, Cambridge, 1999
[17] Neill Campbell et al., Segmentation of Natural Images using Self-Organizing
Feature Maps, Proc. 7th British Machine Vision Conf., 223 - 229, 1997
[18] O. Pichler et al., A comparison of texture feature extraction using adaptive
Gabor filter, pyramidal and tree structured wavelet transforms, Pattern
Recognition, vol. 29, no. 5, 733-742, 1996
[19] P. Brodatz, Textures: A photographic album for artists and designers,
New York: Dover, 1965
[20] Phyllis R. Chang, Image Boundary Detection Via intensity, color and
texture segmentation, University of California, Berkeley, 1993
[21] R. M. Haralick, Statistical and structural approaches to texture, IEEE Proc.,
67, 610-21, 1979
[22] R. W. McCool and G. R. Martin, Texture Analysis and Synthesis, Research
Report CS-RR-136, Department of Computer Science, University of Warwick,
Coventry, 1989
[23] R. Wilson and M. Spann, Image Segmentation and Uncertainty, Res.
Studies Pr., Letchworth, Hertfordshire, UK, 1988
[24] Rafael C. Gonzalez and Richard E. Woods, Digital Image Processing,
Addison-Wesley, USA, 1993
[25] Ramesh Jain et al., Machine Vision, McGraw Hill, USA, 1992
[26] Robert Azencott et al., Texture Classification using Windowed Fourier Filters,
IEEE transactions on pattern analysis and machine intelligence, vol. 19 No. 2,
148-153, 1997
[27] T. Randen and J. H. Husoy, Filtering for texture classification: a comparative
study, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.
21, no. 4, 291-310, 1999
[28] Ronald N. Bracewell, The Fast Hartley Transform, Proceedings of the
IEEE, vol. 72, no. 8, 1010-1017, 1984
[29] Tao-I. Hsu et al., Texture Analysis using the Multiresolution Fourier
Transform, Proc. 8th Scandinavian Conference on Image Analysis, 823-830,
1993
54
[30] Tao-I. Hsu and R. Wilson, A Two component Model of Texture for Analysis
and Synthesis, Research Report CS-RR-308, Department of Computer Science,
University of Warwick, Coventry, UK, 1996)
[31] U. Franke, Selective Deconvolution: A New Approach to Extrapolation and
Spectral Analysis of Discrete Signals, Proc. ICASSP, 1300-1303, Dallas, 1987
[32] V. Murino et al., Noisy texture classification: a higher order statistics approach,
Pattern Recognition, vol. 34, no. 4, 383-393, 1998
[33] V. Ralph and Andrew G. Tescher, Very High Resolution and Quality
Imaging III, SPIE Proceedings Vol. 3308, 1998
[34] William H. Press et al., Numerical Recipes in C, the art of Scientific
computing, Cambridge University Press, UK, 1992
55
Appendix A
The Matlab Code
56
Appendix A
The Matlab Code
Figures 26 and 27 are block diagrams that illustrate how the M files are connected in
the matlab code. In Figure 26, the m. files are listed under the classifier name. In
Figure 27, the m. files are listed according to the function required, if testing images,
generating image information or detecting the class and sub-class of any sample
image.
Image
Generation
Fxy1.M
Fxy2.M
Fxy3.M
Thesis.M
Pre-Classifier
Classifier
Multiresolution
Preclassifier.M
Preclassifierfv.M
Preclassifierfvtest.M
Classifier.M
Classifierfv.M
Classifierfvtest.M
Multiresolution.M
Multiresolutionfv.M
Multiresolutionfvtest.M
Figure 26: Matlab Code Block Diagram a
57
Thesis.M
Analyzing
Sample Image
Preclassifierfv.M
Classifierfv.M
Multiresolutionfv.M
Generating
Texture
Information
Preclassifier.M
Classifier.M
Multiresolution.M
Testing
Accuracy
Results
Preclassifierfvtest.M
Classifierfvtest.M
Multiresolutionfvtest.M
Figure 27: Matlab Code Block Diagram b
58
a. Thesis.M
This section is the matlab code for the main module. The user selects any image
and the output is the image class and sub-class. Two sub-classes are printed on the
screen, the first sub-class uses the Hartley Transform and the second sub-class uses
the new approach Multiresolution Hartley Transform.
%------------------------------------------ THE FIG - DIALOG INTERFACE - FUNCTION ------------------------------------------function varargout = thesis(varargin)
% DEMO Application M-file for thesis.fig
% FIG = thesis launch thesis GUI.
% DEMO('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.0 13-May-2003 06:24:22
if nargin == 0 % LAUNCH GUI
fig = openfig(mfilename,'reuse');
set(fig,'Color',get(0,'defaultUicontrolBackgroundColor')); % Use system color scheme for figure:
handles = guihandles(fig); % Generate a structure of handles to pass to callbacks, and store it
guidata(fig, handles);
if nargout > 0
varargout{1} = fig;
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
catch
disp(lasterr);
end
end
cd('c:\mastersthesis');
save fig.dat; % save the data to be checked by the main module
%------------------------------------------------------- main() - the core thesis function ----------------------------------------------------function varargout = Open_Callback(h, eventdata, handles, varargin)
%--- OPEN SYNTHESIZED IMAGES --cd('c:\mastersthesis\samples');
[fname, pname]=uigetfile('*.*');
I=imread(fname);
imshow(I);
%--- MOMENTS DEGREES FROM 2 To 5 --[C,x]=imhist(I,256);
% Two Column Vectors: C=total pixel grey level value, x=index from 0-255
CT=C';
% Transpose the column to row
CTs=sum(CT);
% Sum the Total
CT=CT/CTs;
% Normalize to generate PDF
mom=[0 0 0 0];
for i=2:5
mom(i-1)=moment(CT,i);
% get the 4 degree moments from 2 to 5 of the test image
end
mom=mom./1.0e-003;
% those specific synthesized images are in scale 1.0e-003
pcfv = preclassifierfv(mom);
load('fig.dat','-mat');
set(handles.mom,'String',pcfv);
% pcfv will be fxy1 or fxy2 or fxy3. Hartley will then subclassify each
%--- HARTLEY --F=fft2(I);
H=real(F)-imag(F);
[n,m]=size(H);
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1);
p = abs(H(1:n/2,1:m/2)).^2 + eps;
[n,m] = size(p);
nyquist = 1/2;
only
% Get the size of the image
% Zero the first row and the first column
% take the first quarter only power it and add an eps to avoid zeros
% get the new size
% maximum probability = 1/2 because we are working on the first quarter
59
fx = (0:m-1)/m * nyquist;
fy = (0:n-1)/n * nyquist;
pmax = max(max(p));
g = flipud(p/pmax);
pm = sum(sum(p));
p = p/pm;
pu = sum(p);
pv = sum(p');
t1=(max(max(pu)))*0.1;
t2=(pu>t1);
pu=pu.*t2;
% create a normalized index from 0 to 1/2 in the x
% create a normalized index from 0 to 1/2 in the y
% get the maximum value in p
% flip the matrix and divide it by the maximum value to normalize the results
% get the total
% divide by it to produce a probability density function
% sum the rows
% sum the columns
% threshold --- zero all that is less than 10% of the maximum ---
U=pu;
PK=[];
PS=[];
% Temperary location for pu
% top peaks
% top peaks position
for y=1:4
[PK(y) ii] = max(U);
if fx(ii)>0.03
PS(y)=fx(ii);
else
PS(y)=9;
end
U(ii)=0;
U(ii+1)=0;
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end
% get the top 4 peaks
% maximum value in PK(y) and ii is the position
% the normalized position is in fx(ii) if <=0.03 in these images ignore
PS1=sort(PS);
cd('c:\mastersthesis');
save fxyc.dat;
s=classifierfv(U);
% sort in ascending value therefore the 9 will be the last value
% after recording zero the pixel to get the next maximum
% also to get true peaks zero the surrounding pixels
% save current variables to be useed by classifierfv function
% s will specify HH, MM or LL
cd('c:\mastersthesis');
load('fig.dat','-mat');
set(handles.Hartley,'String',s);
%--- Multiresolution HARTLEY --h = fspecial('gaussian');
I = filter2(h,I)/3;
F=fft2(I);
H=real(F)-imag(F);
[n,m]=size(H);
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1);
p = abs(H(1:n/2,1:m/2)).^2 + eps;
[n,m] = size(p);
nyquist = 1/2;
only
fx = (0:m-1)/m * nyquist;
fy = (0:n-1)/n * nyquist;
pmax = max(max(p));
g = flipud(p/pmax);
pm = sum(sum(p));
p = p/pm;
pu = sum(p);
pv = sum(p');
t1=(max(max(pu)))*0.1;
t2=(pu>t1);
pu=pu.*t2;
% Get the size of the image
% Zero the first row and the first column
% take the first quarter only power it and add an eps to avoid zeros
% get the new size
% maximum probability = 1/2 because we are working on the first quarter
% create a normalized index from 0 to 1/2 in the x
% create a normalized index from 0 to 1/2 in the y
% get the maximum value in p
% flip the matrix and divide it by the maximum value to normalize the results
% get the total
% divide by it to produce a probability density function
% sum the rows
% sum the columns
% threshold --- zero all that is less than 10% of the maximum ---
U=pu;
PK=[];
PS=[];
% Temperary location for pu
% top peaks
% top peaks position
for y=1:4
[PK(y) ii] = max(U);
if fx(ii)>0.03
PS(y)=fx(ii);
else
% get the top 4 peaks
% maximum value in PK(y) and ii is the position
% the normalized position is in fx(ii) if <=0.03 in these images ignore
60
PS(y)=9;
end
U(ii)=0;
U(ii+1)=0;
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end
PS1=sort(PS);
PS1(:,4)='';
cd('c:\mastersthesis');
save fxymr.dat;
s=multiresolutionfv(U);
% after recording zero the pixel to get the next maximum
% also to get true peaks zero the surrounding pixels
% sort in ascending value therefore the 9 will be the last value
% save current variables to be useed by classifierfv function
% s will specify HH, MM or LL
cd('c:\mastersthesis');
load('fig.dat','-mat');
set(handles.mr,'String',s);
clear;
%--------------------------------------------------- CLOSE DIALOG -----------------------------------------------------------------------------function varargout = exit_Callback(h, eventdata, handles, varargin)
clear;
delete(handles.figure1);
% -------------------------------------------------------------------------------------------------------------------------------------------------------function varargout = mom_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.mom.
% -------------------------------------------------------------------------------------------------------------------------------------------------------function varargout = Hartley_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.Hartley.
% -------------------------------------------------------------------------------------------------------------------------------------------------------function varargout = mr_Callback(h, eventdata, handles, varargin)
% Stub for Callback of the uicontrol handles.mr.
61
b. Preclassifier.M
This module generates the 4 moment values for all training images and saves
them on the hard disk to be checked later to determine the image class.
function pc = preclass()
% Generate the moment degree values for saved sample images
% the code is manually changed to fxy2 and fxy3 where every fxy1 is replaced by fxy2 and fxy3 alternatively
% also a1 and g1... are altered to a2 and g2...
cd('c:\mastersthesis\training');
index=1;
for i = 1:300
if i>0 & i<=100
S='fxy3L';
ii=i;
elseif i>100 & i<=200
S='fxy3M';
ii=i-100;
else
S='fxy3H';
ii=i-200;
end
S1=int2str(ii);
% read the ith image
S=strcat(S, S1);
% of the fx function
S=strcat(S,'.bmp');
% .bmp
I=imread(S);
% put it in variable I
[C,x]=imhist(I,256);
% get its histogram 256 grey scale image
CT=C';
% change its format from column to row
CTs=sum(CT);
% sum the total
CT=CT/CTs;
% Normalize to generate PDF
for ii=2:5
m(ii-1,i)=moment(CT,ii);
% get moments of degree 2,3,4 and 5 for each image. m is a 4x300 matrix
end
end
for i = 1:4
a3(i) = mean(m(i,:));
% for all images get the mean value for each moment
l3(i) = min(m(i,:));
% get the minimum value
g3(i) = max(m(i,:));
% get the maximum value to get a feeling of the percentage of error for each moment
end
a3=a3./1.0e-003
% for ease of calculations divide by 1.0e-003 that is common in all the test images
l3=l3./1.0e-003
g3=g3./1.0e-003
cd('c:\mastersthesis');
save fxy3.dat;
% save the data to be checked by the preclassifier feature vector
62
c. Preclassifierfv.M
This module determines the image class by comparing moment values using the
minimum distance classifier
function pcfv = preclassifierfv(mom)
% Determine which class the test image belongs to
cd('c:\mastersthesis');
load('fxy1.dat','-mat');
load('fxy2.dat','-mat');
load('fxy3.dat','-mat');
% --- minimum distance classifier
fxy1= sqrt (((mom(1)-a1(1)).^2) + ((mom(2)-a1(2)).^2) + ((mom(3)-a1(3)).^2) + ((mom(4)-a1(4)).^2));
fxy2= sqrt (((mom(1)-a2(1)).^2) + ((mom(2)-a2(2)).^2) + ((mom(3)-a2(3)).^2) + ((mom(4)-a2(4)).^2));
fxy3= sqrt (((mom(1)-a3(1)).^2) + ((mom(2)-a3(2)).^2) + ((mom(3)-a3(3)).^2) + ((mom(4)-a3(4)).^2));
fxy=[fxy1;fxy2;fxy3];
if min(fxy)==fxy1
s='fxy1';
elseif min(fxy)==fxy2
s='fxy2';
else
s='fxy3';
end
pcfv=s;
63
d. Preclassifierfvtest.M
This module examines all test images and generates the percentage of accuracy
function pcfvtest = preclassifierfvtest()
% test all images and generate percentage error
% the module is changed manually for fxy2 and fxy3
% this module generates:
% 100% accuracy for fxy1
% 99.66667% accuracy for fxy2
% 100% accuracy for fxy3
clear;
cd('c:\mastersthesis\test');
% Synthesized images
err=[];
load('fxy1.dat','-mat');
load('fxy2.dat','-mat');
load('fxy3.dat','-mat');
for index = 1:300
if index>0 & index<=100
S='fxy3L';
ii=index;
elseif index>100 & index<=200
S='fxy3M';
ii=index-100;
else
S='fxy3H';
ii=index-200;
end
S1=int2str(ii);
S=strcat(S, S1);
S=strcat(S,'.bmp');
I=imread(S);
% read the ith image
% of the fx function
% .bmp
[C,x]=imhist(I,256);
CT=C';
CTs=sum(CT);
CT=CT/CTs;
% get its histogram 256 grey scale image
% change its format from column to row
% sum the total
% Normalize to generate PDF
mom=[0 0 0 0];
for i=2:5
mom(i-1)=moment(CT,i);
end
mom=mom./1.0e-003;
% get moments of degree 2,3,4 and 5 for each image
% divide by 1.0e-003 that is common in all the test images
% --- minimum distance classifier --fxy1= sqrt (((mom(1)-a1(1)).^2) + ((mom(2)-a1(2)).^2) + ((mom(3)-a1(3)).^2) + ((mom(4)-a1(4)).^2));
fxy2= sqrt (((mom(1)-a2(1)).^2) + ((mom(2)-a2(2)).^2) + ((mom(3)-a2(3)).^2) + ((mom(4)-a2(4)).^2));
fxy3= sqrt (((mom(1)-a3(1)).^2) + ((mom(2)-a3(2)).^2) + ((mom(3)-a3(3)).^2) + ((mom(4)-a3(4)).^2));
fxy=[fxy1;fxy2;fxy3];
if min(fxy) ~= fxy3
err = [err, index];
end
end
err
64
e. Classifier.M
This module calculates the highest four peaks for each image in the frequency
Hartley Transform domain. These highest four peaks are saved for all images that
belong to the same class and sub-class so total 9 tables are saved.
function c = classifier()
% Generate the Hartley Classifier for all saved images
% manually run this module three times for fxy1, 2 and 3
cd('c:\mastersthesis\sample');
U=[];
% Temperary position for the image after transfered to Hartley
PK=[];
% Top peaks for each image
PS=[];
% Top positions of the top peaks for each image
pos=[];
% Top postiions of the top peaks for all images
for i=1:150
% --- Read the test images --if i>0 & i<=50
S='fxy1L';
ii=i;
elseif i>50 & i<=100
S='fxy1M';
ii=i-50;
else
S='fxy1H';
ii=i-100;
end
S1=int2str(ii);
% read the ith image
S=strcat(S, S1);
% of the fx function
S=strcat(S,'.bmp');
% .bmp
I=imread(S);
% put it in variable I
% --- Hartley Transfer --F=fft2(I);
% generate its fourier
H=real(F)-imag(F);
% generate its Hartley
% --- Normalization of the Hartley Transform Image --[n,m]=size(H);
% Get the size of the image
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1);
% Zero the first row and the first column
p = abs(H(1:n/2,1:m/2)).^2 + eps;
% take the first quarter only power it and add an eps to avoid zeros
[n,m] = size(p);
% get the new size
nyquist = 1/2;
% maximum probability = 1/2 because we are working on the first quarter
only
fx = (0:m-1)/m * nyquist;
% create a normalized index from 0 to 1/2 in the x
fy = (0:n-1)/n * nyquist;
% create a normalized index from 0 to 1/2 in the y
pmax = max(max(p));
% get the maximum value in p
g = flipud(p/pmax);
% flip the matrix and divide it by the maximum value to normalize the
results
pm = sum(sum(p));
% get the total
65
p = p/pm;
% divide by it to produce a probability density function
pu = sum(p);
% sum the rows
pv = sum(p');
% sum the columns
t1=(max(max(pu)))*0.1;
% threshold 10%
t2=(pu>t1);
% zero all that is less than 10% of the maximum
pu=pu.*t2;
% put the result in the original matrix
% --- Generate the highest four peaks and their postions --U=pu;
% put it in a temperary matrix U
pos=[pos;PS];
for y=1:4
% get the highest 4 peaks
[PK(y) ii] = max(U);
% maximum value in PK(y) and ii is the position
if fx(ii)>0.03
% the normalized position is in fx(ii) if <=0.03 in these images ignore
PS(y)=fx(ii);
else
PS(y)=9;
end
U(ii)=0;
% after recording zero the pixel to get the next maximum
U(ii+1)=0;
% also to get true peaks zero the surrounding pixels
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end % for y
PS=sort(PS);
% sort the positions to figure the most common values easier
if i == 100
% save separtely the values of the L, M and H
fxyLL=unique(pos,'rows');
pos=[];
PS=[];
elseif i== 200
fxyMM=unique(pos,'rows');
pos=[];
PS=[];
elseif i==300
fxyHH=unique(pos,'rows');
end
end % for i=1:150
cd('c:\mastersthesis');
save fxyc1.dat;
% save the data to be checked by the preclassifier feature vector
d='done1'
% this module takes time to execute so print done when it's done
66
f. Classifierfv.M
This module determines the sample image sub-class by generating its Hartley
Transform highest four peaks and check it against the lookup tables.
function cfv = classifierfv(U)
% specify if the given image is LL, MM or HH
cd('c:\mastersthesis');
load('fxyc.dat', '-mat');
U=[];
st=0;
if pcfv == 'fxy1'
load('fxyc1.dat','-mat');
elseif pcfv == 'fxy2'
load('fxyc2.dat','-mat');
else
load('fxyc3.dat','-mat');
end
t=size(fxyLL);
for i=1:t(1)
if fxyLL(i,:)==PS1
st='LL';
end
end %LL
if st==0
t=size(fxyMM);
for i=1:t(1)
if fxyMM(i,:)==PS1
st='MM';
end
end
end %MM
if st==0
t=size(fxyHH);
for i=1:t(1)
if fxyHH(i,:)==PS1
st='HH';
end
end
end %HH
cfv=st;
67
g. Classifierfvtest.M
This module examines all test images sub classes and generate their accuracy
report
function cfvtest = classifierfvtest()
% Investigate all test images and record their percentage
% manually changed for each fxy LL, MM, HH --- 9 times --% fxy1 LL ---> 100%
% fxy1 MM ---> 100%
% fxy1 HH ---> 100%
% fxy2 LL ---> 99% (index number 100)
% fxy2 MM ---> 99% (index number 100)
% fxy2 HH ---> 100%
% fxy3 LL ---> 99% (index number 100)
% fxy3 MM ---> 99% (index number 100)
% fxy3 HH ---> 100%
clear;
cd('c:\mastersthesis');
load('fxyc3.dat','-mat');
cd('c:\mastersthesis\test');
for index = 1:50
S=['fxy3H', int2str(index), '.bmp'];
I=imread(S);
%-------------------------------------------------------- H A R T L E Y ----------------------------------------------------------------------------F=fft2(I);
H=real(F)-imag(F);
%------------------------------------------- normalizing Hartley and Generating a PDF Hartley ----------------------------------------[n,m]=size(H);
% Get the size of the image
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1);
% Zero the first row and the first column
p = abs(H(1:n/2,1:m/2)).^2 + eps;
% take the first quarter only power it and add an eps to avoid zeros
[n,m] = size(p);
% get the new size
nyquist = 1/2;
% maximum probability = 1/2 because we are working on the first quarter
only
fx = (0:m-1)/m * nyquist;
% create a normalized index from 0 to 1/2 in the x
fy = (0:n-1)/n * nyquist;
% create a normalized index from 0 to 1/2 in the y
pmax = max(max(p));
% get the maximum value in p
g = flipud(p/pmax);
% flip the matrix and divide it by the maximum value to normalize the
results
pm = sum(sum(p));
% get the total
p = p/pm;
% divide by it to produce a probability density function
68
pu = sum(p);
% sum the rows
pv = sum(p');
% sum the columns
t1=(max(max(pu)))*0.1;
% threshold --- zero all that is less than 10% of the maximum ---
t2=(pu>t1);
pu=pu.*t2;
U=pu;
PK=[];
PS=[];
for y=1:4
% get the highest 4 peaks
[PK(y) ii] = max(U);
% maximum value in PK(y) and ii is the position
if fx(ii)>0.03
% the normalized position is in fx(ii) if <=0.03 in these images ignore
PS(y)=fx(ii);
else
PS(y)=9;
end
U(ii)=0;
% after recording zero the pixel to get the next maximum
U(ii+1)=0;
% also to get true peaks zero the surrounding pixels
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end % for y
PS=sort(PS);
U=[];
st=0;
t=size(fxyLL);
for i=1:t(1)
if fxyLL(i,:)==PS
st='LL';
end
end
% LL
if st==0
t=size(fxyMM);
for i=1:t(1)
if fxyMM(i,:)==PS
st='MM';
end
end
end
% MM
if st==0
t=size(fxyHH);
for i=1:t(1)
69
if fxyHH(i,:)==PS
st='HH';
end
end
end
% HH
if st~='HH'
index
st
pause;
end
end
st
clear;
70
h. mutliresoution.M
This module generates the lookup tables for all images based on applying a
3x3 low pass Gaussian filter only once.
function mr = multiresolution()
% Generate the Multiresolution Hartley Classifier for all saved images
% manually run this module three times for fxy1, 2 and 3
cd('c:\mastersthesis\samples');
U=[];
% Temperary position for the image after transfered to Hartley
PK=[];
% Top peaks for each image
PS=[];
% Top positions of the top peaks for each image
pos=[];
% Top postiions of the top peaks for all images
for i=1:150
% --- Read the test images --if i>0 & i<=50
S='fxy3L';
ii=i;
elseif i>50 & i<=100
S='fxy3M';
ii=i-50;
else
S='fxy3H';
ii=i-100;
end
S1=int2str(ii);
% read the ith image
S=strcat(S, S1);
% of the fx function
S=strcat(S,'.bmp');
% .bmp
I=imread(S);
% put it in variable I
%---- first resolution -------h = fspecial('gaussian');
I = filter2(h,I)/3;
% --- Hartley Transfer --F=fft2(I);
% generate its fourier
H=real(F)-imag(F);
% generate its Hartley
% --- Normalization of the Hartley Transform Image --[n,m]=size(H);
% Get the size of the image
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1);
% Zero the first row and the first column
p = abs(H(1:n/2,1:m/2)).^2 + eps;
% take the first quarter only power it and add an eps to avoid zeros
[n,m] = size(p);
% get the new size
nyquist = 1/2;
% maximum probability = 1/2 because we are working on the first quarter
only
fx = (0:m-1)/m * nyquist;
% create a normalized index from 0 to 1/2 in the x
fy = (0:n-1)/n * nyquist;
% create a normalized index from 0 to 1/2 in the y
pmax = max(max(p));
% get the maximum value in p
g = flipud(p/pmax);
% flip the matrix and divide it by the maximum value to normalize the results
71
pm = sum(sum(p));
% get the total
p = p/pm;
% divide by it to produce a probability density function
pu = sum(p);
% sum the rows
pv = sum(p');
% sum the columns
t1=(max(max(pu)))*0.1;
% threshold 10%
t2=(pu>t1);
% zero all that is less than 10% of the maximum
pu=pu.*t2;
% put the result in the original matrix
% --- Generate the highest four peaks and their postions --U=pu;
% put it in a temperary matrix U
pos=[pos;PS];
for y=1:4
% get the highest 4 peaks
[PK(y) ii] = max(U);
% maximum value in PK(y) and ii is the position
if fx(ii)>0.03
% the normalized position is in fx(ii) if <=0.03 in these images ignore
PS(y)=fx(ii);
else
PS(y)=9;
end
U(ii)=0;
% after recording zero the pixel to get the next maximum
U(ii+1)=0;
% also to get true peaks zero the surrounding pixels
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end % for y
PS=sort(PS);
% sort the positions to figure the most common values easier
PS(:,4)='';
% take the firs three peaks only the fourth peak is 9 for all images
if i == 100
% save separtely the values of the L, M and H
fxyLL=unique(pos,'rows');
pos=[];
PS=[];
elseif i== 200
fxyMM=unique(pos,'rows');
pos=[];
PS=[];
elseif i==300
fxyHH=unique(pos,'rows');
end
end % for i=1:300
cd('c:\mastersthesis');
save fxymr3.dat;
% save the data to be checked by the preclassifier feature vector
d='done3'
% this module takes time to execute so print done when it's done
72
i. mutliresoutionfv.M
This module determines the image sub-class using one level multiresolution
function mrfv = multiresolutionfv(U)
% specify if the given image is LL, MM or HH
cd('c:\mastersthesis\samples');
load('fxymr.dat', '-mat');
U=[];
st=0;
if pcfv == 'fxy1'
load('fxymr1.dat','-mat');
elseif pcfv == 'fxy2'
load('fxymr2.dat','-mat');
else
load('fxymr3.dat','-mat');
end
t=size(fxyLL);
for i=1:t(1)
if fxyLL(i,:)==PS1
st='LL';
end
end %LL
if st==0
t=size(fxyMM);
for i=1:t(1)
if fxyMM(i,:)==PS1
st='MM';
end
end
end %MM
if st==0
t=size(fxyHH);
for i=1:t(1)
if fxyHH(i,:)==PS1
st='HH';
end
end
end %HH
mrfv=st;
73
j. mutliresoutionfvtest.M
This module calculates the accuracy of using one level multiresolution
function mrfvtest = multiresolutionfvtest()
% Investigate all test images and record their percentage
% manually changed for each fxy LL, MM, HH --- 9 times --% fxy1 LL --->
100%
% fxy1 MM --->
99% (index number 100)
% fxy1 HH --->
100%
% fxy2 LL --->
99% (index number 100)
% fxy2 MM --->
95% (indeces number 29, 31, 32, 33, 100)
% fxy2 HH --->
100%
% fxy3 LL --->
99% (index number 100)
% fxy3 MM --->
99% (index number 100)
% fxy3 HH --->
100%
clear;
cd('c:\mastersthesis\test');
load('fxymr3.dat','-mat');
for index = 1:50
S=['fxy3H', int2str(index), '.bmp'];
I=imread(S);
%---------- first resolution -----------h = fspecial('gaussian');
I = filter2(h,I)/3;
%-------------------------------------------------------- H A R T L E Y -----------------------------------------------------------------------F=fft2(I);
H=real(F)-imag(F);
%------------------------------------------- normalizing Hartley and Generating a PDF Hartley -------------------------------------[n,m]=size(H);
% Get the size of the image
H(1,:) = zeros(1,m); H(:,1) = zeros(n,1); % Zero the first row and the first column
p = abs(H(1:n/2,1:m/2)).^2 + eps;
% take the first quarter only power it and add an eps to avoid zeros
[n,m] = size(p);
% get the new size
nyquist = 1/2;
% maximum probability = 1/2 because we are working on the first quarter
only
fx = (0:m-1)/m * nyquist;
% create a normalized index from 0 to 1/2 in the x
fy = (0:n-1)/n * nyquist;
% create a normalized index from 0 to 1/2 in the y
pmax = max(max(p));
% get the maximum value in p
g = flipud(p/pmax);
% flip the matrix and divide it by the maximum value to normalize the results
pm = sum(sum(p));
% get the total
p = p/pm;
% divide by it to produce a probability density function
74
pu = sum(p);
% sum the rows
pv = sum(p');
% sum the columns
t1=(max(max(pu)))*0.1;
% threshold --- zero all that is less than 10% of the maximum ---
t2=(pu>t1);
pu=pu.*t2;
U=pu;
PK=[];
PS=[];
for y=1:4
% get the highest 4 peaks
[PK(y) ii] = max(U);
% maximum value in PK(y) and ii is the position
if fx(ii)>0.03
% the normalized position is in fx(ii) if <=0.03 in these images ignore
PS(y)=fx(ii);
else
PS(y)=9;
end
U(ii)=0;
% after recording zero the pixel to get the next maximum
U(ii+1)=0;
% also to get true peaks zero the surrounding pixels
U(ii+2)=0;
if ii>1
U(ii-1)=0;
end
if ii>2
U(ii-2)=0;
end
end % for y
PS=sort(PS);
PS(:,4)='';
% use only the first three peaks, the fourth peak is always 9
U=[];
st=0;
t=size(fxyLL);
for i=1:t(1)
if fxyLL(i,:)==PS
st='LL';
end
end
% LL
if st==0
t=size(fxyMM);
for i=1:t(1)
if fxyMM(i,:)==PS
st='MM';
end
end
end
% MM
75
if st==0
t=size(fxyHH);
for i=1:t(1)
if fxyHH(i,:)==PS
st='HH';
end
end
end
% HH
if st~='HH'
index
st
pause;
end
end
st
clear;
76
k. Fxy1.M
This module generates the sample and test images Fxy1
function f = fxy1()
%FXY 2-D function of n rows and m columns values are normalized to {0,1}
cd('c:\mastersthesis\sampletest');
i = 1;
% concatenated to the name of the file when saved to the disk
x = 0:256-1;
% generate 256x256 synthesized image
y = 0:256-1;
t=0.045;
% LL
while t <= 0.055
% LL
%t=0.145
% MM
%while t <= 0.1549
% MM
%t=0.295;
% HH
%while t <= 0.29995
% HH
u=t;
v=t;
Fx = 1+sin(2*pi*u*x);
Fy = 1+sin(2*pi*v*y);
F = Fy'*Fx;
F = F/max(max(F));
imshow(F,256)
S=int2str(i);
S=['fxy1L', S];
% LL
%S=['fxy1M', S];
% MM
%S=['fxy1H', S];
% HH
saveas(gcf,S,'bmp');
t=t+0.0001;
% LL, MM
%t=t+0.00005;
% HH
i=i+1;
end
77
L. Fxy2.M
This module generates the sample images Fxy2
function f = fxy2()
%FXY 2-D function of n rows and m columns values are normalized to {0,1}
cd('c:\mastersthesis\sampletest');
i = 1;
% concatenated to the name of the file when saved to the disk
x = 0:256-1;
% generate 256x256 synthesized image
y = 0:256-1;
%t=0.045;
% LL
%while t <= 0.055
% LL
%t=0.155
% MM
%while t <= 0.1649
% MM
t=0.295;
% HH
while t <= 0.29995
% HH
u=t;
v=t;
Fx = 1+sin(2*pi*u*x).* sin(4*pi*u*x);
Fy = 1+sin(2*pi*v*y).* sin(4*pi*v*y);
F = Fy' * Fx;
F = F/max(max(F));
imshow(F,256)
S=int2str(i);
%S=['fxy2L', S];
% LL
%S=['fxy2M', S];
% MM
S=['fxy2H', S];
% HH
saveas(gcf,S,'bmp');
%t=t+0.0001;
% LL, MM
t=t+0.00005;
% HH
i=i+1;
end
78
M. Fxy3.M
This module generates the sample images Fxy3
function f = fxy3()
%FXY 2-D function of n rows and m columns values are normalized to {0,1}
cd('c:\mastersthesis\sampletest');
i = 1;
% concatenated to the name of the file when saved to the disk
x = 0:256-1;
% generate 256x256 synthesized image
y = 0:256-1;
%t=0.045;
% LL
%while t <= 0.055
% LL
%t=0.145
% MM
%while t <= 0.1549
% MM
t=0.295;
% HH
while t <= 0.297
% HH
u=t;
v=t;
Fx = 2.7+sin(2*pi*u*x).*cos(3*pi*u*x);
Fy = 2.7+sin(2*pi*v*y).*cos(3*pi*u*x);
F = Fy' * Fx;
F = F/max(max(F));
imshow(F,256);
S=int2str(i);
%S=['fxy3L', S];
% LL
%S=['fxy3M', S];
% MM
S=['fxy3H', S];
% HH
saveas(gcf,S,'bmp');
%t=t+0.0001;
% LL, MM
t=t+0.00002;
% HH
i=i+1;
end
79
Appendix B
Classifier Lookup Tables
80
Table 7: Positions of the 4 Highest Peaks in the Hartley Transformed Images Fxy1LL
PS1
0.0455
0.0455
0.0455
0.0455
0.0455
0.0485
0.0485
0.0485
0.0485
0.0485
0.0485
0.0485
0.0515
0.0515
0.0515
0.0515
0.0515
0.0545
0.0545
0.1061
PS2
0.0909
0.0909
0.0909
0.0939
0.1394
0.0939
0.0970
0.0970
0.1000
0.1485
0.1909
0.2939
0.1000
0.1030
0.1061
0.1061
0.1545
0.1061
0.1091
0.1606
PS3
0.1364
0.1848
9.0000
0.1879
0.1848
0.1424
0.1455
9.0000
0.2000
0.1970
0.3333
0.3424
0.2000
0.2030
0.1576
9.0000
0.2061
0.2152
0.2152
0.2121
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
Table 8: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy1MM
PS1
0.0485
0.1455
0.1455
0.1455
0.1455
0.1485
0.1485
0.1485
0.1485
0.1485
0.1515
0.1515
0.1515
0.1515
0.1515
0.1515
0.1545
0.1545
0.1545
0.1545
0.2939
PS2
0.1485
0.2909
0.2909
0.2939
0.4394
0.2939
0.2970
0.3000
0.4030
0.4091
0.2485
0.3030
0.3030
0.3061
0.3061
0.3970
0.2303
0.3061
0.3091
0.3818
0.4121
81
PS3
0.3000
0.4182
0.4394
0.4121
9.0000
0.4424
0.4061
0.4000
0.4485
0.4424
0.3970
0.3909
0.3970
0.3879
0.4576
0.4515
0.3848
0.4606
0.4606
0.4636
0.4424
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
Table 9: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy1HH
PS1
0.0727
0.0939
0.1030
0.1091
0.1121
0.1818
0.1879
0.1939
0.1970
0.2000
0.2273
PS2
0.1848
0.1970
0.3000
0.1879
0.2970
0.2970
0.2970
0.2970
0.3000
0.3000
0.2970
PS3
0.2970
0.3000
0.4030
0.2970
0.4091
0.4091
0.4061
0.4030
0.4000
0.4000
0.4091
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
Table 10: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2LL
PS1
0.0455
0.0455
0.0455
0.0455
0.0455
0.0485
0.0485
0.0485
0.0485
0.0515
0.0515
0.0545
0.0545
0.0545
0.0545
0.1394
0.1424
0.1424
0.1424
0.1424
0.1455
0.1455
0.1485
0.1515
0.1515
0.1515
0.1545
0.1545
0.1545
0.1545
0.1576
PS2
0.1364
0.1364
0.1394
0.2758
0.3212
0.1455
0.1485
0.1970
0.3485
0.1515
0.1545
0.1606
0.1636
0.2152
0.3758
0.1879
0.1909
0.2848
0.3303
0.3333
0.1939
0.2879
0.3000
0.2030
0.3000
0.3515
0.2061
0.3061
0.3606
0.3636
0.2091
82
PS3
0.1818
0.3182
0.3273
0.3212
0.4606
0.3424
0.1970
0.3424
0.4970
0.2030
0.3606
0.4606
0.3818
0.3788
0.4636
0.3273
0.3364
0.3333
0.4727
0.4758
0.3394
0.3364
0.3485
0.3545
0.3515
0.4970
0.3606
0.3576
0.4848
0.4818
0.3667
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
0.1576
0.1576
0.1606
0.1636
0.1636
0.1939
0.2030
0.2091
0.3000
0.3061
0.3303
0.3152
0.3697
0.2121
0.2182
0.3788
0.3364
0.3576
0.3636
0.3485
0.3576
0.3424
0.4758
0.4727
0.4697
0.3818
0.4576
0.4818
0.4909
0.4788
0.4970
0.4909
0.4697
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
Table 11: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2MM
PS1
0.0303
0.0424
0.0455
0.0636
0.0667
0.0697
0.0879
0.0909
0.0939
0.0970
0.1000
0.1030
0.1061
0.1091
0.1121
0.1152
0.1182
0.1212
0.1242
0.1273
0.1303
0.1333
0.1364
0.1394
0.1424
0.1455
0.1485
0.1515
0.1545
0.1576
0.1606
0.1636
0.3424
0.3515
0.3576
PS2
0.0939
0.1152
0.1121
0.3758
0.0879
0.0848
0.1545
0.4424
0.4364
0.3545
0.4273
0.4242
0.1576
0.1576
0.1576
0.4091
0.4030
0.1606
0.3576
0.3879
0.3848
0.3515
0.1636
0.1636
0.1636
0.1636
0.1636
0.3424
0.3515
0.3667
0.3606
0.3455
0.3515
0.3788
0.3909
83
PS3
0.4697
0.1606
0.1576
0.4394
0.1545
0.1545
0.4667
0.4667
0.4697
0.4848
0.4727
0.4727
0.4212
0.4758
0.4758
0.4788
0.4788
0.3970
0.4818
0.4848
0.4848
0.3818
0.4879
0.4879
9.0000
0.4909
0.4909
0.4939
0.4939
0.4758
0.3970
0.4909
0.4939
0.4879
0.4818
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
0.3667
0.3727
0.3758
0.3758
0.4212
0.4303
0.4364
0.4394
0.4727
0.4697
0.4697
0.4697
9.0000
9.0000
9.0000
9.0000
Table 12: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy2HH
PS1
0.0303
0.0333
0.0364
0.0394
0.0424
0.0455
0.0485
0.0667
0.0697
0.0727
0.0758
0.0788
0.0818
0.0818
0.0848
0.0879
0.0909
0.0939
0.0970
0.1000
0.1030
0.1061
0.1091
0.1121
0.1152
0.1818
PS2
0.0788
0.0758
0.0758
0.1121
0.1121
0.0667
0.0667
0.1818
0.1121
0.1121
0.1091
0.1091
0.1091
0.1091
0.1061
0.1061
0.1030
0.1030
0.1970
0.2000
0.1970
0.1727
0.1879
0.1848
0.1818
0.2273
PS3
0.1091
0.2970
0.1121
0.2970
0.2970
0.1152
0.1152
0.2273
0.1818
0.2970
0.2970
0.1879
0.1909
9.0000
0.1909
9.0000
0.1939
0.1970
0.3000
0.3000
0.2061
9.0000
9.0000
0.2970
0.2939
0.2939
PS4
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
Table 13: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3LL
PS1
0.0818
0.0909
0.0939
0.0939
0.0939
0.0939
0.0970
0.0970
0.0970
PS2
0.1091
0.1121
0.1182
0.1394
0.1424
0.1636
0.1182
0.1212
0.1242
84
PS3
0.1636
0.1364
0.1394
0.1636
0.1636
0.2121
0.1667
0.2939
0.1485
PS4
0.1909
0.2030
9.0000
0.2788
0.2818
0.2818
9.0000
9.0000
9.0000
0.0970
0.1000
0.1000
0.1000
0.1000
0.1030
0.1030
0.1061
0.1061
0.1061
0.1061
0.1091
0.1091
0.1091
0.1152
0.1212
0.1242
0.1273
0.1545
0.1606
0.1788
0.1455
0.1242
0.1273
0.1485
0.1758
0.1273
0.1303
0.1303
0.1333
0.1576
0.1606
0.1333
0.1364
0.1879
0.1394
0.1424
0.1485
0.1515
0.1788
0.1879
0.3061
0.1697
0.1485
0.1515
0.1727
0.3000
0.1515
0.1545
0.1576
0.1576
0.1848
0.1879
0.1606
0.1636
0.3242
0.1606
0.2879
0.1727
0.3030
0.2303
0.3242
0.4333
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
0.1818
0.1818
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
9.0000
0.3061
9.0000
9.0000
Table 14: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3MM
PS1
0.0727
0.0727
0.0727
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0788
0.0788
0.1061
0.1152
0.1545
0.2303
PS2
0.1091
0.2939
0.3091
0.0848
0.0879
0.0909
0.0939
0.1000
0.1030
0.2273
0.2303
0.3000
0.3030
0.3061
0.3091
0.3303
0.3758
0.3818
0.3848
0.1545
0.3091
0.2970
0.2939
0.2303
0.3061
85
PS3
0.2970
0.3667
0.3848
0.3061
0.3030
0.4545
0.3030
0.3000
0.3727
0.3030
0.3091
0.3727
0.3212
0.3818
0.3848
0.4455
0.4515
0.4576
0.4606
0.3848
0.3879
0.3727
0.4424
0.3848
0.3848
PS4
0.4455
0.4394
0.4636
0.4667
0.3788
0.4697
0.3788
0.4758
0.4485
0.3788
0.3848
0.4485
0.4515
0.4576
0.4636
0.4788
0.4727
0.4667
9.0000
0.4606
0.4636
0.4788
0.4848
0.4606
0.4606
0.2909
0.2970
0.2970
0.3000
0.3061
0.3636
0.3697
0.3727
0.3758
0.3818
0.4364
0.4455
0.4455
0.4485
0.4576
0.4909
0.4818
0.4788
0.4758
0.4667
Table 15: Positions of the 4 Highest Peaks in the Hartley Transformed Images
Fxy3HH
PS1
0.0333
0.0333
0.0364
0.0364
0.0394
0.1091
0.1121
0.1485
PS2
0.1152
0.1485
0.1121
0.1485
0.1485
0.1485
0.1485
0.2242
86
PS3
0.1485
0.2606
0.1485
0.2212
0.2576
0.2576
0.2606
0.2606
PS4
0.4091
0.4091
0.2606
0.4455
0.4061
0.4061
0.4091
0.4091
Appendix C
Multiresolution Hartley Transform
Lookup Tables
87
Table 16: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy1LL
PS1
PS2
PS3
0.0455
0.0455
0.0485
0.0485
0.0909
9.0000
0.0939
0.1000
0.1364
9.0000
0.1424
0.1485
0.0485
0.0485
0.0515
0.0515
0.0515
0.0545
0.1970
9.0000
0.1000
0.1515
9.0000
0.1061
0.2455
9.0000
0.1515
0.2030
9.0000
0.1606
0.1061
0.1606
0.2121
Table 17: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy1MM
PS1
0.0303
0.0424
0.0515
0.0576
0.0606
0.0667
0.0727
0.0788
0.0818
0.0970
0.1455
0.1545
PS2
0.1485
0.1485
0.1515
0.1515
0.1515
0.1515
0.1545
0.1545
0.1545
0.1515
0.2667
0.2273
PS3
0.2939
0.2970
0.3000
0.3030
0.3030
9.0000
0.3061
0.3091
0.3091
0.2485
9.0000
0.3818
Table 18: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy1HH
PS1
0.0667
0.0727
0.0818
0.0909
0.1000
0.1121
0.1818
0.2000
PS2
0.1152
0.1848
0.1091
0.1030
0.2000
0.2970
0.2273
0.3000
88
PS3
0.2939
0.2970
0.2970
0.3000
0.4000
0.4091
0.2939
0.4000
Table 19: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy2LL
PS1
0.0455
0.0455
0.0455
0.0485
0.0485
0.0485
0.0485
0.0515
0.0515
0.0515
0.0515
0.0545
0.0545
0.1424
0.1424
0.1455
0.1545
0.1545
0.1879
0.3061
PS2
0.1364
0.1394
0.1424
0.1424
0.1455
0.1485
0.1515
0.1061
0.1515
0.1545
0.1576
0.1606
0.1636
0.1879
0.1909
0.2879
0.2061
0.3636
0.2818
0.3576
PS3
0.1818
0.1848
0.1879
0.1909
9.0000
0.1970
0.2000
0.1576
0.2030
0.2030
0.2091
0.2121
0.2182
0.3303
0.3333
0.3364
0.3606
9.0000
0.3303
0.4909
Table 20: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy2MM
PS1
0.0303
0.0424
0.0485
0.0515
0.0576
0.0606
0.0636
0.0667
0.0909
0.1000
0.1182
0.1242
0.1303
0.1364
0.1424
0.1485
0.1515
0.1606
0.3424
PS2
0.0939
0.1152
0.1091
0.1030
0.1000
0.0939
0.0909
0.0879
0.1545
0.4727
0.1606
0.1606
0.3545
0.1636
0.1636
0.1636
0.1636
0.4788
0.3515
PS3
0.1576
0.1606
0.1576
0.1576
0.4697
0.1576
0.1545
0.1545
0.4667
9.0000
0.4788
9.0000
0.4848
0.4879
9.0000
9.0000
0.3424
9.0000
0.4939
89
Table 21: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy2HH
PS1
0.0303
0.0364
0.0424
0.0485
0.0515
0.0667
0.0727
0.0818
0.0879
0.0909
0.0939
0.0970
0.1000
0.1091
PS2
0.0788
0.0758
0.0697
0.0636
0.0636
0.1152
0.1121
0.1091
0.1061
0.1030
0.1030
0.1970
0.2000
0.1879
PS3
0.1091
0.1121
0.1121
0.1152
0.1152
0.2273
0.1485
9.0000
9.0000
9.0000
0.1970
0.3000
0.3000
9.0000
Table 22: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy3LL
PS1
0.0758
0.0909
0.0939
0.0970
0.0970
0.1000
0.1030
0.1033
0.1061
0.1091
0.1091
0.1152
0.1242
0.1545
0.1788
PS2
0.1000
0.1121
0.1636
0.1182
0.1455
0.1242
0.1273
0.1303
0.1303
0.1333
0.1606
0.1394
0.1485
0.1788
0.3061
PS3
9.0000
0.1364
9.0000
0.1667
0.1697
0.1485
0.1545
9.0000
0.1576
0.1606
9.0000
9.0000
0.1727
0.3061
9.0000
Table 23: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy3MM
PS1
0.0727
0.0727
0.0727
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
0.0758
PS2
0.1091
0.1273
0.2970
0.0848
0.1000
0.1030
0.1545
0.2242
0.3030
0.3848
90
PS3
0.2970
0.2909
0.3697
0.1606
0.3000
0.3000
0.2303
0.3000
0.4576
0.4606
0.0788
0.0818
0.1061
0.1545
0.2909
0.3061
0.1485
0.3061
0.2970
0.2303
0.3636
0.3818
0.3091
0.3818
0.3727
0.3061
0.4364
0.4636
Table 24: Positions of the Highest 3 Peaks in Multiresolution HT Images Fxy3HH
PS1
0.0333
0.0333
0.0364
0.0394
0.0394
0.1121
PS2
0.1152
0.1485
0.1121
0.1091
0.1485
0.1485
91
PS3
0.1485
0.2606
0.1485
0.1485
0.2212
0.2606