Shape Recognition by Curvature Changing Points and Fourier Transform
Transcript of Shape Recognition by Curvature Changing Points and Fourier Transform
Western Michigan UniversityScholarWorks at WMU
Master's Theses Graduate College
12-1987
Shape Recognition by Curvature Changing Pointsand Fourier TransformJianzhong LiWestern Michigan University
Follow this and additional works at: https://scholarworks.wmich.edu/masters_theses
Part of the Computer Sciences Commons
This Masters Thesis-Open Access is brought to you for free and open accessby the Graduate College at ScholarWorks at WMU. It has been accepted forinclusion in Master's Theses by an authorized administrator ofScholarWorks at WMU. For more information, please [email protected].
Recommended CitationLi, Jianzhong, "Shape Recognition by Curvature Changing Points and Fourier Transform" (1987). Master's Theses. 1257.https://scholarworks.wmich.edu/masters_theses/1257
SHAPE RECOGNITION BY CURVATURE CHANGING POINTSAND FOURIER TRANSFORM
byJianzhong Li
A Thesis Submitted to the
Faculty of The Graduate college in partial fulfillment of the
requirements for the Degree of Master of Science
Department of Computer Science
Western Michigan University Kalamazoo, Michigan
December 1987
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
SHAPE RECOGNITION BY CURVATURE CHANGING POINTSAND FOURIER TRANSFORM
Jianzhong Li, M.S.Western Michigan University, 1987
Computer vision is a relatively new and fast-growing field. Shape representation and recognition is a very important but difficult branch in this field.
One method of using curvature changing points and Fourier transform to recognize the shape is described in this thesis. Also an important feature in computer vision, multiscaling, is achieved by this method.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
ACKNOWLEDGMENTS
I would like to express my profuse gratitude to my advisor, Dr. Kountanis. His patience, guidance, and encouragement will never be forgotten. My appreciation is also extended to Dr. Natour and Dr. Pinkoski for their time and consideration.
I would also like to mention my thanks to my friends and my brother for their indispensable help and support: James Lee, Tom Sprague and Wang Tao. And finally, my special thanks go to my parents. Without their support and encouragement I would have never survived the ordeal.
Jianzhong Li
ii
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
INFORMATION TO USERS
This reproduction was made from a copy of a document sent to us for microfilming. While the most advanced technology has been used to photograph and reproduce this document, the quality of the reproduction is heavily dependent upon the quality of the material submitted.
The following explanation o f techniques is provided to help clarify markings or notations which may appear on this reproduction.
1. The sign or “ target” for pages apparently lacking from the document photographed is “Missing Page(s)”. If it was possible to obtain the missing page(s) or section, they are spliced into the film along with adjacent pages. This may have necessitated cutting through an image and duplicating adjacent pages to assure complete continuity.
2. When an image on the film is obliterated with a round black mark, it is an indication of either blurred copy because of movement during exposure, duplicate copy, or copyrighted materials that should not have been filmed. For blurred pages, a good image of the page can be found in the adjacent frame. If copyrighted materials were deleted, a target note will appear listing the pages in the adjacent frame.
3. When a map, drawing or chart, etc., is part of the material being photographed, a definite method of “sectioning” the material has been followed. It is customary to begin filming at the upper left hand comer o f a large sheet and to continue from left to right in equal sections with small overlaps. If necessary, sectioning is continued again—beginning below the first row and continuing on until complete.
4. For illustrations that cannot be satisfactorily reproduced by xerographic means, photographic prints can be purchased at additional cost and inserted into your xerographic copy. These prints are available upon request from the Dissertations Customer Services Department.
5. Some pages in any document may have indistinct print. In all cases the best available copy has been filmed.
UniversityMicixxilms
International300 N. Zeeb Road Ann Arbor, Ml 48106
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Order Number 1332872
Shape recognition by curvature changing points and Fourier transform
Li, Jianzhong, M.S.Western Michigan University, 1987
U MI300 N. Zeeb Rd.Ann Arbor, MI 48106
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
PLEASE NOTE:
In all cases this material has been filmed in the best possible way from the available copy. Problems encountered with this document have been Identified here with a check mark •/ .
1. Glossy photographs or pages_____
2. Colored illustrations, paper or print______
3. Photographs with dark background_____
4. Illustrations are poor copy_______
5. Pages with black marks, not original copy
6. Print shows through as there is text on both sides of page_______
7. Indistinct, broken or small print on several pages. ✓
8. Print exceeds margin requirements______
9. Tightly bound copy with print lost in spine_______
10. Computer printout pages with indistinct print_______
11. Page(s)___________ lacking when material received, and not available from school orauthor.
12. Page(s)____________seem to be missing in numbering only as text follows.
13. Two pages numbered S3 ■ Text follows.
14. Curling and wrinkled pages______
15. Dissertation contains pages with print at a slant, filmed as received_____
16. Other______________________________________________________________________
UMIReproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
TABLE OF CONTENTS
ACKNOWLEDGEMENTS ................................. iiLIST OF FIGURES ........................................... VCHAPTER
I. INTRODUCTION ....................................... 1II. REVIEW OF RELEVANT LITERATURE ..................... 4
Computer Vision and Shape Representation ..... 4Traditional Theories of Shape Recognition .... 7
Template Matching ........................... 7Feature Model ............................... 8Structural Description Model .............. 10Fourier Model .............................. 11
III. CURVATURE CHANGING POINT AND ITS TRANSFORMATION.. 14Input Function of Curvature Changing Point ... 17Multiscaling and Gaussian Function ........... 21
Convolution for Corner Point .............. 23Convolution for Smooth Point .............. 28
Fourier Transform and Gaussian Filter ........ 31The Transfer-Function Concept ............. 32Fourier Transform of the Convolution ..... 33
IV. FFT IMPLEMENTATION OF CONVOLUTION FUNCTION ...... 36Z-Transform and Periodic Property ............ 36FFT Algorithm and Time Complexity............ 40
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Table of Contents— Continued
CHAPTERV. EXAMPLES ................................... 44
VI. CONCLUSIONS AND RECOMMENDATIONS ................. 50APPENDICES...... ...................................... 52
A. PROGRAM I: Image Creation........................ 53B. PROGRAM II: Image Representation and Recognition 62
BIBLIOGRAPHY ............................................. 84
iv
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
LIST OF FIGURES
1. The Shape Containing Two Different Kinds ofCurvature Changing Points ......................... 17
2. The Corner Point and Its Input Function ..... 183. The Smooth Point and Its Input Function .......... 204. The Corner Point and Its Fourier Transform ...... 255. The Smooth Point and Its Fourier Transform ...... 306. Block Diagram of a Transform Function ............ 337. Two Trees Having the Same Shape ................... 458. Two Different Triangles With Reconstructed Image . 479. The Reconstructed Images Under Different Scale ... 48
v
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER I
INTRODUCTION
One of the most important things to be determined from an image is the shape of the objects in it. Shape is an intrinsic property of the vision from which many other factors can be derived.
Shape recognition is doubtless one of the most important abilities of the mammalian vision system. Usually the shapes of the different objects are recognized through the outlines of their surfaces. Therefore, different outlines of the surfaces can represent different shapes of objects.
For example, let us draw the shape of human eyes and a mouth with a black pen on a piece of white paper. It is clear that these two objects, eyes and mouth, have different shapes. Their differences can be easily determined by their different lengths, different curvatures and orientation along the contour. Therefore, intuitively, we could use these parameters to describe the shape of the objects and, indeed, this is the main topic of this paper: to recognize and to reconstruct the image of different
1
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
objects by their curvature and orientation changes.Chapter II deals with reviewing the relevant litera
ture. Generally, there are four mathematical models used to recognize the shape of objects. These models are template matching model, feature model, structure description model and Fourier model. The pros and cons of each model have been discussed briefly. It is concluded from these discussions that using both curvature changing points and Fourier transform technique is an ideal method to recognize the shape of objects, which can take full advantage of both feature model and Fourier model.
Theoretically, the relationship between the curvature changing point and its Fourier transform has been explained in detail in Chapter III. The results show that not only can the shape of the objects be reconstructed and recognized by the Fourier transform but also another important feature— multiscaling— can be achieved during this recognition process. This feature is consistent with the human recognition process and is a very important feature in the computer vision.
Chapter IV describes the concrete process to achieve the principle in Chapter III. The Z-transform and FFT algorithm have been used to obtain the feature points of the image. Also, the time complexity needed for the above method has been discussed.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Finally, in Chapter V, several examples are presented to show the results and the advantage and disadvantage of the proposed method.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER II
REVIEW OF RELEVANT LITERATURE
People have dreamed of intelligent machines for a very long time. Its origin may be traced back to antiquity. However, the first substantial contribution in the context of digital computers was made by Turing in 1950 (Ballard and Brown, 1982). Since then, this field, called artificial intelligence, has been developing rapidly. The main goal for artificial intelligence was to endow computers with information-processing capabilities comparable to those of human organisms. From the outset, one of the important goals of artificial intelligence is to equip machines with the capability of dealing with sensory inputs. Computer vision is just such a field to achieve this goal.
Computer Vision and Shape Representation
Computer vision is a relatively new and fast growing field. The first experiment was conducted in the late 1950s, and many of the essential concepts, methods and theories have been developed during the last ten years.
4
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Now computer vision has a variety of applications in artificial intelligence, computer graphics and image processing and, therefore, has become a very important field in computer science.
Computer vision is the construction of explicit, retrievable and meaningful descriptions of physical objects from images. This description is quite different from image processing, which studies image-to-image transformation and has no explicit description building. Description is a prerequisite for recognizing, manipulating and thinking about objects.
When an object has been observed, the incoming visual data do not exhibit corresponding coherence or invariance; they contain much irrelevant or even misleading variation. Therefore, the major challenge for computer vision is to decide what intrinsic information can be extracted from the image. Among this information, one of the most important things to be determined from an image is the SHAPE of the objects in it.
There are several factors which hamper the effort to represent the shape of an object. First, shapes are often complex. Whereas motion or intensity is relatively simply quantified by a few well understood parameters, shape is much more subtle. Common natural shapes are too complex to be described by parameters. Worse, it is not
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
clear what aspects of shapes are important for applications such as recognition. Further, an explicit and complete representation may be computationally intractable for such basic uses as matching. Secondly, there is a lack of means to describe the shape. Why is shape recognition so easy for human beings and description so hard? The fact that we have no precise language for shape may argue for the inaccessibility of our shape- processing algorithms or data structures. This lack of cognitive leverage is a trifle daunting, especially when taken with the complexity of everyday shapes. Last, the discipline is young. Mathematics traditionally has not concerned itself with shape. Until very recently, people communicated about complex shapes mainly through words, gestures, and two-dimensional drawings. It was not until the advent of the digital computer that it became of interest to represent complex shapes so that they could be specified to machine, manipulated, computed with, and represented as output graphics. Also, no generally accepted single representation scheme is available for all shapes. Each scheme has its own advantages and disadvantages. Algorithms for manipulating shapes are surprisingly complex, and are research topics. Often the representations good for one application, such as recognition, are not good for other computations.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
7
Traditional Theories of Shape Recognition
Traditionally, there are three mathematical models for the shape recognition— templates, feature and structural descriptions (Lindsay and Norman 1977). In the 1980s, Fourier analysis was introduced to the vision cognition. This formed the fourth mathematical model (Cornsweet 1980). In this section, a brief review will be given to each model and also the pros and cons of each model will be discussed.
Template Matching
This is the simplest and the most straightforward class of model for shape recognition. In this model, there is a template in the memory. The input array would be simultaneously superimposed with all the templates in the memory. The one with the closest above-threshold match (e.g., the largest ratio of matching to nonmatching points in corresponding locations in the input array) would indicate the shape that is present. One of the standard measurement methods for the degree of matching is by using correlation coefficients. The higher the value of correlation coefficient, the more likely the object would be matched.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Theoretically, this method is the most simple one. But in order to match all the possible changes for a particular object, such as a change in distance, location, and orientation, it is necessary to have multiple templates corresponding to each of its possible transformation, rotation and combination in the memory. Or, the input image could be rotated, displaced and scaled to a canonical set of values before matching against the templates. In this case, however, it needs either a very large memory to store all these templates or to decide in advance which transformation should be applied. Unfortunately, neither is the memory large enough for the current computer nor anyone knows in advance which transformation should be used. Therefore, only in a very limited simple situation can this method be actually used.
Feature Model
This class of models is intuitively based on the early "Pandemonium" model of shape recognition (Selfridge and Neisser, 1960). In these models, there are no templates for the entire shapes; rather, there are "minitemplates" or "feature detectors" for simple geometric features such as lines, curves, curvature, angles, T-
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
junction, etc. There are detectors for every feature at every location in the input array. These detectors send out a graded signal which corresponds to the degree of match between the target feature and the part of the input array they are "looking at." The number of each occurrence of the feature is counted and recorded with its corresponding graded signal. In this feature model, the shape is represented by the feature and if the feature in the input array can be matched with that in the memory, they could be considered the same.
The advantage of this model is that the characterization of the feature is, in general, invariant to the location, translation, rotation, and even scale changes, since the feature belongs to the shape itself but not the location.
The disadvantage is that for a natural shape, sometimes it is very difficult to extract the feature correctly and efficiently. Consider how one would define the shape of a horse. Naturally, one could define a horse by choosing some special parts as features, such as "mane," "horse head," and so on, but then detecting these features would be no less difficult than detecting the horse itself. To improve this, sometime this model is combined with the third model, as we will discuss later, to get a more efficient algorithm.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Structural Description Model
A structure description is a data structure that can be thought of as a list of propositions whose arguments correspond to parts and whose predicates correspond to properties of the parts and to spatial relationships among them. Often these propositions are depicted as a graph whose edges link the nodes which correspond to the spacial relations. The explicit representation of spacial relations is one aspect of these models that distinguishes them from feature models and allows them to escape from some of the problems we pointed out before.
One of the chief advantages of this structure description is that it can factor apart the information in a scene without losing information in it. For a good recognition system, it is not sufficient simply to supply a list of labels for the objects that are recognized, for we need to know not only what things are but also how they are oriented and where they are with respect to us and each other. For example, when we are reaching for an object, we need to know how far we are from the object. Also, a good recognition process must have the ability to factor apart unnecessary information so that it can access the information relevant to a particular task without becoming overloaded, distracted, or misled by the irrelevant information.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Another advantage is that the structural description model can break up the recognized objects into smaller subparts, which are well-suited to simulate human being's visual system (Hoffman and Richards 1984).
Fourier Model
A new class of shape recognition methods, the Fourier model, was first proposed by Persoon and Fu (1974), and then improved by Ballard and Brown (1982). Many researchers adopted this model implicitly as the most likely candidate for shape recognition, since it is consistent with the human recognition process. In this model, the two-dimensional input array is subjected to a spatial trigonometric Fourier analysis. And in such an analysis, the array is decomposed into a set of components. For example, a Fourier transform of the intensity array would consist of two numbers for each of these components. The first number would specify the degree of contrast in the image corresponding to the frequency at that orientation (such as, the degree of difference in brightness between the bright areas and the dark areas of that image for that frequency in that orientation). The full set of these numbers is the amplitude spectrum corresponding to the image. The second number wouldspecify where in the image the peaks and troughs of the
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
intensity change defined by that component lies. The full set of these numbers is the phase spectrum corresponding to the image. The amplitude spectrum and the phase spectrum together define the Fourier transform of the image, and the transform contains all the information in the original image.
What is the advantage of the Fourier model? When there is an exact match between the image and one of the stored templates, there are neither advantages nor disadvantages to doing the match in the transform domain because no information is lost in the transformation. But, when there is not an exact match, the Fourier model does have an advantage. For example, to a first order approximation the amplitude spectrum corresponding to a shape is the same regardless of where the object is located. Therefore, a shape could be recognized across all its possible translations, such as rotation, transfer and even scaling. Another important advantage of the Fourier transform is that it segregates information about sharp edges and small details from information about gross overall shape. The latter is specified primarily by the lower frequency components of the transform, while the former, by the higher frequency components. Thus if the algorithm for recognition could selectively ignore the higher frequency of the amplitude spectrum when comparing input and template transforms, a shape could be
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
recognized even if its boundaries are blurred. This feature of recognition is consistent with the human recognition process and therefore is a significant feature for most recognition processes.
The method used in this paper to recognize the shape of objects is based on a combination of the Fourier model and feature model. More specifically, the curvature changing points are used as shape features of objects and the Gaussian function and its Fourier transform are employed to achieve the benefits of the Fourier model. These will be discussed in detail in the following chapters.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER III
CURVATURE CHANGING POINT AND ITS TRANSFORMATION
As mentioned in Chapter II, using some spatial feature points to represent and recognize the shape of objects is a classical idea. Many methods have been put forward to describe the shape of objects in the past 20 years. Chain Code (Freeman, 1974) is one of the earliest way to represent the shape of objects. Quad tree (Samet, 1980) is another effective method used to describe the spatial occupation, through which the shape of the object can be determined directly. In recent years, much emphasis has been put on the Fourier model by many researchers, since this model reveals precious information about the nature of the human recognition process. One of the key technique which has been used in the Fourier model is called multiscaling, which is based on the following idea. In the representation function of the shape of the object, there is parameter, called scale, which reflects the coarseness of the reconstructed object. Scale usually denoted by O- . The larger the o, the more the number of segments (or curves) needed to fit the outline of the object. Multiscaling investigates the variations of the
14
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
15number and location of the feature points which are required to identify and represent the object. Usually, the larger the o- , the more precise and sharper the shape of the object can be represented and recognized.
Curvature changing point is one of the feature points which not only preserves the necessary information about the shape of the original object but also fulfills the requirement of multiscaling technique. Therefore, this kind of feature point has received much emphasis in the area of computer vision and was recommended as one of the most important feature points (Pavlidis, 1986). In this Chapter, a detailed description of curvature changing points and their properties will be given and also their relationship with multiscaling will be discussed.
The basic idea of using curvature changing points to depict the shape of objects is similar to the idea of using chain code to describe the outline of the objects. In Chain Code theory, the outline of objects is approximated by a set of unit straight line segments (Ballard and Brown, 1982). These line segments must lie on a fixed grid with a fixed set of possible orientations. Since the grid is uniform, the direction is sufficient to characterize each segment. By successively being given a direction number to each segment, the shape of the object can be well represented by these numbers. Curvature is another kind of property to describe
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
16the shape of objects just like the direction number of Chain Code. Curvature at a point on the curve is the reciprocal of the radius of the curve at that point. So curvature will be changed along the contour as the shape of the object is changed. The smaller the curvature, the more smooth the curve. The point at which the curvature has been changed is called curvature changing point. By successively recording each curvature changing point along the contour of the object, a set of curvature changing points will be obtained. Clearly, different shapes have different sets of curvature changing points. Therefore, a particular set of curvature changing points can be used to represent the shape of the object. It is noted from its nature that curvature is an intrinsic property of that shape; it does not depend on the orientation and position of that object (Brady and Ponce, 1982). In other words, no matter how an object appears, whether in vertical or horizontal position, on the left corner or right corner, the set of curvature changing points will not change. This set of curvature changing points depend only on the geometric property of the shape itself. In this sense, the curvature changing point is a very nice feature point used to describe the shape of objects.
Generally, there are two different kinds of curvature changing points (Asada and Brady, 1986). The first kind of curvature changing points is the kind of points at
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
17which not only has the curvature been changed but also the orientation has been changed discontinuously. This kind of point is called a corner point. Corner points are shown by point A and point B in Figure 1.
C
Figure 1. The Shape of a Mouth Which Contains Two Different Kinds of Curvature Changing Points are Illustrated.
The second kind of curvature changing points is the type of point at which the curvature changes are discontinuous but the orientation is not changed. This kind of point is called a smooth joint point, and is shown by point C and point D in Figure 1. There are no sudden changes at this kind ofcurvature changing points and, therefore, these points look much more smooth than the corner points.
Input Function of Curvature Changing Point
As mentioned before, the set of curvature changing points can be used to describe the shape of objects, therefore, input functions are needed to represent these
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
18curvature changing points. These input functions should preserve all the information about the shape of objects and should be easy for further manipulation. The input function in orientation space is just such a candidate which well represents the relationship among orientation, curvature and the length of the outline of the object. Furthermore, in this space it is easy to achieve the multiscaling feature as we will see later. The input function in the orientation space is the relationship between orientation of the tangent to the curve to the arc length along the contour at the curvature changing point. An example of the input function in the orientation space describing the corner point is shown in Figure 2.
(b)(a)Figure 2. A Corner Point and its Input Function in the
Orientation Space. (a) A Corner Fragment Consisting of Two Circular Fragments of Curvature iti! and m2; Enclosing an Angular Discontinuity of k. (b) An Input Function Corresponding to the Corner Point on the Left.
where s-axis represents the arc length and 9 -axis represents
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
19the orientation of the tangent to the curve. The curvature changing point in Figure 2 is a typical corner point. The analytical form of this corner point can be defined by the following piece-wise function:
where m^ and m2 are curvatures of the curves and both are constants; b is the initial value of the orientation and is a constant also; k is the degree of angular discontinuity. The above piece-wise function obtained from Figure 2 (b) is under the following assumption: the curvature between the two curvature changing points is not changed. Note that this is only a local assumption and has no effect on the neighborhood points, even if these points are very close to each other. By using the above assumption for the input function, a series of important results can be revealed without using complicated mathematical manipulation, as we will see in the next section.
Similar analysis can be applied to the smooth joint point. An example of the input function in the orientation space describing the smooth joint point is shown in Figure 3.
if s < 0if s > 0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
T
20
(a)
mi
s(b)
Figure 3. A Smooth Point and its Input Function inOrientation Space. (a) A Smooth Joint Point, D, With the Different Curvature mi and m2 on each Side of Curvature Changing Point D. (b) The Corresponding Input Function at Point D.
where s-axis represents the arc length and 0-axis represents the orientation of the tangent to the curve.
Similarly, under the same assumption used for a corner point, the above input function can be defined by the following piece-wise function.
fc (s) =■ {mis + b m2S + bif s < 0 if s > o
where mi, m2 and b are the same as before, but notice that k has disappeared since there is no sudden changes in the orientation of tangent to the curve.
So far two input functions which describe the two different kinds of curvature changing points, i.e., corner
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
21point and smooth point, have been obtained. The next question is how to get the multiscaling feature and how to restore the original image of the object by these input functions. These will be achieved by Gaussian function and its Fourier transform which will be discussed in the following sections.
Multiscaling and Gaussian Function
As we mentioned in Chapter II, the Fourier transform is a spatial-to-frequency transformation. The sharper the outline of the shape of the object in the spatial domain, the more the high frequency components in the frequency domain. In other words, the sharp portion of, or the sudden change in the outline represents the high frequency in its corresponding Fourier transform, while the smooth portion, or the flat portion of the outline represents the low frequency in its corresponding Fourier transform. Therefore, if the high frequency components can be removed in the frequency domain and the remaining parts can be transformed back to the spatial domain by using inverse Fourier transform, the shape of the object will become more smooth than the original one. Intuitively, the more high frequency components are removed, a more smooth image of the original object will be obtained and, therefore, the so called coarse-to-fine representation
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
22of the object can be achieved just by removing more or less high frequency components in the frequency domain.
In the filter design theory (Andrews and Hunt, 1977), many filters are available to achieve the above function simply by changing the scope of band-limited filter, or by using different types of filters. In practical, not all the filters can be used for the image representation and recognition since after transform and inverse transform under different scaling many filters will alter the zero-crossing point; i.e., the position of curvature changing point in this paper. As pointed out by Marr and Hildreth (Brady 1982), "... a major difficulty with natural image is that changes can and do occur over a very wide range of scales, so it follows that one should seek a way of dealing with changes occurring at different scales." A way to do this, which is strongly advocated by many specialists on computer vision (Pinker 1985), is to use the Gaussian filter. They have shown that the Gaussian filter is essentially unique in having the property that location of the feature points is not changed as one moves from fine to coarse scale. Therefore the Gaussian filter is adopted for the shape representation process and will be given detailed discussion in this paper. In this section, some properties of convolution of the Gaussian function will be presented and the results will show that the standard deviation in the
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
T
23Gaussian function plays just the role of scaling in the multiscaling of image representation and recognition. The results show that the Fourier transform of function is just the Gaussian filter we discussed above.
Let's first look at the Gaussian function go. (s) and its convolution with the input function fc (s). Gaussian function is usually denoted by go-(s) = l/,/27C*c>»exp(-s2/2&-2). (Brady and Ponce, 1985). Note that the subscription O- has been specially marked out, since the standard deviation o» works as a very important parameter, scaling, in the multiscaling recognition process and its value will be frequently changed.. The convolution will be dealt with separately for the corner point and smooth point since their input functions are different.
Convolution for Corner Point
First consider the convolution of the corner point, where input function is denoted by
Calculating the convolution of g,>(s) and fc (s) , we find
if s < 0if s > 0
g©.(s)*fc (s) = Jgo.(t)* fc (s-t)« dt
= J (l//27C«o-).exp(-t2/2o-2).fc (s-t)*dt
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
24
8« J (l/yH'O-j.expf-tVzo2) • [m2(s-t)+b+k]»dt— DO
+ 00+ J (l//2TL'o-) «exp(-t2/2o2) • [mi(s-t)+b]*dt
ss 00
= (m2//27f*0-)*s -^expf-tVzo^'dt + (mi//27i*o-). s • J exp(-t2/2o-2)‘dt
6 00+ (m2//2K-o-) • f (-t) exp (-t2/2o?) • dt+ //vK'O-) • J (-t) exp(-t2/2o?) • dt -*00 8 00 B
+ (b//i*C>)-r exp (-t2/2o.2)• dt + (k//27L‘0) • f exp(-t2/2o?)* dt_ 00 -00
- (m2//2TF’0) • s • J exp(-t2/2o2) • dt + (jn-i/fzn-o) • s • J exp(-t2/2o2) • dt-OO 8
+ •[m2.exp(~t2/2d^) - m1*exp(-t2/2o2) ] + b
+ (k/'/STt'O*)*/ exp(-t2/2©2)»dt8X
Take the first derivative of go.(s)*fc (s) and multiply the result by J 2 K ’ that is
j2%'0-(go-(s)*fc (s)) •8 -00
= k* exp(-s2/2o*2)+m2 • f exp(-t2/2o-2) • dt+m^ • J exp(-t2/20>2)* dt (1)-oo sThen take the second derivative of (1),
75*. *.<*>(■) *fc (s))' ’= (-k/o2) • s*exp(-s2/2o-2) + (m2-m1)»exp(-s2/202 ) (2)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
25The first and the second derivatives of the above
convolution are shown in Figure 4 (b) and (c), respectively.
6 6
k
s s s
(a) (b) (c)
Figure 4. (a) The Input Function of the Orientation Space.(b) The First Derivative of the Convolution of the Gaussian Function With the Input Function.(c) The Second Derivative of the Convolution of the Gaussian Function With the Input Function.
For the first derivative of the above convolution, it has the shape of a typical Gaussian function which is offset from the line s = 0 by the scale o* . The height of the Gaussian curve will decrease dramatically with the small scale O.
If m^ = m2 = m, the first and the second derivatives of the formula (l) and (2) will be in a much simpler form. In this case, fc (s) is denoted as follows:
if s < 0m s + b + k if s > 0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
26By using the same procedure as above, we find
/ 3E»0(g0^(s)*fc (s))' = k*exp(-s2/2b2) + J2jt*0-m (3)
The formula (3) consists of two parts. The first part is k«exp(-s2/2fr2 ). The second part is Note that thesecond part contains no variable s, so it is just a constant for the fixed value m and 0-. The first part is the product of k and exp(-s2/2o2). Consider the integral of k»exp(-s2/2&.2), i.e.
SiIo(s) = ^k*exp(-t2/2o2 )» dt
0Clearly, the larger the value of O, the larger the value of this definite integral. Also note that the integral of formula (3) is the convolution of go-(s) and fc(s), which is just the inverse Fourier transform in the spatial domain. Therefore, the larger value of this function means the easier the corresponding corner point is detected. In this sense, the value of C- determines the detectability of the corresponding corner point. In other words, whether aparticular corner point can be detected depends on the value of scale o-. Therefore, a coarse-to-fine image representation and recognition process can be achieved by adequately choosing scale and the so called multiscaling technique has been achieved.
Taking the derivative for the (3) again, we obtain
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
27
go-(s) *fc (s)) '1 = (-k/o-2) • s*exp(-s2/2o*2) (4)
Note that in the formula (4), if s = 0, the function value equals zero, which means that the second derivative of convolution of Gaussian function and input function has a zero-crossing. This zero-crossing indicates where the original curvature changing point lies and also tells us that this point is a corner point since there exists no zero-crossing points for the smooth point. Besides that, the distance along the s-axis between the two peaks in the formula (4) is
dpp = 2 O'* (5)which is obtained by finding the local extreme in formula (4). dpp is exactly trice the value of standard deviation and therefore can be used to reflect the nature of scale 0-.
From the above discussion about the corner point, the following conclusions can be made.
1. The value of the first derivative of theconvolution of Gaussian function and input function isproportional to the k at point s = 0, which indicates thediscontinuous changes in the orientation at the corner point.
2. The second derivative of the convolution ofGaussian function and input function has a zero-crossing ats = 0, i.e. the location of curvature changing point.Therefore, this parameter can be used to distinguish thecorner point and smooth point.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
3. Most important of all is that the multiscaling feature can be achieved by using the scale ©■. This feature is a distinguished one in the Fourier model and is consistent with the human being's recognition process.
Convolution of Smooth Point
Now let's consider the case of smooth point, whose input function is denoted by
Similar to the case of corner point, by calculating the convolution of g»(s) and fc (s), we have
if s < 0if s > 0
= J (l//27t*o-)-exp(-t2/2o2) • [m2 (s-t)+b]*dt
+ j (l/72jC«o-)»exp(-t2/20'2)* [m^s-tj+b] dts
s r= (m2//2jc*o-)• s. J exp(-t2/2o2)» dt + s exp(-t2/202)s
+ 0‘/j2K [m2*exp(-s2/20.2) - m^-exp(-s2/2o>2) ] + b
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
29Take the first derivative of go»(s)*fc (s) and multiply the
result by that is27C*o-(g0.(s) *fc (s)) 1
= m2 exp(-t2/2*2)»dt + • Jf exp(-t2/2o^) • dt
oo sm l*J exp(-t2/2<>2) »dt + (m2-m1) • J exp(-t2/2»2)» dt m2>m1— oo
m2 • J exp(-t2/2<*2) • dt + (m1-m2) e x p ( - t 2/2*2)*dt m!>m2— oo S
( &rsnyO'fin. + (m2”ml)*J exp(~t2/2o2)*dt*-00
m2»0 ‘j 2X + (m1-m2) «J exp(-t2/2o>2) • dt
m2>lnl(6)
mi>m2
Then take the second derivative of (6), we have
//H*o*(go(s)*fc (s))'1 = (m2-m1)« exp(-s2/20‘2) (7)
The first and the second derivatives of the aboveconvolution are shown in Figure 5 (b) and (c), respectively.
The first derivative of the convolution of Gaussian function with input function shown in Figure 5 (b) has the form of a smooth step whose height is proportional to(m^—m2), or (m2-mi). And this difference is just the
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
30
ssC O(a)
Figure 5. (a) The Input Function of the Smooth Point in the Orientation Space.(b) The First Derivative of the Convolution of Gaussian Function With the Input Function.(c) The Second Derivative of the Convolution of Gaussian Function With the Input Function.
difference in curvature flanking the curvature changing point. If the difference in flanking curvatures is small enough, this step may not be perceived. In other words, the less the changes in curvature, the more difficult to perceive it. This property is consistent with the nature of human perception of the changes. The second derivative of the convolution is shown in Figure 5 (c). Instead of havingzero-crossing point, it has a single peak whose height is proportional to (m2-mi). Therefore, this information not only can be used to decide where the curvature changing point locates but also can tell corner points from smooth points.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
31As a summary of the smooth point, the following
conclusions can be made.1. The height of the step in the first derivative of
the above convolution is just the difference of curvature changes at the smooth point. The larger the difference in flanking curvatures, the easier the detection of this curvature changing point, which is consistent with human perception of changes.
2. There is no zero-crossing for the second derivative of the above convolution, but there is a peak at s = 0 which can be used to tell smooth points from corner points.
Fourier Transform and Gaussian Filter
In the last section, it has been shown that there exists many nice properties in the convolution go (s) *fc (s). Now the questions are: what is the physical meaning behind theconvolution of the Gaussian function with its input functions? How does the Gaussian function work in the frequency domain. These are the questions to be discussed in this section.
It is known in the previous chapter that the image signal can be represented in the frequency domain by Fourier transform, and it also can be transformed back to the spacial domain by the inverse Fourier transform. Physically, it is clear that if some high frequency components can be removed
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
32in the frequency domain, the image in the spatial domain will become more smooth than before. As we will see later, the Fourier transform of the Gaussian function under the convolution with its input function works just like the filter for removing the high frequency components. Before applying the Fourier transform directly to the Gaussian function, it is better to establish the concept of transfer function first.
The Transfer-Function Concept
Generally, for any system having input and output, transfer function of the system is the ratio of its output to its input (Ziemer and Tranter, 1983). For example, if a low-passing filter is being considered as a system, where R(w) denotes the input signal of the filter and C(w) denotes the output signal through this filter, then the transfer function, denoted by G(w), of this filter is G(w) = C(w)/R(w).
Transfer function reflects the intrinsic properties of that system. Usually, the transfer function can be represented by a block diagram as in Fig. 6, and each block has a one-to-one corresponding relation with the physical device such as the filter in the example. Now let's see what will happen if the Fourier transform is applied to the convolution of the Gaussian function and its input function.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
33
input,R(w) transfer function output, C(w)
Figure 6. Block Diagram of a Transfer Function.
Fourier Transform of the Convolution
By definition (Stearns, 1975), Fourier transform is denoted as
OO
F(w) = J f (t)»exp(-jwt)»dt-oo
where f(t) is any continuous or piece-wise continuous absolutely integral function in the time or spatial domain, w is the variable in the frequency domain.
By taking the Fourier transform to go-(t) *fc (t), we find
F(w) = J [go>(t) *fc (t) ] • exp(-jwt)* dt
T OO[ J g»(t-s)* fc (s)*ds]*exp(-jwt)« dt
>00 >09
By changing the order of integration, we findOO CD
F(w) = I [J go(t-s)» exp(-jwt)* dt]•fc (s)* ds> 0 0 > 0 0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
34By replacing t for t-s in the inner integral, then
CP ft)F(w) - J [ j go.(T)»exp(-jwT)*exp(-jws)«dT]*fc (s)»ds. OO — 09
•» ftO■ f [J go(T),exp(“j w )*dT]»fc(E)*exp(-jws)-ds— *0 _«d
«0 ~= ^ go.(t)* expf-jwrj-dt*^ fc (s)-exp(-jws)»ds
- Go-(W) Fc (w) (8)
•Owhere Go>(w) = J g<>.(T)« exp(-jwr)* dT is the Fourier transform
* OO
mm
of the Gaussian function, and Fc (w) - f fc (s)* exp(-jws)*ds* OO
is the Fourier transform of the input function, i.e. input function in the frequency domain.
It is known from formula (8) that the Fourier transform of g,>.(t)fc (t) is the multiplication product of Go*(w) and Fc (w). Since Fc (w) is the input function in the frequency domain, Go»(w) can be treated as a transfer function or be considered as a filter of some system. So, Go-(w) is also called Gaussian Filter. The output, F(w), of this system is the Fourier transform of the convolution of Gaussian function and the input function. Therefore, simply using the inverse Fourier transform, the desired convolution of go>(t) and fc (t) can be obtained.
So far, the relationship of the convolution of the Gaussian function and input function in both frequency domain
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
35domain and spatial domain has been revealed. Now the question is how to get this convolution. Since the actual signal obtained from the computer is a series of sequences instead of a continuous signalf the above method must be modified to handle the discrete signal. This will be discussed in the next chapter.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER IV
FFT IMPLEMENTATION OF CONVOLUTION FUNCTION
As discussed in the previous chapter, the convolution of the input function, fc (s), with the Gaussian function g o v ( s )
is our desired result. This result can also be obtained by the inverse Fourier transform of the product of Fc (w) and Go»(w). But in practice, the signal obtained from sampling the input function is a series of discrete sequences. So it is better to use the discrete mathematical model directly. In this chaper, the relationship between the continuous and discrete Fourier models is explained, and a practical algorithm based on this discrete model has been put forward to solve the recognition problems.
Z-Transform and Periodic Property
Let g(nT) be the sequence of the Gaussian function after adequate sampling g(s). Similarly, denotes f(nT) as the sequence of input function f(s). T is the sampling period. From the sampling theory (Ziemer and Tranter, 1983), it is known that a suitable model of the sampled signal is
36
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
37
fs (t) = 2 *(t)• 5 (t-nT) (9)n=-<»where fs (t) is the input function after sampling and f(t) is the continuous input function. Note that & (t-nT) is a delta function which is identically zero except at the sampling instants, t=nT, so f(t) can be replaced by f(nT). Thus formula (9) will be written as
OBfs (t) - Z f(nT)• & (t-nT) (10)
n=-»Taking the Fourier transform, yields
OO «QF(w) - f Z f (nT)« 5(t-nT)-exp(-jwt)*dt
-oo n=-«>
which is, upon interchanging integration and summationoo oo
F(w) = Z. £(nT)* f£(t-nT)*exp(-jwt)* dtn = - t m - O O
Using the sifting property of the delta function, this integrates to
OOF (w) = 21 f (nT)-exp(-jwnT)
n=-«°Finally, defining the parameter z as
z = exp(jwT)yields
o*F(z) = 21 f(nT)» z-n (11)
n=-°°
F(z) is known as the z-transform of the sequence of samples.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
38Similarly, for the sequence of Gaussian function g(nT), its corresponding z-transform is
00G(z) = 2 g(nT)• z_n (12)
n=-By the previous discussion, G(z) and F(z) can be considered as the Fourier transforms for the discrete models. So, their product is the Fourier transform of f(nT)*g(nT). To get back the convolution of f(nT) and g(nT), simply by applying inverse z-transform to the product of G(z) and F(z), which is denoted as
y(nT) = Z-1{G(z) • F(z))
In order to speed up the calculation, Fast Fourier Transform (FFT) algorithm may be applied to g(nT)*f(nT). The necessary condition for this algorithm is that both g(nT) and f(nT) must be finite-duration, or periodic. Fortunately, after adequate approximation, both of them could be considered as periodical sequences (Stearn, 1975).
First look at the Gaussian function
g(t) = (l/^2JC,o-)*exp(-t2/2o-2) .
It is clear that g(t) is nearly zero when the absolute value of t is greater than 5 0-. So it is quite reasonable to consider that duration of g(t) is only within -5©* <t<5&- , since the value outside of this range is close to zero and the contribution to the final convolution can be neglected.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
39On the other hand, f(n) is actually a periodic function,
since we already assume in Chapter III that the contour is closed. Therefore, both of them can be considered as the finite-duration function. For convenience, let N be the length of this finite-duration and 2 substituted by exp(2Jtjk/N), we have
N-lF(exp(2ftjk/N) = £ f (n)» exp(-2jtjk/N) (13)
n=0where f(n) is a short notation for f(nT).
It is not difficult to see that formula (13) is in the form of Discrete Fourier Transform (DFT) which can be calculated by the FFT algorithm directly (Brigham, 1974). Therefore, by the above discussion, the convolution of the input function and the Gaussian function can be achieved by the following steps and each of these steps is simply calculated by the FFT algorithm.
1. Calculate the DFT for f(n)N-l
F(k) = 2 f(n) WknN , k = 0,1,...,N-1 (14)n=0
where F(k) is a short notation for F(exp(2)tjk/N); and Wjj is the short notation for exp(-27l j/N); f(n) is the input sequence.
2. Calculate the DFT for g(n)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
where G(k) is the short notation for G(exp(2*.jk/N); and WN is the fthort notation for exp(^-27Lj/N); g(n) is the Gaussian sequence.
3. Calculate inverse DFT (IDFT) y (n) = IDFT[F(k) • G(k)]
N-l.= 1/n Z F(k)*G(k)* n = 0,1,...,N-l (16)
k=0where y(n) is convolution of f(n)*g(n).
FFT Algorithm and Time Complexity
The FFT algorithm we use here is the so called decimation-in-time algorithm (Brigham, 1974). The principle of decimation-in-time is most conveniently illustrated by considering the special case of N as an integer power of 2, i.e.,
N = 2VSince N is an even integer, we can consider computing F(k) by separating f(n) into two N/2-point sequences consisting of the even-numbered points in f(n) and the odd-numbered points in f(n). With F(k) given by
N-lF(k) = Z f(n)-WknN , k = 0,1,...,N-1 (17)
n=0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
41and separating f(n) into its even and odd-numbered points we obtain
F(k) = Zf(n)«WknN + Z f (n)* wknN» n even n odd
or with the substitution of variables n = 2r for n even and n = 2r + l for n odd,
F(k) = <n£2>f(2r)WN2rk + * £ *f(2r+l)WN (2r+1)k r=0 r=0
(n/2)-1 (n/2)-1 ^ ,= £ f(2f)(WN2)rk + WNk £ f(2r+l)(WN2)rk (18)
r=0 r=0But WN2 = Vn/ 2 > since
W2n = exp(-2j (27t/N) « esq? (-2 jx/ (N/2)) ■ WN/ 2Consequently, Eq. (18) can be written as
(N/2)—1 , (N/2)-1F(k) = Z f(2r)WrkN/2 + WNk £ f(2r+l)Wrk2N/2r=0 r=0
«= G(k) + WkNH(k) (19)Each of the stuns in Eq. (19) is recognized as an N/2-point DFT of the even-numbered points of the original sequences andthe second being the N/2-point DFT of the odd-numbered pointsof the original sequences. Although the index k ranges over N values, k - 0,1,...,N-l, each of the sums need only be computed for k between 0 and N/2-1, since G(k) and H(k) are each periodic in k with period N/2. After the two DFT's corresponding to the two sums in Eq. (19) are computed, they are then combined to yield the N-point DFT, F(k).
with permission of the copyright owner. Further reproduction prohibited without permission.
42With the computation restructured according to Eq. (19),
we can compare the number of multiplication and addition required with those required for a direct computation of the DFT. We know that for direct computation without exploiting symmetry, N2 complex multiplications and additions were required (Ziemer and Tranter, 1983). By comparison, Eq. (19) requires the computation of two N/2-point DFTs, which in turn requires 2 (N/2)2 complex multiplications and approximately 2 (N/2)2 complex additions. Then the two N/2-point DFTs must be combined, requiring N complex multiplications, corresponding to multiplying the second sum by WNk and then N complex additions, corresponding to adding that product to the first sum. Consequently, the computation of Eq. (19) for all value of k requires n+2(N/2)2 or N+(N/2)2 complex multiplications and complex additions. It is easy to verify that for N>2, N+(N/2)2 will be less than n2.
Equation (19) corresponds to breaking the original N- point computation into two N/2-point computations. If N/2 is even, as it always is when N is equal to a power of 2, then we can consider computing each of the N/2-point DFTs in Eq. (19) by breaking each of the sums in Eq. (19) into two N/4- point DFTs, which would then be combined to yield the N/2- point DFTs. Thus G(k) and H(k) in Eq. (19) would be computed as indicated below:
N/2-1 N/2-1 N/2-1G(k)=Zg(r)wrkN/2 = £ g(2i)wlkN/2 + wkN/2 XI g(2i+i)wlkN/4
1=0 1=0 1=0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
43
Similarly,
N/2-1 N/2-1H(k) =Z!oh(21)WlkN/4 + Vl\/2 E oh (21+l)WlkN/4 (20)
For the more general case with N a power of 2 greater than 3, we would proceed by decomposing the N/4-point transforms in Eq. (20) into N/8-point transforms, and continue until left with only two-point transforms. This requires v stages of computation, where v = log2N. Previously we found that in the original decomposition of an N-point transforms, the number of complex multiplication and additions required was N+2(N/2)2. When the N/2-point transforms are decomposed into N/4-point transforms, then the factor of (N/2)2 is replaced by N/2+2(N/4)2 , so the overall computation then requires N+N+4(N/4)2 complex multiplication and additions. If N=2V , this can be done at most v =log2N times, so that after carrying out this decomposition as many times as possible the number of complex multiplications and additions is equal to Nlog2N.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER V
EXAMPLES
The software package using PASCAL language has been developed to test the previous algorithm. The whole package is divided into two parts.
The first part of this package (see Program I, Appendix A) is to create the image information by moving the cursor on the screen. When the cursor moves, the picture is drawn on the screen by the track of the cursor. The coordinates of all the points on the outline of this picture are the data representing the picture and are stored on the disk for later use.
The second part of this package (see Program II, Appendix B) is the real program for shape recognition and representation, which executes all the functions mentioned in the previous chapters. The program first inputs all the data already stored on the disk by the program I, and then converts them into the adequate input functions in the orientation space. By taking DFT for both input function and Gaussian function and taking I DFT for their product in the frequency domain, the curvature changing points and their
44
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
45related parameters, such as curvature m^ and m2, angular discontinuity k, and so on, can be obtained. By using these points and their parameters, the original image can be reconstructed or be recognized.
Several data representing different images have been tested by this software package. The first example is to show that this algorithm can recognize objects irrelevant to their position and orientation. The original data represent two trees having the same shape but in different orientation, as shown in Figure 7.
9
Figyre 7. Two Trees Having the Same Shape But in Different Orientation.
The parameters of the curvature changing points for the first tree are first calculated under some fixed scale by the above algorithm and stored in the memory as a template. Then the parameters which represent the second tree are calculated under the same scale and then are compared to that of the first tree. Theoretically, if all the parameters are the same, these two trees are considered the same one. Since these two trees have the same shape, the number of corner
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
46points and the degree of angular discontinuity should be the same. The following is the actual result which is executed by the above algorithm and displayed on the screen. The result shows that over a very large range of scale o- . These two trees are being considered as the same one.
Enter Name of the File to be Listed:B:Dual_Tree.dat {CR}
{ Input the file name which has two trees of the same shape but in different orientation. }
Your Purpose? (Compare. Show detail, or reconstruction) Compare {CR}RunningSample Period (Scale): 4 {CR}
{ Result shows that these two trees are the same. }RunningSample Period (Scale): 6 {CR}
{ Result shows that these two trees are the same. }
RunningSample Period (Scale): 140 {CR}
{ Result shows that these two trees are the same. }
The underlined part is typed by the computer. When the computer considers that these two objects are the same, it will say that they are the same and show only one of them on
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
47the screen. If the computer considers that they are different, it will display both of them on the screen which means that they are different. In fact, these two trees are being considered as the same over a very large range of scaling, i.e. from 4 to 140.
On the other hand, look at the two triangles in Fig. 8(a) and (b). They have different shapes. Though they have the same number of corner points, i.e., points A, B, and C in Figure 8 (a) and points A', B 1, and C* in Figure 8 (b). The
(c) The Reconstructed Image on the Screen Under the Small Scale 4.(d) and (e) The Reconstructed Image on the Screen Under the Scale 12, Which Also Shows that They Are Different Objects.
results of the above algorithm show that only within a small range of scale, i.e., from 3 to 5, they are considered as the
A A'
C
(a) (b) (c)
(d) (e)Figure 8. (a) and (b) The Original Triangles
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
48same triangle. In fact, under such a scale, thereconstructed image is very rough and is shown in Figure 8(c). Also this result gives the reason why they are considered as the same under such a scale. By increasing the value of the scale, the computer can "see" more detailed parts of the two triangles and can tell the difference between them. There are two reconstructed images in Figure 8(d) and (e) under the scale 12. They look very close to their original images, respectively. But at same time, it is easy to see that they are different. This process of recognition is just like a human being looking at an object, from far to near by and seeing more clearly with the decrease of distance in the object. This advantage is due to the multiscaling technique as we mentioned in previous chapters.
This multiscaling feature can be seen more clearly from another example. The image data for this example is a hammer as shown in Figure 9 (a). The original image has many
(c)(b)(a)Figure 9. (a) The Image of the Original Hammer.
(b) The Reconstructed Image of the Hammer Under Scale 12.(c) The Reconstructed Image of the Hammer Under Scale 5.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
49sharp angles, i.e., there are many corner points. Under the different scale o , the reconstructed images are different. Figure 9 (b) is the reconstructed image of the hammer underscale 12, and Figure 9 (c) is the reconstructed image of thehammer under scale 5. Also, under the scale 12, the resultof the above algorithm shows that a total of twelve cornerpoints have been found. But under the scale 5, it is shows that only 5 corner points have been found.
It is clear from these examples that this algorithm can not only recognize the object but also can achieve the multiscaling feature during the recognition process. The higher the value of scale 0* , the more precise the image of the original object can be obtained.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
CHAPTER VI
CONCLUSIONS AND RECOMMENDATIONS
Curvature changing points have been suggested by many researchers as important feature points and have been used widely in pattern recognition. Fourier transform is the classic technique for digital signal processing. In this paper, a method combining curvature changing points with discrete Fourier transform has been used successfully in the process of shape recognition and representation. An important feature in computer vision, multiscaling, is achieved by this method. Several examples have also shown that the process of recognizing objects by this method is matched with the human recognition process. Besides that, since DFT and I DFT are the dominant calculation in the whole recognition process, FFT algorithm can be used to reduce the time complexity dramatically.
A problem exists in that the above algorithm works only under the assumption that the shape of the object must be closed and connected (see Chapter III). This assumption will exclude many application areas. A simple modification can be made to improve this weakness so that the same algorithm can
50
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
51be used to recognize disconnected but closed shapes. This modification has actually been achieved in this software package. The principle is simple. Since each component is still closed and connected, they can be dealt with separately by using the same algorithm. Then, simply by combining all the results of each component will produce the desired image.
Another problem is that the relative position of each component can not be determined by the above algorithm. In order to know their relative position some more sophisticated structure description technique must be used. Therefore, it is recommended that some structure description technique, such as semantic nets or a decision tree, be used todetermine the mutual relationship among each component sothat more sophisticated objects can be recognized. The main trouble in doing so is that the Fourier transform does not preserve this property. In order to know the relativeposition, some knowledge must be obtained before the Fouriertransform. Though there are several ways to do so (Winston, 1984), all of them have nothing to do with the Fourier transform and, therefore, were included in this paper.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
APPENDICES
52
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Appendix A
Program I: Image Creation
53
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** ** ** PROGRAM I: IMAGE CREATION ** ** THE PURPOSE OF THIS PROGRAM IS TO PRODUCE THE IMAGE ** INFORMATION FOR FURTHER ANALYSIS. WHEN YOU MOVE THE CURSOR ** ON THE SCREEN, A PICTURE WILL BE DRAWN ON THE SCREEN BY THE ** TRACK OF THE CURSOR. ALL THE POINTS ON THIS TRACK WILL BE ** CONVERTED INTO THE CORRESPONDING COORDINATES AND THEN BE STORED ** ON THE DISK. ** ******************************************************************************}
{* c-}Program Image_c(input,output);{$1 graph.p)VAR
FilVar: Text;Filename: String[14];Px»PYfctx,cty:ARRAY[l..40] OF integer; Property:ARRAY[1..40] OF char; CUR,ORF,ORB:ARRAY[l..40] OF real;First,Second,Third,Last,FunctionKey:Boolean; x,y,i:integer;InKey:char;
U!U>
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
* ** PROCEDURE DRAWING ** ** THIS PROCEDURE PERFORM THE TASK OF DRAWING THE IMAGE ** ON THE SCREEN BY MOVING THE CURSOR. ** ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * }
Procedure Drawing(InKey:char; FunctionKey:boolean); Const
NorthEast=45;SouthEast=135;SouthWest=225;NorthWest=315;
ui
{***
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
***
55
* -it * * * * * * * * * * ¥ * * * * * *
fa *fa *fa *H *a **w *a *Eh *¥
>* ¥fa *H *
£
EH •aM O5 fa35 (0 OQ 5 fflfa >1O W HO H 2fafa fa
S B8
S g* c 2: EH Ic fa« <■* faQWHUQOS!'-''-'■It U S Q h K w O I S W H N* «j fa fa fa >1j( J[< W* W-* 'fa*' %* 0 ¥ ••* >1 “ i{ 0) K •* U (k «k O « £ 0 X¥ C +>+)+)+> in in >1 *¥ O W W W M + I I -« -h •■>•■> <u « a> o> O' o> *o« +> ■■ ' > H M ? S C C O' fa¥ O a 43 2 £ Xj-H-H lilt G j J + J + l + J + J + l . L j + J T J ' e ••-It 5 M O W W M O H d i d i f l >1 -u o * fa o o t d d i o o o o a i o ) Vio * ^ fa a w w s 2 w 2 w a a _ (0fa w * c o w w w w w w w ^ s _ w g ■« > ■>
f a x ¥ o tp cp o> O' O' O' tn O' O' O' w eo hfa ¥ *rl X C C C C C C C C C C a in - H nC/3 2 * +> 0) -H *H *H *H *H *H *H *rl *H -H EH H fa ^h * o f a U ' d ' d ' O ' d ' d ' d ' O T J ' d + ' - • >1psa « c C(0(0(0(0(0(0(0(C(T5nj <u b c ^Eh O ¥ p Oa)0)<UQ)Q)Q)Q)«D<l)a) P O H X
¥ o + 3 * * 5 5 * 5 * 5 5 ® +3 x 5 + Tu * a oa>a)a>fl)wa>a)<DO)a> •* 11 11- h osj ¥ c w w w w w w w w w w —*■£> c •• Jh h5 * 0 ) 3 H H *h x fa •*fa ¥ Vi fa................. — <d O' 'oj( d • • ■ • • • • • • • T) *P 0) h
* U W t B M S K H O f O O V •‘ •‘ 5 ffl f l* 0 I C W - - ..........H r* O -H C O fa« O d>CJ 0) fa H* M 0)* « « « « « * fa XJ
0)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
end
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
beginIF FunctionKey then DoFunction(upcase(lnKey))ELSE
beginIF(first=false)OR(Upcase(InKey)='F') Then begin
CASE Upcase(InKey) OF •F': begin { TO START DRAWING }
x:=xcor+158; y:=96-ycor; i:=1; property[i]: = • F ';plot(x,y,3); {show first point}px[i]:=x; py[i]:=y; first:=false; i:=i+l;
end;•P': begin { POINT OF SMOOTH }
X:=xcor+158; y:=96-ycor;px[i]:=x; py[i]:=y; plot(x,y,1); smoothp;property[i]:='P '; i;=i+l;
end;•C': begin {TO START CORNER POINT)
X:=xcor+l58; y:=96-ycor; px[i];=x; py[i]:=y; plot(x,y,1); smoothp;property[i]:='C'; second;=true; third;=true; i:=i+l;
end;
OIo\
'E':
begin
{TO
END
DRAWING
FOR
SMOOTH
POIN
T}
px[i
]:=p
x[l]
; py
[i]:
=py[
l];
57
>1ft
>1
•*ll
>i •*4J ft •*U 43 H <U4Ja ° o o u eft w
i—"HXft >1r+j a -.. Tt & H 0)i—• Q) -P + wH -H ft O *rH R)ii c o o ii o•• •»>H M M 6 ••HT3 O' ft ft W -h *0 *wCO) C O0) ,q 0)
TJca) •»'Ocfl) *0ea)■g0)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
{***
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
58
* * * *****««*****«
X
CO * MX
8
**«*
Co•H
2 * PO * OH
|
«******
110
0)X « XXCO * •*H « u x>P « <0 COa * 2 32 0 BH •K • «Eh ■K p
X CO « c •HW H « (02 Q ■K a>Eh « rHW O « 0O Eh « 0* « 2
Q * • • wW W * X2 co * Ap p * 2Q * e T3W CO CO * 0 a)U H X * •rl CO •*o H « P CO 0)05 M 2 * 0 CO 10eu 2 * c p rH
P 2 * p x •% (0Q O * £ X a)W H * p IIa eh « P 2 • •o u * (0 p X05 2 * > Q ii a)(X p * • • 2
* X •% 2 £ X cCO 1 * 0) ^ u S oH 2 * 2 X5 -2 •H2 O * P P O X u C ** £Eh 2 * a> (0 -eg jQ 0 0 o
* CD XS •d =«= 32•H C II2 * O XX II P 5 ••O * c Sxs -d O X XP< * 0 #• '- 'U c 10 c J®!2 * •H J3 •d '-'•H Q) d W 2
* P 0 c m p p x *d co P* U •H <0 <H <0 C P <0 •*« P O' P W XX HINOO* 3 (0 a) c* 2 > XX <0
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
{***
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
**59
* * *
§ 9fa CQ
« * « « « « « * * * * * * * * * * * * * * * « « * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * *
gigH • Zco o
„ Q „ « fag a sgggg> cofa H
i § °< CO •
CO CO H Ow co zN WH U S SS S i SS5 Q
Z fa H Q °
z 3 3 S1 * 3 82 EH O CO U W1co co fa fao w
w o w
O < CO
« • ta* e« Q)« a>* Ft* 0 • *« CO« z ii« 0) +» Ft« z JS a)« Iy> O'« a> •H a>« Ft a) 4J« 3 w c* •d Ft •H« 0) +» to« 0 CO W ••« 0 C U P
* * * * * * * «* «* «« «* z «* w «* u «« S ** o ** CO «* «* u «* ** *« «* z «* o *« ** z «* Q «« Q «« Z • ** H Z *« Z fa ** fa ** fa fa «* w u «* X EH CO ** o ** « fa CO «« Z Z H *« ft H W «« a fa it ** a M ** a fa «* o «« M o «« s Eh fa «* 5 Z ** a CO H *« w H fa «« u Eh «* o fa O *+ fa fa O *« fa h «* a m ** fa w ** u it *« o ** fa z «* fa rt! *« fa *« co a *« H «« w z ** it u ** w ** EH «« ** a «* 55 «« «« ** «* ** *« « « « * * * *
* * * * * * * * ** Ft O fa u
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
Procedure DrawBox(a , b , w , h :integer)begin
Draw(a,b,a+w,b,1); Draw(a,b,a,b+h,1); Draw(a,b+h,a+w,b+h,1)? Draw(a+w,b+h,a+w,b,1);
(top){left side) (bottom) {right side)
end? {draw box)begin
Graphics ?DrawBox(0,0,319,199-charheight)?TurtleWindow(159,99-(CharHeight DIV 2), 318, 198-CharHeight)? SHowturtle;Home;Wrap ?Penup ?i:=l
end;
a\o
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
{ ♦ ♦ ♦ A * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** ** ** MAIN PROGRAM ** ** ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * }
beginwrite('Enter name of file to create:'); readln(Filename); assign(FilVar,Filename)?rewrite(FilVar); {initialize disk file)First:=true; second:=true; third:=true; Last:=false?NewScreen;Repeat
Inkey:=GetKey(FunctionKey);Drawing(InKey,FunctionKey);
Until UpCase(Inkey) in [#27f*c];ClearScreen;CreateFile;
end.
<J\
Appendix B
Program II: Image Representation and Recognition
62
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
« « «************«**««■K*«■K«*««■#«*«*«******««*«*******************«*«*I «o *« *
* «—
* * * * * * * * * * * * * * * * * * * * * *
8OHEhH8C5ou
80H
1w8g
wu
8
w o o <8 05O U* pH O P j O O O£> w w o< w 8 s w
CO CO 8 EhM H O 8 8 8
Eh Eh S3
8Eh
W U
a s 018 CO H rtj Q H Of g g o .s ->,§
M 8 H
Eh 8 U .e h '‘? 1 §o h h § o ehh U • U W 8 < 8 8 OW Eh O W O W _ 8 < H 8 H 8 O
8 H
O Eh Eh 8 H H 8 W Eh 8 8 O O O O H
m S u
CM cn
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
THERE
ARE
SEVERAL
CHOICES
IN THIS
PROGRAM: RE
CONS
TRUC
TION
COMPARISION
AND
SHOWING
DETAILS.
RECONSTRUCTION
SI
MPLY
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
**********
REDRAW THE IMAGE ON THE SCREEN BY THE DATA IN THE DATABASE ACCORDING TO THE DIFFERENT SCALING. COMPARISION PERFORM THE TASK OF COMPARING TWO DIFFERENT IMAGES AFTER RECOGNITION.IF TWO IMAGES ARE SAME, ONLY ONE OBJECT WILL BE SHOWN ON THE SCREEN. IF THEY ARE DIFFERENT, BOTH OF THEM WILL BE SHOWN ON THE SCREEN AND SAY THAT THEY ARE DIFFERENT. SHOWING DETAILS IS TO DISPLAY THE SUBIMAGE OF THE WHOLE IMAGE, WHICH MEANS THAT THIS RECOGNITION PROCESS CAN SEE "DETAILS" JUST LIKE HUMAN BEING.
**********
Program Cogjpas(input,output);{$1 graph.p)VAR
FilVar,Cm: Text;Filename: String[14];Px,py,ctx,cty:ARRAY[l..140] OF integer;Property,cha:ARRAY[1..140] OF char; CUR,ORF,ORB:ARRAY[l..140] OF real; max:ARRAY[1..10] OF integer; cpx,cpy,ct:ARRAY[l..5,1..140] OF integer; curl,curr:ARRAY[l..5,1..140] OF real;First,Second,Third:Boolean;mmx,lx,mm,scmode,index,x ,y ,i,tmax,segment:integer; fi,pm,inkey: char;
C\
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
{ ********************************************************************** ** PROCEDURE CURVE ** ** THIS PROCEDURE DRAW THE CURVES BETWEEN TWO DIFFERENT ** CURVATURE CHANGING POINTS. ** **********************************************************************}Procedure curve(ax,ay,bx,by,cx,cy:integer);
VARorab,orbf,orbb,orcf,ml,m2,bl,b2 ,ex,ey,r,s :real; ssrchar;{******************************************************************* ** PROCEDURE CORNER TRUE ** ** THIS PROCEDURE DEALS WITH THE CORNER POINTS ** *******************************************************************}
Procedure thtrue;VAR
dx,dy,si,s2 :real;tx,ty,ptx,pty,xincr,yincr:integer; ST:CHAR;
cr\U1I
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
begindx:=ax-cx; dy:=ay-cy; tx:=ax; ty:=ay;
{* DECIDE THE DIRECTION OF INCREMENT OF X AND Y *}If dx<0.0 THEN xincr:=l ELSE xincr:=-l;IF dy<0.0 THEN yincr:=l ELSE yincr:=-l;IF abs(dx)<abs(dy) THEN
beginWHILE t y o c y DO
beginty:=ty+yincr;
{* IF INCREMENT OF X > Y, DRAW Y FIRST, THEN X. *}IF tx>trunc(ex) THEN tx:=trunc(ex+sqrt(r-(ty-ey)*(ty-ey)))
ELSE tx:=trunc(ex-sqrt(r-(ty-ey)*(ty-ey))); ptx:=trunc(tx+3 2 0); pty:=trunc(ty/2);PLOT(ptx,pty,l);
end; end ELSE begin
WHile t x o c x DO begin{ read(st); }
tx;=tx+xincr; sl:=r-(tx-ex)*(tx-ex);{ writeln('NOW THE ARGUMENT OF SQRT: ',S1);}IF ty>ey THEN ty:=trunc(ey+sqrt(sl))
ELSE ty:=trunc(ey-sqrt(sl));{ gotoxy(2,24);writeln('tx=',tx,•ty=l,ty); }
a\o\
67
* * « « « « ♦* «* «•r « *« «* ** * •* • « £* CO « ft* EH ■K u* £ « Qc* H * o* O « CO« ft «* * ft* £ * 3
(M « EH * EH\ * O *>5 * O * 5P * £ « o
* CO * •<h «*.u « « EJ rH rHc « ft * £ 1 13 « O « ft II IIp * « £ •• ••p * w « ft P Pii * CO « ft a o•• * < * • ta o c cft * V « P £ •H *Hp * * Q) H X >1a « w « O'
* « 0) ft f t ft«« ft
s ** t i §H 253
o « D ?! * •H » hIN • ' « £ Eh * • • ftn « Eh H * P o H H £+ H * £ * 0 II II ftX » * SC * C •ft £ •i •• X ••P >i * * •H >1 O P P EH Pw .p « O P * 0 H o o 5 0o a •* HC O < * ft 1 Eh a e ~ a cc « £ ft « P >1 O •H *H >1 *Hp X P « CO a « 0 A X >1*0 >1 >1M p III * « c ft — 0 +p f t — « ft « •• >i H £ £ U1 A f tII — ■o * ft « 0) X >iJ3 Q f t ft A V P•• p (0 0) * p « (0 -O II £ £ (0 >1 _ IIx o a> co * U Q « rH >1 • • ft Eh Eh V P C • •P H P rH « s ft * 10 P £ *H >1ft ft *d (0 * H U * <*H •* ft X P Eh O O X ft o»p
C <M * Q o « 43 H ■» 0 • • 'd m u)— a> II * ft ft « P nt x 1 •» 0 O 0 — C H p
•* •• * O ft « 0) P X X a v V 10 -H £<0 TJ « O « 0) P ft •° 4? H X f tp tp £C P * ft CO * P •• - ii it U 0 0 1 0 0Q) -H * ft H * 0 f t f t c •• •• W43 • ' « £ « •o >0 P •-H X X Q p ft ft
P 'O * EH « 0) fr'O P H H HC « « O X X 0)a> « * O f t TJ P 43 *
* * p 3« « ft >* * * * « « *
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
{* IF INCREMENT OF X > Y, CHOOSE Y, THEN X. *}IF tx>ex THEN tx:=trunc(ex+sqrt(r-(ty-ey)* (ty-ey)))
ELSE tx:=trunc(ex-sqrt(r- (ty-ey)*(ty-ey))); ptx:=trunc(tx+320) ; pty:=trunc(ty/2) ; plot(ptx,pty,1);
end; end ELSE begin
WHile t x o c x DO begin
tx;=tx+xincr;{* IF INCREMENT OF Y > X, CHOOSE X, THEN Y. *)
IF ty>ey THEN ty;=trunc(ey+sqrt(r-(tx-ex)*(tx-ex))) ELSE ty;=trunc(ey-sgrt(r-(tx-ex)* (tx-ex)));
ptx:=trunc(tx+320); pty:=trunc(ty/2); plot(ptx,ptyf1);
end;end;
end;begin
gotoxy(42,2);writeln('The Original Image:');FOR i:=3 TO index DO begin
IF property[i-l]=,C' THEN third:=true ELSE
beginAx:=px[i-2]; ay:=py[i-2]; bx:=px[i-lj; by:=py[i-l];
o\00
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
cx:=px[i]; cy:=py[i]; ex:=ctx[i-l]; ey:=cty[i-l]; r:=sqr(l.O/cur[i-1]);
{ writeln('AX=',AX,1AY=',AY);WRITELN(1BX= *,BX,’BY=’,BY);WRITELN('CX=',CX,'C Y = C Y ) ;WRITELN(•E X = E X E Y = E Y ) ?WRITELN (• R = • ,R) ; READ (ST) ; }IF third=true THEN thtrue ELSE thfalse;
end;end;
end;
*PROCEDURE SMOOTH POINT **
THIS PROCEDURE IS TO GET SMOOTH POINT **a***************************************************************}
Procedure smoothp;VAR
ax,ay,bx,by,cx,cy:integer;
o\VO
IF second=true
THEN
seco
nd:=
fals
e70
CM H • * >1I I r -,0
•rl -H *H •»
ft a a -II II II >1 •• •• (•>i >i >i *>(0J3 O X A• % 1 %i—i i—i >iCM H (0 I I r—i
•H *H «rl X
■ f t f lC •• •• •• ^W -H X X X 3 •*03 tr<a u o d M O ) Gw 43 o) -o0) c
43 <0
HC HC HC * He He He HeHC He« HeHC HeHC HeHC *HC O *« EH HCHC HCHC O HCHC ft HeHC H He* D HeHC ft *HC O HC* O HCHC q HeHC • HCHC ft «HC f t ft HeHC h h «HC ft ft He* ft u HeHC O CO HCHC CO HCHC H «HC ft ft HeHC ft H HCHC EH HeHC ft HeHC f t 0 HC* 0 HC* CO HeHC CO Eh HCHe ft ft HC« ft H HCHC H 0 HCHC f t ft HCHC HCHe ft ft HC* ft O HCHC Eh HC* O He« ft ft 1 HCHC H HC* ft Pm H HCHe 4 Q C HC* ft ft HCHC Q HCHe § eh HCHe 5 ft HC* w Q ft HCHC S ft ft HC* 5 U ft HCHe Q O ft He« W ft ft HCHe U ft H HCHe O Q HC* ft CO He* ft H ft HCHeHe g£S
HeHC
* HCHe «HC *He «He HC * « He He HC He
G10<DrHo o 43 • •
usGO
•H■Po c3ftP10■s • •>101ftGHtPC•HspQ<UU50) -P O 1/1 O P ft U
•1 ««i *«i•* in in inIf) CO CM H <C r l CJ nII II II II 4J *i 4J -PId (II (A ID 10 <0 d) 0)s a s s
. 0 0 0 0G f t CO CO fto
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
71
G0)xs
1:•H0 ftPmM•H<W
1(0ft■»II>1£aa)w(0o13w8Q)Wi—I<d<uAtoM
•H<W •
ftO «*■>*>iQ)a gH Hdf §wido &♦co
ir
& ft o
ft W•Sft30> H W 0)43
C •H f- w tP •H ft 0) O' H A d)43
ftft
ftOft*
c•HO'd>43ft
•ft *ftM - O ft0 - >i II1 • •
VO 1-i O' «HII l—* •••• > 1 l— 'f t p -H
H u ak K 0) Ik ft d)CO ft «”■' ft (0w o n *hH P id+ f t f t X < P P - II II •»O X •• • • r lO +X H P -H W -H II II O ■—*»-< II•• •• H X •• •»X -H f t ft«W *rl -Ocd)
POOf1\0 >kO' ft II II •• •• ftl-l
•H ft
COwr l+po
IIft ••ft I—'H *H•k k i— iX ft ftII » ftp •* •• X A P HO r-i^P X *H p O II • o o « X H B O'X ftfttfl d)43G
•H
d) + ft'H O II P •• ft-H TJ C d)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
{* FOR THE
CORNER
POINT
*}
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
'C': beginX:=xcor+158; y:=96-ycor;px[i]:=x; py[i]:=y; plot(x,y,1); smoothp;property[i]:='C'; second:=true; third:=true; i:=i+l;
end;{* FOR THE END POINT *}
'E '; beginpx[i]:=px[l]; py[i]:=py[l]; property[i]:='P'; smoothp; i:=i+l;
end;{* FOR THE END POINT AND ALSO A CORNER POINT *}
'D ': beginpx[i]:=px[l]; py[i]:=py[l]; property[i];='C'; smoothp; i:=i+l;
end;end; {of case)
end; end;
end;
-jto
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
* ** FUNCTION GETKEY ** ** THID PROCEDURE DEALS WITH THE SPECIAL CASES IN DRAWING ** PICTURE. ** ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * y
Function GetKey(Var FunctionKey:Boolean):char;Var ch: char; begin
read(kbd,Ch);If (Ch=#27) AND KeyPressed THEN {it must be a function key) begin
read(kbd,Ch);FunctionKey:=true;
endELSE FunctionKey:=false;GetKey:=Ch;
end;{******************************************************************* ** PROCEDURE NEWSCREEN ** ** THIS PROCEDURE IS TO CLEAR ALL THE EXISTING INFORMATION ** ON THE SCREEN AND CREATE A NEW SCREEN. ** *******************************************************************)
Procedure NewScreen;Const
CharHeight=4;
U
^****************************************************************
74
<-s Q)a) Tt • **0 »H•h — *tn H(0 fi %O P *"k— P p 43 N&<w p o' \o a) O'H 43P H f l P ■' O— c
"12P<0 O'Q) ^ (0 Pp cn - £C O'•H £ N *rt.0)
H H L C 4343 - -P p O*. Ih tk 43 45 i«s orl rH fl J - - O
X •»■»-+ No 43 43 a <0 n n •>CQ ** 4* + * s,v '" s **■* COS a 43 «J .C & X n C ■*nj ve *h pP <0 <0 43 43 O O 43 *■ ’O ®Q k »•!■ « C C H (0 O' •*43 43 43 I* p 5 > _*• g?|bQ) v ^ « + p p (0 H »-t -P «P (0 <0 <0 (0 P P P C 433 w w w w w w i o x ll-H O "7>0 SI*!*!*!*!*'—' •- O P •• •• Ha>c<0<0(0<0<0(0 w m •* s •n w C II( ) . H P P P P P P * « o h ,o _ w *c! •*o O'Q a a a a c G c « <o ii w « O'-npa) c *h *h p •• — o 5! u(1,45 0) O'SCQ-H'd 0 > 43a> c p45 0) P4
•fe
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
WHILE
NOT
EOF(
FilV
ar)
Do
begi
n
75
30
ri *m• n •n
1—1u3
rHP • -0 ~* *. i—in “ •(->•r> i—iUJ - >1>1r-. *JJp i—>m M0 ■ i r n dl*•—i ■—« QtI—I>iX 0•r>P P MH 0 QiX Q) ». «.p a- -o o* M- -I—Ia r-» r—iW Trn>1 W •a - >iflr— 1 a Mm ■|-> *■ 0•oI—I* ■»LJp -X M -Oi 0 1—1 h.
u *—I'nr-1p -r» •—«*r~»£>•—» X *—•rH <H f t p• H M MP* O C 0
Hc d)rH pTJ • r lid (Hd> sM
Xd)TJC• H
AQ] ikQ «-*<—> 55 M•- h idH <W H - > •*+ 0 I w rH r"'*
• o —'• n C -H tflH Pn toQ)•i-co X P d> UC d> *H 01 idd) <d M 0 0)
0)H• r l
i
•aGd)
« * * *«**********«««««***************«*«« h* 2« H* O« a* i* «**« u« a* S* a« w« o* o« «« a«**«*«****** * * *
« « « «
a
* * * *
4J .*c o• H •o in a ii X n
• r l0) r-l M% d)0 0 M P4
E-tmSoo
<dd)m
CM EH * ■ H •**EH U - d)d) cr> d)i *M *H 3O ••V) *n A id
MidJSo
H CO
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced
with perm
ission of the
copyright ow
ner. Further
reproduction prohibited
without
permission.
beginave:=0.0; s:='FOR i:=l TO index DO
ave:=ave+cur[i];ave:=ave/(index-1.0); {calculate the average of curvature.)cur[index]:=cur[1];For i:=l TO index-1 DO
beginIF(property[i+l]='C') THEN cha[i+l]:=«V'
ELSEbegin
abscur:=abs(cur[i]-cur[i+1])/ave;IF(abscur>lim) THEN
cha[i+l]:='I 'ELSE cha[i+l]:='V';
end;end;
{ arrange the data to be display on the screen. ){ write(ave);FOR i:=l TO INDEX DO
write(' ',cha[i]); writeln; )gotoxy(2,3);writeln(1 X Y Ml M2 D'); gotoxy(2,4);j :=5;FOR i:=2 TO index DO begin
IF cha[i]='V' THEN (list all the key point)beginIF property[i]o'C' THEN
begingotoxy(2 ,j);
o\
writ
eln(
s:2,
px[i
]:3#s:
2,py
[i]:
3,s:
2,cu
r[i-
l]
in • •eo
in • •00
n • •oOJ#•CO%in••
00
•H »HL-J LJ«WX> M M •>0 0 cm(0waw■g0)
■n C C > (0 (0 CM P P
'- '0 0 >tP P X (0 «
- 9 11 11C P •• •••H 0 rl N O' G*P P<uA
HI•rlLJP8*
CM••(0•«> *. in*-*C1 r— 01 •• (1 in r-1 ••rH *rl p Tf i— I *H > i CM• Pi ••m * to\ CM *•0 •• in• to ••o-oo ■ con ••
. H •• r—i ■K •—i*H <—<H u pP X P1 0.0
CM * *• P CM CMw •• ••*—• to to o ~G GS 3•• PP * • * H•O +G *n •* 0) II >0 •• G •n 0)
TJC •*0) *0 G 0)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
78
* « « * *
H+
W
W
* * * * *
d)C•Hi—Ift
Q)M%Q)OOMfa
id a)
a> to ><
r g«J X >o ai •o c• • » H
* o--E-I
55WKEh
£
Ha>
xa
«
c•HUva)A
11 cC •• -H fa tnH •h a)W PS A(0 oi (0 fa
ljC H Id *H J> ,hA &>< T3U 0) c A a)
cd)
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Xver
[j]:
=XVe
r[l]
; Yver[ j ]
:=YVer[;L];
XVer
[j+1
]:=X
Ver[
2]; YV
er[j
+1]:
=YVe
r[2]
; Xv
er[0
]:=X
Ver[
j—1];
Yv
er[0
]:=Y
Ver[
j—1];
79
*•Huio
d)■p•H&
u0)ssd)■P•H&
OEh
8■■I*g* HO rH IIH ' S » •• *|-> 0 *H •H ||
r>* Ni
• r l ‘ r li— I i— Io om —n•Hi—l r—i0 rg
* i—I’H (N i—>» 0 • r l *
H i— i * H • r l v u - J - r l 0 i-i - 00 c•—' rHc a>rH -P U *H 0 -H C «J H
^ - r l a) 3 •.. 4J PS 0> IHos x a) o o) o is n h APm | 0)B In
2oEH
rHII s•• »H
c a xi•• *H O
d»*H CP Pm w a)O OS XI H O0 Pm
89I
- 8ii
• k l» rH1—1 f—1 •k a>• r v n ■n •pi—i i—j HC •H0 O m PhX >1 • k N >+ + ■p i—i
TJ M • k<M CN r~i HI 0 *-k1 1 I—I 0 I—IM M ch II • * X
•k + + i—i •• I—I 1--1o •H tH 0 i—i *• i—j i—i 0 ••> rH *—1Mo Ph Ph II • O ' - ' M 0II at a> a • • •• II M 0 o• • > > ■ J j r—i •• 0 0 - IkI— I X X •d h i—i 0 He - o• rn O HC HC II CO r-i || •1—1 Q I— I I— 1 k. •• o I— I Ik * II oo M M i—i i—i 0 i K - n O u H 11 Sa. k • n pv O 0 HC S 0 M •• Q
• n * n l—l 1—1 • k Q 0 r-1 0 O XO i—i i—i 0 o +> <*) i t II 0 0 * t
o EH O O X D U O • % 1—J • • •• II II ^ * N 0 * 0 r—i ^ o
O H •t •• G n • 0 Eh * a) EHII II i—i i—i rH • * n O h a ■-I-p• • •• • n * n a) o i—* Eh II II H H *H O H<->x B •—11—• •P • 0 .. . . II B X Ph • II• n •H O O •» *rl rH 0 rH r“ i i-n •• •H 0 J •% o ••■—> PS &> X Su 'd PH II II II ^ t <N X tP 0 TJ II *o S a) C 3 Ik II II •• i— i i— i d) C ••
> X Pm .f l <U irj r - i r - i - m B * X OS X i 0) X 06B PJ •rl O 0 O a o0) i—ii— j OS tp U 0 Pm I— I 04 Pm
0 0 O 0)—i 0 0 Pm XI
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
80
HC HC HC HC HC HC%
HeHC HC I—IHC • HC •riHC He U JHC a He pHC H HC pHC ft * o* * *HC h * •* p ** ft * mHC ss HC ** H HC r—i* HC •r>HC O * UJHC 2 HCHC H HC 4->HC Q * 0HC f t HC U KHC O * •* ft Heo * CO He - -no HC pt] * U UJ
H HC 2 He+ HC 2 HC •r%«P
HC o HC •—* U* u * X 0)HC HC ^ -p f t
>1 HC s HC U 0 00 HC o He •H Uft HC OS He w - f t
* f t HC T30 HC He <0 - -Ih C ’ HC •< He a)
i—i I— i 3 ^ HC E j He M i - i -X X H HC < * • n •*■_ 11_ i 4J i» He Q HC u—1 |—|0 0 II ^ HC ■K > r r »X • • HC W HC f t 1- 1* * >1 *• HC s * -■P1—11—1 ■ HC « - PX X II HC He 0i_ ii—i •«. HC Q He X - -H H O - HC < He 0)M M <N ' HC 0 He •0 »—»o O n X * a f t « C T -i-0 O + - * H He •H Q ‘+ + ■ HC f t O « •■Q X >-1X >1 X II HC 1 EH HC f t -nO O 0 X ^ HC f t He •« •- II X 1f t f t Oi « H •» HC EH (0 He a> H || d) P OHII II w w * HC H He rH • * ' SI X-OCO p.. . . o C >1-H HC ja He •H p .. 0) C > 0
C X >1 E rH *<M HC ft fa HC CM 0) *(“ 1 'O *H rH *•H O 0 • ' p <l> X w HC u a He 0) o* B *H -u> a f t 's h -p w ,o HC 5 He ■P 0) ••••H O f toS c p - H p m HC Q HC (0 ■p H Eh 'Z"A 0) II P 0 0) HC po W He a) c • - 1 “ B
• • 3 rH P • * * S O He p •H 0 "H w H rHX f t TJ HC 5 Q HC 0 *0 II B II 0)
c HC Q f t HC • • • * O • • rH • • -P^ W ' Q) fl HC W ft HC 0) X P 6 X 0 ) - r c Hc He u HC p a) co ■P 0) P _ P
0) HC o (0 He p *0 X B X TJ -H f t £•fe HC f t H He TJ c 0 •H 0) E P OTJ * f t He a> •H •• Cnp -H is f te HC jp HC o _ » (0 0)01 HC He P % • n * H X
HC « p <HC He f t >* HC * * « * He
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
clos
e(Fi
lVar
);
{***
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
****
*81
* * * * * * * * « * * * * « « « * * * « « « * * * « * « « « « « * « « « * «
PQ)O'0)Pc•H
* * * * *
* • •« •H* C«* %* <* >** • fa* P* a)* O'« a)* p« e* •H* • •« X* id* s •** p o« Six' •« 0) IT)« P II •fa« id CM p* fa • * B a>* e h ■H O'* O O H a)* 0 p« c« Cl r l P •r l« p a> w _ • •* 3 p fi fa GV. *0 id o 3* <u J o >* 0* 0* P* fa
•H "H
• fa
» * ACM CMl__l L J |— |rl P-H P P - 3 3 cm0 0 ■->1 1 Pl-ir-i 0
x Q •H *rl Iid Q L L |—|S rl rl *HP X L J I— I L
» id rl P rl- B P P >->X E 3 3 Pid 0 O 0n o w w wP EH W W Wp p p^ H id id idG II G•* rl •••H fa fa facm a) -H O' H
- II *> . sC - H M •rlM h 0 CnC 5 fa a)P
H TJc a)•H TJc ca)HU
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
************************************************************************}
82
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * * * * * * * *% *2 *
K *U *9 *« *ft «* *
S5 *H *g s« « « * * * * * * * * * * *
** * * * * *
c0•H■PO■P(0coo«p0•HA■Pd)TJ
*Awc o
•rl W •H 0) P <0fud) S-*
■p0]•Ho■p
•H<W<Po0)
a)in •* o H&li
• • • *• 3 0)—.g ft-o a>
a>•a•POa>tj
o■Ppoinp3a
to a>P c oa> a> x4-> H C -H - W ft
O TJS O »in § §
in ehw 0)C rH -toc 0 a) <h
« C H f t p Cl II _ - . . k: Q)H 0)w O4J 6 d'D'W U •PTJ-P'GU} RJ ft 0)C -H Id-H Id $ 0) A
•h P 0) p a) a) P f t t n ^ P S P Z O H a)A
i to H
cm •- o a)
H +J J5 •»>i 3 w 0) H •x +> a) i
ss •* a ~ w X ®
G fl) •* Eh <U TJ <U HI G r l - P -P -H U O W 4H -
X(0S
0)G•HrHftin.
x 8i—ixX(0 o s &■p •»N—' H «-*<U It -H P •• <H W (0 H ' - ' V i f t TJ M
G S ft « WO £ 4J O
C -P O -H O H O A P A
A TJ tPU G 0)Q) A
W -P <D II -H D O Cl P G - P B t T U f t P T J (0-H (0 ftQ ) G
G Q) o 0) A a)H rl ft P ft£ o h
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
BIBLIOGRAPHY
Andrews, H. C. and Hunt, B. R. Digital Image Restoration. Englewood Cliffs, NJ: Prentice-Hall, 1977.
Asada, H. and Brady, M. "The Curvature Primal Sketch." IEEE transaction on Pattern Analysis and Machine Intelligence8,1 (January, 1986): 3-14.
Ballard, D. and Brown, C. Computer Vision. Englewood Cliffs, NJ: Prentice-Hall, 1982.
Beck, J. Hope, B and Rosenfeld, A. Human and Machine Vision. New York: Academic, 1983.
Brady, M. "Computational Approaches to Image Understanding." Computer Surveys 14,1 (March 1982): 3-64.
Brady, M and Ponce, A "Describing Surfaces." Computer Vision. Graphics. Image Processing Proceedings Los Angeles, CA. (March 1985): 112-118.
Brigham, E. 0. The Fast Fourier Transform. Englewood Cliffs, NJ: Prentice-Hall, 1974.
Cornsweet, T. N. Vision Perception. New York: Academic Press, 1988.
Freeman, H. "Computer Processing of Line Drawing Images." Computer Surveys 6, (March, 1974): 57-98.
Hoffman, D. D. and Richards, M. "Parts of Recognition." Cognition 18 (July 1984): 65-96.
Kuo, B. C. Analysis and Synthesis of Sampled-Data Control System. Englewood Cliffs, NJ: Prentice-Hall, 1963.
Lee, J. J. and Wu, D. "Determination of Pulse Types By System Identification and Pattern Recognition." 2nd Annual Session of Instrumentation Society Report Fuzhou, China: University Press, 1984, 6-12.
Lindsay, P. H. and Norman, D. A. Human Information Processing: An Introduction to Psychology. New York: Academic Press, 1977.
84
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.
85
Pavlidis, T. "Editorial Papers on Shape Analysis." IEEE trans.on Pattern Analysis and Machine Intelligence 8, 1 (January, 1986):1-2.
Persoon, E. and Fu, K. "Shape Describtion Using Fourier Describtives." Proceedings of the Second International Joint Congress on Pattern Recognition 2 (1974): 126-130.
Pinker, S. Visual Cognition. Cambridge: MIT Press, 1985.Samet, H "Region Representation: Quadtrees from Boundary
Codes." Communication ACM 23, 3 (March 1980): 163-170.Samet, H. "A Top-Down Quadtree Traversal Algorithm." IEEE
transaction on Pattern Analysis and Machine Intelligence7,1 January, 1985): 94-97.
Selfridge, O. G. and Neisser, U. "Pattern Recognition by Machine." Scientific American 203 (March 1960): 60-68.
Stearns, S.D. Digital Signal Analysis. Rochelle Park, NJ: Hayden Book Company, 1975.
Winston, P.H. Artificial Intelligence. 2d ed., New York: Addison-Wesley Publishing Company, 1984.
Ziemer, R. E. and Tranter, W. H. Signal and Systems. New York: Macmillan Publishing Co., 1983.
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.