Detection and Interpretation of Dimensions in

0 downloads 0 Views 18MB Size Report
5.3.5 Outline of the arrowhead detection algorithm . 86. 5.4 Detecting ...... The four image analysis steps, which we shall call "preproce3.sing", have been ...... Although typical drawings may include both text and arrows which do not belong to ...
DETECTION and INTERPRETATION of DIMENSIONS in MACHINE DRAW"INGS

Thesis for the degree of

Doctor of Philosophy

by

D ov Dori

Submitted to the Scientific Council of The Weizmann Institute of Science Rehovot, Israel

December 1987

ii

This work was carried out at the Fac ulty of Mathematics, Department of Computer Science The Weizmann Institute of Scie nce Rehovot , Israel.

T h e academic supervisors were Professor Amir Pnueli and Professor Shimon U llma n .

iii

to my parents

Tova and Elyahu

with love

iv

Acknowledgements

I wish to express my gratitude to my advisors, Prof. Amir Pnueli and Prof. Shimon Ullman for their help. Prof. Pnueli introduced me to the subject of machine understanding of dimensions, and directed me towards the application of the theory of formal languages as a methodology for the description of the dimensioning language. Dr. Yigal Accad and Dr. Tuvia Lamdan have had to bear the burden of reading through my research proposal, interim report, and final report. I am very grateful to Dr. Accad, who pointed out several issues that needed some more clarification in the final report, and invested a lot of his time in reading the final version of the Thesis and commenting on it. To my good friend, Ron Goldring, I thank for the idea of embedding associators within webs, as well as for the careful reading of the Thesis and commenting on its style. I thank Yehuda Barbut, who did an excellent job with the graphics. Finally, I wish to thank my wife Yehudit for her encouragement and support, our three lovely daughters, Limor, Tlalit, and Shiri, for bearing my absence in late hours, and their grandparents Moshe and Rysia for keeping an eye on them.

*

*

Contents Page

Abst ract

1

T hesis Overview

2

List and Meaning of the Main Sym bols

3

PART I: UNDERSTANDING MACHINE DRAWINGS ..

Chapter 1. 1. 1

1.2

1.3

1.4

Machine Vision . . . . . . . 1.1.1 Human vs. machine vision 1.1.2 Relation to other fields 1.1.3 Two and three dimensional representations . Computer Aided Engineering . . . . 1.2.1 Benefits of CAE . . . . . . . . 1.2.2 Paper drawings vs. CAE data-base Classification of Engineering Drawings 1.3.1 Machine design drawings . . . . . . 1.3.2 Architecture, industrial and civil engineering drawings 1.3.3 Electricity, electronics and control drawings 1.3.4 Drawings of other engineering disciplines . Why Machine Drawi ngs ? ..

Chapter 2. 2.1

2.2

2.3

Machine Vision a nd Engi neering Drawings

MD US and Related Work . . . . . . . .

........

.

4

5 5 5 6

8 8

9 9 11 11

12 13

14 14

15

Understanding Machine Drawings and M DUS . . . . 2.1.1 Functional classification of lines in machine drawings 2.1.2 The line classification problem . . . . . . . 2.1.3 The Machine Drawing Understanding System 2 .1.4 The goal of MDUS . . . . . . . . .. . 2.1.5 The MDUS environment . . . . . . . . . . 2.1.6 The Dimension Detection and Interpretation ( DOI) module

15 15

2.1.7

20 20 21 21 22

Specification of the input to MOUS

Handling Noise and Ambiguities . . . . . . . 2.2.1 Noise and its reduction . . . . . . . . . 2.2.2 Human quality control and decision making Pre-processing: from Paper Drawing to Vector File

16

17 17

17 19

vi

2.3.1 Scanning . . . 2.3.2 Enhancement . ,. 2.3.3 Segmentation . •. 2.3.4 Raster to Vector "Fleshing Out Projections" - Reconstructing a Solid Model 2.4 2.4.1 MOUS - the missing link between vector file and recon!>truction Au tomation of Technical Documentation 2.5 Manual Vs. Automatic Input Means 2.6 2.6.1 The OCR analogy . . . . . . . . . .

2.6.2 2.7

Chapter 3.

3.5

28

. 31

32

Dimension-sets Components classification

. . .

3.2.1

Regular dimension-sets

3.2.2

Irregular dimension-sets Phantom Shape components

. 32 . 33 33 34 34 35

36 37 37 38

3.2.4 The Bottom subweb . . . . Associators . . . . . . . . . .

3.3.1 3 .4

DIMENSIONS AND THEIR GRAMMAR

3.1.2 The object-similar components . 3.1.3 The object-dissimilar component.s Kinds of Dimension-sets ..

3.2.3 3.3

27

. .

The Components of Dimension-sets

3 .1.1

3.2

1

Applications of Structu ral Syntactic Pattern Recognition

PART II:

3.1

Hand-printed character recognition

22 22 23 23 24 25 . 25 26 26

.

Embedding the associators in the webs

Types of Dimension-sets . 3.4.1 Types classification . 3.4.2 The complete types . 3.4.3 The incomplete types Line Attributes and Line Description 3.5.1 Line description of dimension-set components 3.5.2 Geometric webs . . . . . . . . . . .

Chapter 4. The Dimensioning Grammar 4.1

The Dimensioning Standard as a Basis for the Grammar 4 .1.1 Standard rules not covered by the grammar 4 .2 Subweb Strips . . . . . . . . . 4 .3 Web Grammars . . . . . . . .

4.3.1 4.3.2

The choice of web grammars Web grammars formalism .

. . . .

40 41 42 43 46 48

49 . 50

52 52 52

54

57 57 57

vii

4.3.3 4.4 4.5

Definition of the Dimensioning Grammar Parsing Dimension-sets According to the Grammar

4.5.1 4.6

How many different dimension-sets are there?

Analysis of the Text Component

4.6.1 4.6.2 4.6.3 4.7

Web rewriting rules

Text locators The Text grammar The characteristic symbols of the Text component

Proper Dimensioning

4.7.1 4.7 .2 4.7.3 4.7.4

58 59 61 66 67 67 68 69 70 71

Right angles and normalons Sides of norma lons Dimension-sets of normalons The Normalon Proper Dimensioning Theorem

72 73 74

PART ill: ALGORITH M S A ND APP LI CATION

. . . . . . . . . . . . . . 76

Cha pt er 5. T he DOI Algorithm 5.1

Outline of the DOI Algorithm

5.1.1 5.1.2 5.2 5.3

The Basic Stage of the Detection Phase Detection of the Arrowhead Component

5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.4

Geometric locations and parameters of arrowheads Preparing candidate side pairs The arrowhead parameter adaptation mechanism Outline of the arrowhead detection algorithm . The "tip" associator as an arrow combiner Combining arrows to arrow-strips Determining the kind of arrow-strips

Detecting the Bottom Strips

5.5.1

5.5.2 5.5.3 5.6

Shapes of Arrowheads .

Detecting Arrow-strips .

5.4.1 5.4.2 5.4.3 5.5

Stages and output of the detection phase The output of the interpretation phase

The "pierce" associator Free and bound edges of a vector The "guide" associator

Detecting the Text Strip .

5.6.1 5.6.2 5.6.3 5.6.4 5.6.5

Assumptions and specifications for the detection of text The hierarchy of objects defining text The "bind" associator and the anticipated wordbox

77 77 78 79 79 80 81 82 83 85 86 87 88 90 90 92 92 93 94 96 96 97 98

Creating text dusters

102

Anticipated-wordboxes of irregular dimension-sets .

104

viii

5.7 5.8

5.9

5.6.6 From word-clusters to words . . . . . . . . . . . . Human Assistance and Verification in the Basic Stage The Adva nced Stage of the Detection Phase . . 5.8.1 Examining unmatched arrows . . . . . . . . . . . . 5.8.2 Finding and examining unmatched word-clusters . . . 5.8.3 Human assistance and verification in the advanced stage The Interpretation Phase . . . . . . . . . . . . . . . .

104 105 105 105 106 107 107

Language and Implementat ion

109

Overview of SPADEL . . . . . . . . . . 6.1.1 Lisp as a Base Language for SPADEL 6.2 Major SPADEL Features . 6.3 The Elements of SPADEL 6.3.1 Objects . . 6.3.2 Computants . . . . 6.3.3 Predicates . . . . . 6.4 The Basic Objects of SPADEL Point: the basic object 6.4. l 6.4.2 Vector: an object defined by points 6.5 Operations on Object Instances 6.5.l The object-maker . . . . 6.5.2 The constituent-retriever . . 6.5.3 The instance-examiner . . . 6.6 Basic SPADEL Functions Involving Points and Vectors 6.6.1 Adjacency of points and of vectors . . . . . . 6.6.2 Comparing length of vectors . . . . . . . . . 6.6.3 Finding the midpoint of a vector or of two points 6.7 Intersections and Projections of Points and Lines 6.7 .1 Finding the intersection between two lines . . . 6.7.2 Finding the projection of point and vector on line .

109 109 110 110 110 111 112 112 112 113 113 113 115 116 117 118 118 119 120

Chapter 6. 6.1

6.7 .3 6.7.4 6.8

Examining the proximity of a point to a line Functions involving two vectors . . . . .

120 120 121 121 122 122

Some Aspects of the DDI Implementation 6.8.1 Arrowheads and Related Associators 6.8.2 Making arrow-strips . . . . . . . . . . 6.8.3 Witnesse.s , Contours, and related functions . 6.9 Sample drawings and their DD I . . . . . . . 6.9.1 The graphic editor . . . . . . . . . . . 6.10 Discussion and Subjects for Further Research 6.10 .1 Subjects for further research and development

131 132

References

134

123 123 124 124

1

ABSTRACT

Currently available CAE systems lack the ability to make use of manually prepared machine drawings. This Thesis presents a. formal methodology for converting such drawings into a computer manipulable representation. A machine drawing consists of a description of one or more projections of an object. The lines in the drawing are classified in this work into object linesi which describe the contour of the object's projection, and interpretation lines, of which those describing the dimensions ("dimension-sets") of the object are of particular interest. Their proper detection and interpretation is basic to the development of a Machine Drawing Understanding System (MDUS).

A Dimension Detection and Interpretation (DDI) module, employing syntactic analysis of dimension-sets, represented by graphs (webs), was developed. Utilizing web grammars, a dimensioning grammar was established, enabling generation, parsing, and detection of dimension-sets. The detection process starts by detecting certain dimension-set components using non-syntactic pattern recognition methods. These serve a.s "anchors11 which, using rewriting rules of the dimensioning grammar, enable detection of the rest of the components of the corresponding dimension-set. The set of detected dimensions is used to determine whether the object is properly dimensioned. An application of representative portions of the DDI algorithm are described and demonstrated.

Key Words: Syntactic Pattern Recognition. Two Dimensional Grammars. 'Web Grammars. Image Understanding. Scene Analysis. Line Drawings. Understanding Engineering Drawings. Computer Aided Engineering. CAD/CA}.!.

2

Thesis Overview

The Thesis comprises three parts. The first, Understanding Machine Drawings, (chapters 1 and 2) provides a background, an overview and a literature review. Chapter 1, Machine Vision and Engineering Drawings, discusses machine vision and vision systems, Computer Aided Engineering ( CAE) and engineering drawings. Chapter 2, MDUS and Related Work , describes the Machine Drawing Understanding System (MDUS), which constitutes the environment for the Dimension Detection and Interpretation (DDI) module. It also includes a survey of work related to various aspects of MDUS. The second part, Dimensions and their Grammar, provides the theoretical basis of the work. Chapter 3, Dimension-sets, introduces the concept of dimension-sets and provides definitions and descriptions of their components, structures, and types. The rules that govern the construction and parsing of dimension-sets are formulated in Chapter 4, The D imensioning Grammar. This chapter also defines normalon3 and specifies the conditions for their proper dimensioning. The third and last part of the work is Algorithms and Application. Chapter 5, The DOI Algorithm, describes the phases, stages, and procedures of the Dimension Detection and Interpretation algorithm. Chapter 6, Language and Imp lementation, describes first the principles and usage of the Spatial Description Language, called SPADEL. It is an object-oriented, Lisp-based language, that has been developed as a basis for the implementation of the DDI algorithm. Finally, Chapter 6 describes an actual implementation of portions of the DDT Algorithm and describes a number of examples. Subjects for further research and development are also discussed in this last chapter.

3

List and Meaning of the Main Symbols C = Contour component of dimension-set. W = Witness component of dimension-set. S = Shape component of dimension-set. [, = Tail component of dimension-set. A= Arrowhead component of dimension-set. T =Text component of dimension-set. n =set of dimension-set components= {C, W, S, £ , A, T}. q, =set of object-similar dimension-set components= {C, W, S , £}. W E q, = some element of q,. CJ= the bind associator. --+ = the tip associator. t>I = the pierce associator. JJ = the guide associator. 1>- = the point associator. A = set of component associators = {CJ, --+ , t>I , _ 0, 1>-}. L = Longitudi nal type of dimension-set. A= Angular type of dimension-set. C = Circular type of dimension-set. D = D iametric type of dimension-set. A= Angular type of dimension-set. H = C h amfer type of dimension-set. 6 = set of types of dimension-sets = {L , A, C, D, R , H} 8 E 6 = some element of 6.. K, =set of comp lete types= {L , A , C, D , H }. /'Ii, E K, = some element of K,. £=set of inco mplete types, = {R , C, D }. c E £ = some element of £. W0 = a component W of type 8. M( W, 8) = line description of W0 To = Text of type 8. T* = Text strip; T/ = Text strip of type 6. A* = Arrowheads strip; A6 = Arrowheads strip of type 8. B* = Bottom strip; 86 = Bottom strip of type 6. Bt = the second Bottom strip of a Longit u d i nal type. Gtl. =Dimensioning Grammar= {Ntl., ~~, P~ , Stl.} Ntl. = set of nonterminals = {S6, 7[,*, B~' , A~, A; , A: , A~ , W0} s6 = starting symbol. E6 =set of terminals= {To, A. M (w, 8); '11 E ~ . 6 E 6} U A Pu. = set of web productions.

B6.

PART I Understanding Machine Drawings

Chapter 1

Machine Vision and Engineering Drawings

This chapter discusses aspects of machine v1s1on, machine v1s10n systems, and tasks they are suited for. First, the relationship of machine vision to the fields of image processing, pattern classification, and scene analysis, which provide techniques for processing images or their symbolic descriptions, is explored. We proceed by describing the development and benefits of computer-aided engineering (CAE) and discussing the problem of the gap which exists between manual design drawings and those produced by a CAE system. Finally, we review the variety of engineering drawings in existence, and justify the selection of engineering machine drawings as a basis for the development of a drawing understanding system.

1.1.

Machine Vision

Vision is man's most powerful sense. It provides us with a remarkable amount of information about the surroundings, and enables us to interact intelligently with the environment, all without direct physical contact. Through vision we learn about the locations and identities of objects and the relations among them. It is not surprising, then, that attempts have been made to give machines a sense of vision almost since the. time that digital computers first became generally available. According to Marr [Ma.82], vision is a process that produces from images of the external world a description that is useful to the viewer and not cluttered with irrelevant information. There is an inherent duality in the study of vision. It includes both the study of how to extract from images the various aspects of the world, that are useful to us, and an inquiry into the representations by which we capture this information and thus make it available as a basis for decisions and actions.

1.1.1

Human vs. machine vision

The duality in the study of vision is true not only for the human vision system,

6

Machine Vision and Engineering Drawings

but also for machine vision systems in general, and for the Machine Drawing Understanding System (MDUS) developed in this work in particular. Beside being powerful, vision is also man's most complicated sense. The knowledge which has been accumulated about how biological vision systems operate, although considerable, is still fragmentary and confined mostly to the processing stages directly concerned with signals from the sensors. It is, however, clear that biological vision systems are extremely complex. It is no wonder, then, that many attempts to provide machines with a sense of vision have ended in failure. A computer vision system is designed to perform the task of vision. As discussed by Rosenfeld (Ro83] in his article Why Computers Can't See Yet, the biological processes in organisms, and especially in the human brain, are far from being fully understood. Therefore, the possibility of imitating these processes is very limited. The desired function of a computer vision system is similar to that of the human vision system, namely, achieving an explicit description of the imaged world, or, in other words, image understanding. Image understanding is a prerequisite for high level cognitive processes such as recognizing, manipulating, and making decisions which concern the viewed objects.

In spite of the gaps in our understanding of the human vision system, significant progress has been made in the development of vision systems, and today one can find vision systems that deal with a dynamic environment as parts of machines. Most progress has been made in industrial applications, where the visual environment can be controlled, and the task faced by the machine vision system is clear-cut. A typical example would be a vision system used to direct a robot arm to pick parts off a conveyer belt. Less progress has been made in those areas where computers have been called upon to extract information either from images that even people find hard to interpret, such as the interpretation of X-rays image of the human lung, or demand human understanding and interpretation, such as engineering drawings and flow diagrams. Computer vision deals with the construction of explicit, meaningful descriptions of physical objects from images, or, in other words, reliable derivation of properties of the world from images thereof. Due to the variety of vision tasks on one hand, and the complexity of the vision process on the other hand , we cannot at this stage build a "universal,, machine vision system. Instead, we address ourselves either to systems that perform a particular task, or to modules that could eventually become a part of a general-purpose system. The Machine Drawing Understanding System (MDUS), with which this work is concerned, is a machine vision system designed to perform the specific task of understanding machine drawings. Although currently it is still hypothetical, MDUS may, in the long run, be incorporated as a module in a universal machine vision system.

Machine Vision and Engineering Drawings

1.1.2

Relation to other fields

Machine vision is closely related to four fields: •

Image Processing.



Pattern Classification.



Scene Analysis.



Artificial Intelligence

Image Processing is largely concerned with the generation of new images from existing ones. Most of the techniques used come from linear systems theory. The new image may have noise suppressed, blurring removed, or edges accentuated. The result is, however, still an image, usually meant to be interpreted by a person. Image processing techniques a.re useful for designing preprocessing modules for machine vision. Such techniques were applied in preprocessing modules of this work, as will be discussed later. Pattern classification deals mainly with classifying "patterns", usually given as a set of numbers representing measurements of an object, such as length or width. Although the input to a classifier is not an image, the techniques of pattern classification are useful for analyzing the results produced by a machine vision system. To recognize an object means to assign it to one of a number of known classes, but recognition is only one of many tasks faced by the machine vision system. This work applies pattern classification, but the input to the classifier is a complex spatial description of the objects which are to be classified, rather than a set of numbers. Scene analysis is concerned with the transformation of simple descriptions, obtained directly from images, into more elaborate ones, in a form more useful for a particular task. Scene analysis is the heart of this work. The analysis is performed on a vector description of the lines of which the engineering machine drawing ("image") consists, which were obtained in the preprocessing stage. Marr (Ma82] proposes that the representational framework for deriving shape information from images by humans consists of three stages: Primal sketch, 21D sketch, and 3-D model representation. In a similar manner, Horn (Ho86] proposes that it is convenient to break the machine generation of descriptions from images into two stages. The first stage produces a sketch, a detailed but undigested description. Later stages produce more parsimonious, st ructured descriptions, suitable for decision making. Processing in the first stage is referred to as image analysis, also denoted early vision, while subsequent processing of the results will be called scene analysis. Since vision systems are expected not only to provide spatial descriptions

7

8

Ma.chine Vision a.nd Engineering Drawings

of the scene from viewed images 1 but also to analyze it', draw conclusions and derive properties of the world, machine vision is very closely related to artificial intelligence (AI). Winston [Wi82) defines artificial intelligence vaguely as the study of idea.s that enable computers to be intelligent. llich [lli83} proposes the following practical definition to artificial intelligence: "Artificial Intelligence is the study of how to make computers do things, at which, at the moment, people are better". This definition provides a good outline of what constitutes artificial intelligence, and it avoids the philosophical issues that dominate attempts to define the meaning of either artificial or intelligence. Vision systems in general and the Machine Drawing Understanding System in particular fall well within the category of AI according to this definition. In fact, machine vision is classified as a branch of artificial intelligence [Wi82), [lli83).

1.1.3

Two and three dimensional representations

Machine vision systems may require either a 2D or a 3D representation of the scene, according to their purpose. Thus, for example 1 an autonomous vehicle vision system, which is designed to recover motion and surface shape from timevarying imagery and is useful in guiding a platform through a known environment, must have some kind of "3D perception" [Ho86), while a robot which performs binpicking of arbitrary flat objects out of a pile using robust curve matching, or a system which is designetj. to understand schematic diagrams [EP86], requires only a 2D description. As discussed in the sequel, MDUS supplies 2D descriptions, which are equivalent to the 2D descriptions in the original document.

1.2.

Computer Aided Engineering

Engineering and industry have been progressing for some twenty years from manual to Computer Aided Engineering (CAE). Industry 's endorsement of CAE is clear: computer aided engineering and computer aided manufacturing systems have introduced unparalleled power into today's design and manufacturing processes. As noted by Jankel and Morton, [JM84], engineering design was one of the first contenders for the sensible application for computer graphics, and the "Sketchpad" experiment [Su65) seemed to point the way forward. However, it was much harder than expected to get useful results. The technology itself was not ready to support wideband or high rate devices, and interactive computing was in its infancy. Nobody knew how to construct a database able to hold the details of a complex design (such as a ship hull) while several designers continued to work on

Machine Vision and Engineering Drawings

it. After a long and quite painful gestation period, computer-aided engineering became a reality and now touches very wide-ranging activities in many different industries. Simple CAE systems, which a.re used mainly for drawing, operate on the 2D level, sometimes expecting the human operator to indicate the same entities in various projections. Other1 more advanced systems, operate on the 3D level. They maintain 3D descriptions of the objects that were designed, allowing 2D views to be derived.

1.2.1

Benefits of CAE

Today, the benefits of fully integrated CAE systems are well understood and accepted in practically all the engineering fields. The main reasons for the trend to move from manual to computer-aided engineering are the following: •

CAE helps cope with complexity. An aircraft, a computer, an integrated circuit have in common a bewildering amount of important detail which designers must create and control, and manufacturers must reproduce and test, and for which a slight mistake could spell disaster. The computer can keep track of such detail and verify that no mistakes have been made.



CAE speeds up and simplifies modifications, saves much of the experimentation required during product development, and provides methods for analysis and synthesis. Much design involves some variant of the cut-and-try method, in which the designer changes something and then assesses the change. In many applications, this costly and time-consuming process can be reduced significantly by CAE.



CAE coordinates the efforts of many designers. When working with paper drawings, there is the constant danger that incompatible changes will be made by different designers on their separate drawings, a problem well known to configuration managers. With shared and controlled access to a single version of the prime data held in a computer database, this danger is greatly diminished.



CAE methods offer advantages in mass production and quality control.

1.2.2

Paper drawings vs. CAE data-base

As Jank.el and :vlorton note [JM84], we might have expected that one effect of the widespread adoption of CAE methods would be the elimination of paper

9

10

Machine Vision and Engineering Drawings

drawings and printed documents. This has not happened, and it is unlikely to, at least in the near future, although there are important changes in the "status" of paper materials. What used to be the master drawings, needing manual authority for change, copy and issue, are now entries in the computer database. In some cases they may not even be represented as drawings at all; instead, specific drawings will be derived as needed from the model of the product being processed held in the computer. This, however, is a fairly modern idea. In the more common use of computer-aided drawing, each drawing has the same individual existence inside the computer as the paper sheet master once had, and in many cases still has, in the drawing office. Useful work can be done simply by helping the designers making drawings more quickly. Indeed, this was the main objective of several commercially successful systems, although a comprehensive approach to CAE must aim at much more than that. Modelling the object, instead of just holding drawings thereof, makes possible the derivation of all kinds of useful information such as volume, weight, strength, interaction with neighboring parts, etc. The interpretation of the set of drawings which describe a product requires expert knowledge and the background of an engineer, as noted in [JM84]. "It i3 possible, they add, that, U3ing the technique" of artificial intelligence1 a computer could extract the nece3sary information from the drawing.,, but it would be an extremely odd way to proceed) when the information could all have been made available to the machine at the 3tage of generation - hardly an efficient 'USe of resources!". This statement is correct only with respect to products whose design already started using a CAE system. This, however, is frequently not the case; one of the serious obstacles, which has been hindering a more rapid migration process from manual to computer-aided design is the accumulation of numerous manual technical documents, mainly machine drawings, which describe existing products. Most CAE users have discovered a wide gap in their ability to apply CAE power to existing designs and products, because their manually prepared drawings are not in the database. In addition, the fl.ow of hard-copy design data from suppliers and subcontractors must somehow be diverted into the CAE system. To illustrate the magnitude of the task of supporting a typical large scale document set, a Canadian feasibility study on technical documentation automation, which was carried out at the Atomic Energy of Canada Limited by Karima et al. (Ka85], indicates that a typical project document set includes approximately 30,000 technical documents, with design lives ranging from 10 to 40 years. Considering that only 25% of these documents are estimated to be active, the problem is apparent. Many industrial companies have tens of thousands of designs which exist

Machine Vision and Engineering Drawings

only in hard-copy form. To re-create these designs on a CA'E system has been an impractical, resource consuming task, that most firms have averted. Thus, industrial organizations, which are interested in the benefits of the use of a CAE system, must nevertheless continue to support manual archives of a considerable size. These collections of documents contain important information on products which the firms are committed to support. Concurrent, but separate, management of both CAE and paper databases has hampered overall engineering and design productivity. Many of the paper machine drawings are still active and operational, and there is a demand for a fast and reliable means of transforming them to digital information, which can readily be incorporated as a part of CAE data-base management systems.

1.3.

Classifi cat ion of Engineering Drawings

Engineering drawings constitute the core of most of the technical documentation, because they contain precise graphical descriptions of objects, whose verbal description is imprecise and inefficient. These drawings have been produced by humans to be viewed and interpreted by humans, and hence require scene analysis capabilities, i.e. both visual capability to perceive the data, and intelligence to understand and interpret it properly. Engineering drawings represent models of objects that a.re meaningful only for trained individuals, who understand drawing rules and symbolism well enough to form a mental picture (or "world model") of the object. Proper intelligent interpretation is the basic problem which underlies understanding of engineering drawings, as well as other technical documents, such as schematic diagrams, which are treated by [EP86]. The variety of engineering disciplines is reflected in the various categories of engineering drawings, which differ in the nature of the objects they describe, in the standards and conventions they follow, and in design lives. The majority of engineering drawings may be classified into three categories: 1.

machine design (or mechanical engineering) drawings,

2.

architecture, industrial, and civil engineering drawings, and

3.

electricity and electronics drawings, and

1.3.1

Machine design drawings

This is probably the largest and most rigidly performed set of engineering documents. Drawings of this group follow mainly one of two accepted standards,

11

12

Machine Vision and Engineering Drawings

which dictate mainly the mode of dimensioning, layout of the projections and accepted symbols. These standards are the ISO (International Standard Organization) and the ANSI (American National Standard Institution) dimensioning standards.

.... ,.. '° (\I

..

oo

-(\j

Figure 1. An example of a machine drawing

The group contains drawings of virtually all the mechanical and mobile objects, that have been designed by humans (except, of course, those designed already by CAE systems), ranging in size and complexity from small nuts to huge vessels. An example of a machine drawing is depicted in figure 1. The common goal of all the drawings of this category is to describe precisely the spatial geometry of the object, as far. as this is necessary to ensure its proper manufacture and operation. Machine drawings belong to the class of line drawings. Line drawings, as defined by {Sg86], are based on the physical results of the imaging process, that is, projections of three-dimensional scenes onto two-dimensional planes, and hence they reflect configurations of three-dimensional structures directly. Machine drawings are a special case of line drawings in the sense that a typical object in a machine drawing is described by its three principal (orthogonal) projections, but, contrary to non-engineering line drawings, it contains additional lines which are aimed at providing a precise geometric definition of the object. The projections may also be accompanied by sections, isometric views and textual remarks.

1.3.2

Architecture, industrial and civil engineering drawings

This group of engineering drawings includes drawings of projects of the nature of buildings, roads, bridges, tunnels, plant layouts etc.

Machine Vision and Engineering Drawings

r•so

~

0

IC'

.zt,'~ !JI

. '5

~ 0

q~

i

MO

Zos

~1~ Vl 0

I

Figure 2. An example of an architecture drawing

The rules for creating this kind of drawings are not as rigid as those for machine design drawings, and engineers in these fields generally adopt a more individual, less standard drawing style (see figure 2). In general, civil engineering, as well as industrial engineering projects are unique in nature, and are not repeated in other instances. Once a project of this category is terminated, its drawings are much less frequently referenced than those of a machine design drawing.

1.3.3

Electricity, electronics and control d rawings

Drawings of this category include electric wiring and electronic circuitry, logic design, chip layout, control lines, etc.

li!58 9001j , while the right Arrowhead pierces a Witness, which in turn, guides to the second Contour, using the guide associator, _[], In the geometric web, each '116 is replaced by the corresponding entry of table 7.

4'30

Figure 25. An asymmetric irregular circular dimension-.set and its webs

As another example, an asymmetric irregular circular dimension-set with two compound Bottom subwebs and its web and geometric web descriptions are provided in figure 25.

*

*

*

51

Chapter

4

The Dimensioning Grammar

The dimensioning grammar is an instance of web grammars. It provides a theoretical basis for the Dimension Detection and Interpretation algorithm, for it enables the various kinds and types of dimension-sets to be constructed and parsed. The chapter starts with a discussion on problems involving the translation of the dimensioning standard to a formal language and the choice of web grammars as an appropriate tool for formulating the rules underlying the dimensioning language. After introducing a decomposition of webs describing dimension-sets into strips, we provide a formal definition of web grammars. We use this definition to specify the dimensioning grammar and we exemplify how it can be used to construct and parse several dimension-sets. We then discuss various aspects of the recognition of the Text. The Text sub-grammar is defined and illustrated, and we show how it can assist in the recognition of the type of dimension-set. Finally, special polygons termed normalons, which are common in machine drawings, are defined, and the conditions for their proper dimensioning are specified.

4.1.

The Dimensioning Standard as a Basis for the Grammar

The basis for the dimensioning grammar is the ISO standard for dimensioning, [IS059). The main problem with translating a document of this nature to a formal description, amenable for computer manipulation, is the fact that the standard was written by people for the wie of people. Since humans are generally good at learning from examples and deducing general rules thereof, considerable portions of the standard are provided as illustrations, to which the reader is referred. There are no definitions for many terms which are basic for this work, as it is assumed that the reader understands their meaning from the examples. Thus, for example, the section called "Performing Methods" starts by stating that auxiliary lines and dimension lines are drawn in full thin line, addressing the reader to a figure, from which he is supposed to deduce that "auxiliary lines" are the two lines defined in this work as Witnes.ses, and that a dimension line is the line defined as Shape.

The Dimensioning Grammar

4.1.1 Standard rules not cove red by the grammar The grarrunar covers most of the dimensioning rules allowed by the standard. However , there is a small subset of cases, which are allowed by the standard but not covered by the grammar. The frequency of all these cases together is estimated to be about 0.1%. Three significant cases from this subset are described below.

Figure 26. An example of a witness which is not co-linear with the Contour.

The first case occurs in certain situations, such as dimensioning the diameter of a cone in a specific location along its a.xis, as in figure 26, where a situation is permitted in which the Arrowhead is not perpendicular to the WitnesJ, and the WitneJJ is not co-linear with the linear Contour. These are two major violations of the spatial relations defined by the pierce , t>j , and g·uide, _.D, associators, respectively. Generalizing the spatial relations so as to include this case would require a major effort and complication of the model.

0

Figure 21.

CD

Multiple dimeruion-setJ which use the same origin

53

54

The Dimensioning Grammar

The second case occurs when numerous dimensions have to be specified along one line. In such cases, multiple dimension-sets may use the same origin, which is denoted by 0 near a thick dot, and the Text (value) of each dimension is recorded near the corresponding arrow, as shown in figure 27.

0

20 60 90 120 160

Figure £8.

Dimen.sion-.set.3 recorded in coordinate.s

The third case occurs when the designer wants to specify the locations of points on a plane, such as centers of holes to be drilled in a plate. In such cases, dimensionsets may be recorded in coordinates, as demonstrated in figure 28. Although it is possible to devise special components (such as a thick dot) and productions which will apply for the above two cases, this would complicate the grammar considerably. This complication is not justified in view of the fact that these cases are very scarce in regular machine drawings.

4.2.

Subweb Strips

To devise efficient rewriting rules of the dimensioning grammar, webs are decomposed into three or four subwebs, which are called "strips,, because of their linear representation. The strips are the Text strip, T*, the Arrowheads strip, A\ and one or two Bottom strips, B*, introduced in Chapter 3. The complete types of dimension-sets have two Bottom strips, hence they are decomposed into four strips, while the inco mplete types, which have only one Bottom strip, are decomposed into three strips. The strips are used as building blocks that construct dimension-sets, and play a major role in the DDI algorithm.

The Dimensioning Grammar

T*:

A*: -----+

13*:

Figure

~9.

~

The decomposition of a regular symmetric dimension-set into strips

T*:

~

lol

A*: 13*:

Figure 30. The decomposition of a regular asymmetric dimension-set into strips

The choice of the specific decomposition of webs into strips is motivated by the similarity of the analytic strips to their actual manifestations, as demonstrated in figures 29 and 30, for the regular symmetric and asymmetric webs, respectively. Irregular symmetric and asymmetric dimension-sets are decomposed into strips in a similar manner. In all the four cases, the Arrowheads strip constitutes the link between the Text strip and each of the two Bottom strips.

55

56

The Dimensioning Grammar

Figure 91. A unified representation of the complete dimension-set3

In terms of strips, all the four kinds of complete types of dimension-sets can be represented by the same web, drawn in figure 31. The differences between the kinds stem from differences in the structure of A* and in the node of A* to which T* is associated.

Figure 32. The structure of the regular (top) and irregular symmetric Arrowheads strip, A;

The symmetric A* is denoted A; and is described in figure 32 for the regular and irregular cases. 1n both cases, the node of A* which is connected to T* is S.

Figure 99. The structure of the regular (top) and irregular asymmetric Arrowheads strip,

The asymmetric A* is denoted A~ and is described in figure 33 for the regular and irregular cases. Here, the node which is connected to T* is .C.

Figure 34. A unified representation of the incomplete dimension-sets

A~

The Dimensioning Grammar

The incomplete types have an analogous unified strip representation, which is shown in figure 34. The incompleteness of these types is clearly illustrated here by the lack of one Bottom strip. Since the Text and the Bottom strips of the complete types differ from those of the incomplete ones, we denote them by the subscripts r;, and c:, respectively. 76* denotes the Text strip of a dimension-set of any type 5.

4.3.

Web Grammars

Since dimensions in machine drawings describe two-dimensional ( 2D ) pro jections of three-dimensional objects using a set of rules, it seemed reasonable to assume that these rules constitute some kind of formal language. We therefore tried to find an appropriate tool to describe these rules within the area of grammars of formal languages.

4.3.1

The choice of web grammars

Attempts to apply conventional, one-dimensional, phrase-structure string grammars (also called "linear grammars"), for the task of describing the dimensioning language have been successful only to a small extent. Using this type of grammar it was possible to describe only incomplete types of dimension-sets , whose components and associators can be arranged in one string without any ramifications. For the bulk of complete dimension-sets, a string can describe the sequence of components and associators leading from the Text to only one of the two Bottom strips, but not both of them simultaneously. It therefore became evident that it is inevitable to apply some kind of a 2D grammar, which allows constructs more complex than just strings. Surveying several existing types of 2D grammars, web grammars, proposed by Pfaltz and Rosenfeld [PR69], were found to be the most adequate tool for the task at hand.

4.3.2

Web grammars formalism

following is a brief presentation of web grammars [PR69] , using the customary definitions and notations, as presented by Gonzalez [GT78], Fu [FU82], and Rosenfeld and Kak [RI-,

~ ,_O} is the set of associators, with A EA.

The dimensioning grammar is the four-tuple Gl:l. = {Nf::l. , E6,, Pil, Sf::l.}, where NA= {Sf::l.,

76*, B'S,

Bt, A~ , A;, A:, A~ , 1¥ 0 } is the set of nonterminals,

Sl:l. E NA is the starting symbol, El:l. ={Tr,, A, M (w,8);

w E ~,

8 E 6.} U Ais the set of terminals, and

Pl:l. is the set of web productions specified in table 8, which is constructed according to the conventions of web gTammars discussed in the previous section. vVe omit the embedding specification f and instead use the term "normal" to denote situations in which there is no ambiguity in a rewriting rule. A vertical bar, I, stands for the Boolean operation "or". The f3 column includes the production number (parenthesized) and the production name. Production (1) produces from the start symbol, S 01 one of three possible strip web representations: Longitudinal, complete, and incomplete. The distinction between the Longitudinal type and the rest of the complete types has to be made because while for the Longitudinal type each of the Bottom strips, B~ and B~' may independently be either simple or compound, the two Bottom strips in the rest of the complete types must be the same; either both Bottom strips are simple, or both of them are compound. This is expressed by productions (7) and (8).

59

60

The Dimensioning Grammar

I

/3 s~

~ '

normal

{1) Longitudinal/complete/incomplete split

~

T.· s

/ (D , Ts"' ) = {A: , A; }

{2} Text strip expansion

A·3 IA•a

A·I
j }

(5) regular/iffegular asymmetric split

0-B-0 1CR A·t:

J (Ct: , A;)= {'J6'" , D} / (A , A;)= {B; , l>j}

(6) truncated/radial incomplete split

B'"L IB*' L

0-g] I ~

! ( l>j

, 8~)

=

{A~ 1 A }

{l} Longitudinal Bottom expansion B*I
j , B; ) = {A ; ,A }

{9) incomplete Bottom expansion

W.s

M (w, 6) {10} Line description assignment

normal

Ta ble 8. T he web productions of the dimensioning grammar

The Dimensioning Grammar

The condition K. # H in production (5) implies that Chamfer type is only asymmetric, while t he condition K. # H in production (8) implies that C hamfer type can only have two compound Bottom strips, as discussed in Chapter 3. By production (9), the Radial type can only have a simple Bottom strip, while the two truncated types, Circular and Diame tric, can only have a compound Bottom strip.

4.5.

Parsing Dimension-sets According to the Grammar

Ge:., is constructed such that it is capable of parsing and generating all the dimension-sets which are legal according to the dimensioning standard, except those discussed in section 4.1. Parsing based on Ge:., can therefore be used to determine whether or not a given target web is a sentence of L(Ge:.,), i.e. is a legal dimension-set. GD. can also guide a search for additional components of a dimension-set being detected, when at least one of them (e.g. Text) is already known . The parsing is carried out top-down; we start with the start symbol, SD., and successively apply productions of Pe:.,, until either we succeed in producing the target web, or reach a situation in which no production can be applied which eventually yields the target web. To gain insight into the way the parsing is performed we show the parsing of two dimension-sets. 20.5

Figure 35. A regular symmetric Longitudinal dimenJion-set with simple {left) and compound Bottoms.

We first consider the regular symmetric dimension-set of figure 35, whose web structure was shown in figure 24. The series of rules that yield the corresponding geometric web appears below. The numbers above the production (rewriting) arrows denote production numbers as they appear in Table 8, while the arguments or explanations for specific choices within each production are written below the arrows.

61

62

The Dimensioning Grammar

(1) dimension-set Is Jongitud/nal

{2}

(3)

-+

Text

strip expansion

dimension-set Is symmetric

(4) dimension-set Is regular

(7) simple Bottom · expansion

The Dimensioning Grammar

(7) --+

compound B o ttom expansion

(10} Line Description assignment

Figure 96. The series of productions that yield the dimension-set of figure 95.

The terminal geometric web at the bottom of figure 36 is a representation of the dimension-set of figure 35. The existence of two f functions for each of the three productions 4, 5, and 6, in which A;, A~, and A;, respectively, are expanded, is due to the fact that each Arrowheads strip associates two types of strips: one Text strip and one or two Bottom strips. Each of these two types of strips has its own J function. The presence of more than one element in each of the sets on the right ha.nd side of J enables the application of productions in an arbitrary order.

63

64

The Dimensioning Grammar

Figure 91. An irregular asymmetric Circular dimension-set

To demonstrate this, consider the asymmetric irregular Circular dimension-set with the two compound Bottom strips in figure 37 and its web description in figure 25. One of the many sequences of rewriting rules by which it can be produced is the following:

(1) --+

dimension-set Is Circular

-

(8)

(3)

B ottoms are

dimension-set

compound

Is asymmetric

The Dimensioning Grammar

(2)

(5)

---+ Text strip expansion

---+ strip Is assymetrlc

{10} Line Description assignment

Figure 38. The series of productions that yield the dimension-set of fig. 31.

The change from the subscript Sor K., which denote the type of the dimensionset, to the actual type subscript (such as C in figure 38) is done whenever a strip symbol (such as B~ or 76* or A;) is replaced by its expansion. Once a certain subscript is set for some component, it should be the same for the rest of the components, otherwise we could have generated an illegal web that involves more than one type. This is the reason why we preferred the set notation for 8, K, and c to productions such as c; -+ c, D, R ; the latter possibility can lead to illegal webs containing components of more than one type of dimension-set. Since complete non-Longitudinal dimension-sets have either two simple or

65

66

The Dimensioning Grammar

two compound Bottom strips, the expansion of the two Bottom strips in figure 38 was done using the production (8) complete Bottom expansion only once, while in the previous example (figure 36) we had to use production (7) Longitudinal Bottom expansion twice. The possibility of parsing a given dimension-set in more that one sequence of productions has the advantage of flexibility which may be useful in the process of recognition of dimension-sets.

4.5.1

How many different dimension-sets are there?

Since the dimensioning language L( Gt:.) is clearly finite, we use Gt:. to compute the magnitude of the language it generates, which is also the number of different instances of dimension-sets. For this sake we consider as different only line descriptors which differ in their geometry attribute, ignoring possible variations in length, width, and font of the object-similar components, as well as differences between dimension-sets which stem from the two different ISO and ANSI styles of binding the Text. We start by enumerating the complete, non-Longitudinal dimension-set instances. By production ( 4) there are 2 different symmetric Arrowheads strips. By production (8) each of these dimension-sets can get a pair of either simple or compound Bottom strips. Since there are 4 types of complete, nonLongitudinal dimension-sets, we get 16 instances of symmetric, non-Longitudinal dimension-sets. By similar considerations we get 16 asymmetric instances, but 12 of these (all except the Angular), can have two different Tail geometry attributes (straight and broken), so there are (16-12)+12x2=28 different asymmetric instances making a total of 16+28=44 different complete, non-Longitudinal instances of dimension-sets. As to the Longitudinal type, since we consider different Contours, we note from the Line Description Table M (table 7), that each CL can independently be straight (a vector), circular (an arc), or a point, yielding 6 different combinations of Contour pairs and 9 different ordered pairs of Contours. By production (7), for each of the 2 symmetric Arrowheads strips of L there are 3 complexity combinations of pairs of Bottom strips (simple/simple, simple/compound, and compound/compound), yielding 6 instances. We multiply this number by the 6 different combinations of Contour pairs and get 36 different symmetric Longitudinal dimension-sets. For each of the 2 asymmetric Arrowheads strip there are 4 different ordered pairs (because of the asymmetry, simple/compound and compound/simple are different combinations), yielding 8 instances, which, when multiplied by the 9 ordered

The Dimensioning Gr ammar

Contour pairs and by 2 different Long itudinal Tail geometry (straight and broken) yield 144 different asymmetric Longit udinal dimension-sets. The number of Longitudina l dimension-sets is therefore 36-t144=180, and the number of co m ple te climension-sets is 44+180=224. Adding the 5 inc o mplete dimension-sets and subtracting 7 non-existent C h a mfe r dimension-sets, we obtain the total of 222 different instances of climension-sets. The magnitude of the dimensioning language demonstrates the power of G~ which is capable of producing all these variations in spite of the fact that it does not posses the recursive property, which is quite common in grammars. Admittedly, many of the 222 dimension-set instances are extremely r are in actual machine drawings, but they are still legal according to the standard and have to be accounted for.

4.6.

Ana lysis of t he Text Co mponent

The Text is the component which expresses the type and the value of the dimension described by the climension-se t. Therefore, reading and interpreting the Text properly is required as a part of detection and interpretation of dimensionsets. The Text stores the information on the magnitude of the dimension which the designer meant to state (the "nominal" climension), whereas the Shape represents only the approximate (usually scaled) dimension, which can sometimes deviate considerably from the nominal value stated in the Text. Knowing the nominal dimension enables a comparison with the one measured from the drawing and, if required , alert the user in case of inconsistency. Studying the internal structure of the Text and its specific symbols may also be of considerable contribution to the understanding of the type of the dimension-set, and hence guide further search. The string of symbols of the Text must contain at least one digit, and it may contain characters in addition to the numerals. The most frequent characters are those which denote R adiu s ( 11 R" in ISO drawings and "RAO" in ANSI drawings) and DIAme t er ( "0 ,, in ISO drawings and " DIA" in A~SI drawings). The Text may consist of more than one string of alphanumeric characters. This happens when, in addition to the nominal value, the Text also includes tolerance, which states the maximal positive and negative deviation from the nominal value allowed by the designer. For example, the ISO standard Diametric dimension +0.25 0 157.85-0.15

means that the nominal diameter dimension of the item describf>d in the drawing is 157.85, and that it may range only from 157.70 to 158.10 in order that the item still be acceptable.

67

68

The Dimensioning Grammar

4.6.1

Text locators

In order to be able to express the location of the tolerance relative to the nominal value, while avoiding the usage of a multi-dimensional grammar, we define two text locators, which are operators defining the location of text pieces relative to each other. table: na me

symbol

defi nition

superscriber

/\

1i, /\ Te

tower

l=i

T,,l=iTe=~

= 7i,Te

Table 9. The text locators and their definitions The two text locators are defined in table 9. The following example illustrates the effect of the text locators:

R87 .50 /\ (( +0.05)

~

+o.os

(-0.025))

= R87 .50 -o.02s

Determining the precedence of the locators, such that !=i precedes /\ and all the other symbols precede both, the parentheses in the last expression may be omitted:

R87.50 t\ +0.05

4.6.2

~

+0.05

-0.025 = R87 .50 -o.02s

The Text gramma r

The legal sequencing of the Text symbols in the Text strings and their location relative to each other can be determined by a grammar called the Text grammar and denoted G7. Since G7 produces Text, which is a component participating in the dimensioning grammar, this grammar is referred to as a .sub-grammar of the dimensioning grammar. The Text grammar is defined as the four-tuple

where the following expressions in square brackets are ANSI standard or other customary substitutes for the ISO notations,

The Dimensioning Gr amma r

N7

= {S7, C, L, Q, lvl, I} is the set of nonterminals,

S7 E N7, is the starting symbol, = {d, . , +, - , ±, R[RAD], 0(D IA], is the set of terminals, and

~T

0

,

x 45°(CHAM], /\,

l=I}

P7 is the following set of productions (rewriting rules): P7

= {S7

-+

c I L I RL

I 0L,

C-+ M I Mx 45°, L -+ ]VJ I M /\ QM I M /\ +]VJ 0

l=I

-NI[ M

l=I

NI I ]VJ M

l=I M],

Q-++1-1±, M-+ I I I.I IO.I[ .I]' I-+ d I Id} In this context, dis a digit: d E {O, 1, 2, 3, 4, 5, 6, 7, 8, 9}, I is an integer , that is, a string of d's (without a decimal point), Nf is replaced by a number (which may include a decimal point), Q is replaced by one of the signs +, - or ±, L is replaced by a string, which may contain Q and text locators, and C is replaced by Iv! concatenated either to 0 or to x 45°. As an example to the application of G7, the terminal expression +0.05

R87 .50 -0.025

which is Ta , is obtained by applying the following sequence of rules of P7: S7-+ RL -+ R lvl /\ +lVI l=I -lvl -+ RI.I/\ +I.I l=I -I.I -+ RI 7.I 0 /\ +0.I 5 l=I -0.I 5 -+ R87.50 f\ +0.05 l=I -0.025 Considering the precedence and effect of the Text locators f\ and expression is exactly equivalent to the original one: R87.50 /\ +0.05

l=I

+o.o5

-0.025 = R87.50 -0.025

I=!,

the last

69

70

The Dimensioning Grammar

4.6.3

The characteristic symbols of the Text component

Using GT it is possible to determine whether a detected set of symbols (presumably recognized by some character recognition method; see Chapter 2) constitute a Text component of some dimension-set. 76, the Text component of each dimension type has a terminal characteriJtic string of terminal symbols, which is appended to the string by applying a specific Text production rule.

o

75

Characteristic St ring

GT Production Rule

Type of Text ,

S--. L

Longitudinal, TL

S--. RL[L RAD]

R a dial, TR

R (RAD]

S--. 0 L[L DIA]

C irc u lar , Tc

0 (D IA]

S--. 0 L[L DIA]

Dia m etric, T0

0 [DI A]

c-

Angular ,~

JvJO

C--. x 45°[CHAM]

C h a m fe r ,

'lit

-

0

x 45°[CHAM]

Table 10. The correspondence between text production ruleJ and dimenJion typeJ

Table 10 lists for each type the production rule of PT, whose application appends the characteristic string of symbols along with the characteristic string. If the individual text symbols in a detected sequence are recognized, it is possible to determine already at an early stage not only whether the recognized sequence is a Text component, but also the type of dimension-set to which the Text belongs. Using this knowledge, we can determine the sequence of productions Pt>. of Gt>. to be applied. Thus, for example, if some Text has been recognized to be TR (the Text of a R a dial dimension-set) then the P6 sequence (1), (2), (6), (9), and (10) should be employed.

4.7.

Proper Di mensioning

The dimensioning of the contour of any projection should provide a complete specification of its geometry. This means that the location of all the contour's points, vectors (line segments) and arcs in an arbitrary Cartesian coordinate system can be determined by the dimensioning. At the same time, the standard demands that no dimension which can be computed from other dimensions should

T he Dimensioning Grammar

be sp ecified*. In other wor ds, a dimension can be determined in only one way; either it is stated explicitly by a dimension-set or it can be computed from other dimension-sets. T he motivation for this demand is t hat it compels the designer to specify the dimensions which are the most important from a. functional p oint of view and eliminates possible contradictions, especially when tolerances are involved. We say that a contour of an object is properly dime ns io n ed if its dimensioning completely define its geometry and no dimension of the contour can be determined in more than one way.

4. 7 .1

Right angles and normalo ns

Right angles are so frequent in machine drawings, that goo is implicitly accepted as the default angle, and is never specified explicitly. Moreover, this convention is so inherent that it is even not mentioned in the standard. Another tacit convention is that the dimension to a set of sides, all of which are collinear, is only stated once. Making use of the fact that right angles are so widespread, we define a normalon as a polygon which has the property that t he angle between any two of its adjacent sides is goo. Many contours of object projections have the shape of a normalon. Many other contours, which are not strictly normalons , can be decomposed into a normalon and one or more other segments, which contain arcs and non-horizontal or non-vertical sides.

• Two exceplions for this rule are permilted. The first is "in case the computation of t he missing dimension is facilitated" . In lhis case the dimension should be parenthesized and not include tolerance. The second case is "'reference'' dimension which is provided only for orientation and should be accompanied by the letters " REF" and nol include tolerance. To keep the treatment. from becoming tedious we assume thal these exceptions are not applied.

71

72

The Dimensionimr Grammar -

,._

20

,, ;

IO

-

45

-



_ Q

IO

~

~ t

I

---

... -

t

IO

-

0

~

10

IO rt)

-

0

0

(\J

(\J

~

15

1lr

t

25

Figure S9. Properly ( left) and improperly dimen.sioned n ormalon.s

The two polygons drawn is thick lines in figure 39 are examples of normalons. Because of the importance of n ormalons we examine closely their properties, and state and prove the "Normalon P roper Dimensioning" theorem, which specify the condition for the proper dimensioning of normalons.

4.7.2

Sides of normalons

The sides of a normalon are divided into two groups: horizontal sides and vertical sides, such that all the sides within each group are parallel and each side in one group is perpendicular to all sides in the other group. ·The choice of the names of the two groups is arbitrary. By the definition of normalon, the number of its horizontal sides and vertical sides is equal. The example on the left of figure 39 shows a normalon which has 7 horizontal and 7 vertical sides. We denote by

and

V

= {V1,

v2, ...

vt}

the sets of t horizontal and t vertical sides of a normalon, respectively. The total number of sides in the normalon is 2t. Each of the sets H and V is respectively divided into h (2 :::; h :::; t) and v (2:::; v :::; t) mutually exclusive subsets Hi, (2 :::; i:::; h) and Vj, (2:::; j:::; v) of collinear horizontal and vertical sides. Thus, h

H =

LJ Hi, i=l

h

with

L IHd = t i=l

The Dimensioning Gr ammar

and u

V

=

LJ Vj, j=l

u

with

L

!Vil

=t

j=l

where IXI denotes the number of elements in set X. For example, the left normalon in figure 39 has t = 7, h = 7, and v = 6 (two vertical sides are collinear). Each subset Hi has the property that all its sides are collinear, and therefore the dimension {distance) between each of its sides and another subset Hj is equal. The same applies for each Vi.

4.7 .3

Dimension-sets of norm aIons

All the dimension-sets of a normalon are of the Lo ngitudina l type. A dimension-set of a normalon is called horizontal (vertical) if it describes the distance between two horizontal (vertical) sides. Note that the Shape of a horizontal dimension-set is vertical and vice versa. We denote by dh (dv) the nwnber of horizontal (vertical) dimension-sets in the normalon.

A horiz ontal (vertical ) dimen s ioning g r a ph of a normalon is a graph in which each dimension-set Dk/ is an arc connecting nodes (sides) k E Hi (Vi) and l E Hi (Vj); 2 :5 i,j < h(v); j :/= i.

A geom et ric di me n sioning grap h is a dimensioning graph whose nodes are located in the mid-points of sides k and l of the previous definition.

73

74

The Dimensioning Grammar

-,

I

r

_J

I

r--1

I

I L

I I

L

I __ JI

,------,

I I I

I

L_ - __ .J

I

L ____ J

Figure 40. Horizontal (top) and vertical geometric dimensioning graphs of the normalons of figure 99

Figure 40 shows the horizontal and vertical geometric dimensioning graphs of the two normalons of figure 39. Each node is the mid-point of the side which is a Contour and each arc stands for a dimension-set between two Contours.

4. 7 .4

The Norma Ion Proper Dimensioning Theorem

The conditions that a normalon should satisfy in order for it to be properly dimensioned, is stated by the following theorem. The "Normalon Proper Dimeruioning" Theorem

Let N be a dimensioned normalon and let Gh(N) and Gv(N) be its horizontal and vertical dimensioning graphs, respectively. N is properly dimensioned if and only if (1) both Gh (N) and Gv(N) are trees, and (2) the union of the sets of horizontal and vertical sides which are Contours and their collinear sides form a closed loop. Proof

A tree is a graph which has the following two properties: (1) it is connected, and (2) if n and a are the numbers of its nodes and arcs, respectively, then a = n-1. These two properties imply that a tree has no closed loops. Since the selection of horizontal and vertical graphs is arbitrary, whatever we claim about one of them holds also for the other. we shall therefore refer only to the horizontal gTaph. Since the distance between each two sides within each subset Hi of horizontal collinear lines is 0, there is no need to specify these distances. For Hi; 1 < i ::; h. we

75

arbitrarily select a representative side and denote it by ri We denote the dimension (distance) from r i to r j by Determining d( r i, r j) in N is equivalent to finding a path from node r i to node Tj in Gh(N). Since a tree is the only graph which determines a unique path between each pair of nodes, it is also the only possible graph which can represent proper dimensioning of the set of horizontal sides which are Contours. This proves that a tree is a necessary condition for proper dimensioning of both horizontal and vertical sides. However, it is possible to construct a tree in which one or more of the sides of N which are not collinear with any side which is a Contour are not nodes. Therefore horizontal and vertical trees are not sufficient for proper dimensioning. To ensure the inclusion of at least one representative of each collinear subset condition (2) must be specified, for if even one side is missing from either the horizontal or the vertical set, it prevents the possibility of forming a closed loop from the union of all the sides. Using the dimensioning tree of a properly dimensioned normalon it is possible to determine the distance d(ri, rj) between any two sides ri and rj of the normalon. To do so we have to find the (unique) path in the tree between r i and r j. If the length of the path is k; 1 :::; k :::; h, then the distance is the sum j-i-1 d(r1, Tj)

= d(ri, r1+1) + d(ri+I. ri+2) + ... + d(rj-1

1

r;)

=

L

d(ri+ki ri+k+d

k=O

where rm; 1 ~ m $ k are the nodes (sides) along the path. Some of the distances in the sum are negative. To determine which distances have to be subtracted rather than added we define arbitrarily a positive direction along an a:x.-1s which is perpendicular to all the horizontal sides. If by going from rm to rm+l we move towards the positive direction then d(rm, T'm+l) is positive, else it is negative. The same task can be done by inspecting the geometric dimensioning tree.

*

*

*

PART III Algorithms and Application

Chapter 5

The DDI Algorithm

This chapter describes the Dimension Detection and Interpretation algorithm. We start with an overview of the algorithm. In subsequent sections, detailed descriptions of the considerations and procedures of the algorithms are provided.

5.1.

Outline of the DOI Algorithm

Input: vector file

Detection Phase - basic stage

li3t of Complete dimension-set3 Detection Phase - advanced stage

list of all detected dimen3ion-3et3 Interpretation Phase

Proper Dimensioning Graphs and notes Figure

41.

Block diagram of the main 3tep3 of the DDI algorithm

78

The DDI Algorithm

The DDI algorithm has two phases: the detect ion phase and the interpretation phase. A block diagram of the DDI algorithm is provided in figure 41. The detection phase, which consists of a basic stage and an advanced stage, is aimed at detecting the dimension-sets which exist in the input drawing and is therefore the core of the DDI algorithm, while the interpretation phase is aimed at analyzing the appropriateness of the detected dimensioning. Additional interpretation tasks, such as examining the correspondence between two or more views of the object which appear in the drawing belong to consequent modules of MDUS and are beyond the scope of this work.

5.1.1

St ages an d o ut put of t he detectio n phase

The detection phase, which is based mainly on the dimensioning grammar, has two stages: The b asic stage and the a dvanced stage. The basic stage is aimed at detecting the dimension-sets which belong to the Co mplete types of dimension-sets, i.e. the L o ngit udina l, Angular, and C hamfer types, and the complete versions of the C ircular and Diame tric types. About 85% of the dimension-sets present in a typical machine drawing are estimated to be detected on the average at this stage. The task of the advanced stage is to detect dimension-sets that exist in the drawing but were not detected by the basic stage. These are primarily the incomplete dimension-sets, which include truncated versions of both the C irc ula r and the Dia m e tric dimension-sets, as well as the R adial dimension-sets. In addition, this stage handles also complete dimension-sets which the basic stage failed to find due to a failure to detect one of its two Arrowheads. At the end of the detection phase, the DDI algorithm outputs a list of d im ensio n-sets, which is the union of the lists output by the two stages and is supposed to include all the dimension-sets existing in the drawing. A failure to detect one or more of the dimension-sets found in the drawing may be caused by one of the following reasons: 1.

In spite of the efforts to reduce the noise, the environment of the undetected dimension-set is still too noisy. One effect of a noisy drawing may be an Arrowhead or two Arrowheads of the undetected dimension-set, as well as the Text, which are so distorted, that they were not detected.

2.

The dimension-set deviates considerably from the standard.

A dimension-set is defined hierarchically as an object, which consists of an arrow- strip, a word-strip, and two bottom-strips. The strips are also objects, which, in turn, consist of co mp one nts . These, too, are objects which consist of lower level objects, and so on. Because of this hierarchical structure, the output

The DDI Algorithm

list, dimension-sets, may be viewed as a structured data-base, from which a variety of information items, such as a list of the contour lines which are components of dimension-sets, can be extracted. The output of this phase serves as input to the next phase, the interpretation phase.

5.1.2

Th e o ut put of t he int erpretation ph ase

Since the scope of the interpretation phase within the framework of this Thesis is just to demonstrate how the detected dimension-sets can serve in global understanding of the drawing, it is r estricted in that it assumes that the input contour is a normalon. It outputs a contour model (a small scale graphic description of the contour of the normalon) and horizontal and vertical geometric dimensioning graphs of the normalon (see Chapter 4). The analysis of the graphs with respect to the condition stated by the Normalon Proper Dimensioning theorem provides an indication as to the completeness and correctness of the normalon's dimensioning, and is discussed in more detail in Chapter 6.

5.2.

The Basic Stage of t he Detection P hase

The basic stage of the detection phase is aimed at finding the com p lete dimension-sets. These have in common the property that each of them has exactly two Arrowheads, enabling a detection of the Arrowheads strip, A"'. Since this strip is connected to the rest of the strips, which are the Text strip, T*, and the two Bottom strips, B* and B'*, it enables their detection too. The detection capability of the basic stage is restricted by the following three assumptions: (1) All the Arrowheads in the original drawing have a standard shape whose parameters, specified below, do not deviate beyond certain tolerances, and hence all of them are detected. This implies that an Arrowhead that has an irregular shape may not be detected, hence the entire dimension-set it belongs to will not be detected either. It may, though, be detected in the advanced stage. (2) All the Text components are detected in the vicinity of their locations anticipated by the (either ISO or A~SI) standard. This implies that if, for some reason, a Text is not recorded in the location where it is searched for, it will not be detected, and the information about the dimension-set will not be complete. This undetected Text can also be detected in the advanced stage. (3) Witnesses do not cross each other. As discussed in Chapter 2, although object lines should be thicker than interpretation lines, there are many drawings

79

80

The DDI Algorithm

in which these two sets of lines have the same width, rendering line width an unreliable feature. Since we do not refer to the width of the line, if two Witne.s.ses cross each other , we have to assume that the lines beyond the point of intersection are object lines.

input: Vector File

Detect Ind ividual A rrowheads

Detect Arrowheads Strips

Detect Bo ttom St rips

Detect Text Strips

output: List of C omplete Dimension-Sets Figure

4£. Block diagram of the basic stage of the detection phase

A block diagram of the basic stage of the detection phase is presented in figure 42. The algorithm starts with a detection of the set of individual Arrowheads, which may appear anywhere over the drawing paper plane. This is followed by combining pairs of Arrowheads to obtain the set of Arrowheads strips. Each of the Arrowheads strips, A*, contains exactly two Arrowheads, one of which should be attached to one of the Bottom strips, B*, while the other - to the other Bottom strip, B'*. Therefore, the algorithm proceeds by searching th.is pair of strips. Each Arrowheads strip is also bound to a Text, enabling the algorithm to search the appropriate Text strip.

5.3.

Detection of t he Arrowhead Component

As was noted earlier, a successful detection of Arrowheads is essential for detecting dimension-sets. Therefore, Because of their important role, Arrowheads'

The DDI Algorithm

characteristics have been investigated thoroughly, and efforts were invested on increasing the probability of detecting them. As in many pattern recognition problems, there are two main types of errors in the recognition of Arrowheads: (1) failure to detect existing Arrowheads, and (2) false detection of a collection of vectors as an Arrowhead. In this section we describe how Arrowheads a.re detected and discuss the means by which these two problems are tackled. We discuss first the various shapes which Arrowheads in machine drawings may have. We then define geometric locations and parameters of Arrowheads, and describe how the list, through which Arrowheads are searched for, is prepared, and how the parameter adaptation mechanism operates. Finally, an outline of the procedure for the detection of Arrowheads is provided.

5.3.1

Shapes of Arrowheads

There is a variety of shapes of Arrowheads in machine drawings. [KSM85] provides eight different shapes of Arrowheads.

Figure

4S.

Different shapes of Arrowheads. (adapted from {KSM85j)

These shapes are depicted in figure 43. The most frequently used is the filled in Arrowhead, while the last two on the right are customary in civil engineering drawings, but are extremely rare in machine drawings, and hence are not considered for detection. ISO standard demands that an Arrowhead be filled with ink, and the examples drawn in the standard also demonstrate filled-in arrowheads. Most draftsmen (and computer driven plotters) follow the standard and use this type of Arrowhead.

81

82

The DDI Algorithm

Nevertheless, there is no specification in the standard as to the exact angle between the sides of the Arrowhead, and it varies from 15° to 40°, the statistic mode (the most frequent value) being 22°. The length of the Arrowhead is not specified either, and it varies from 3 to 8 millimeters with a mode of 4mm. Consequently, Arrowheads in different drawings may have different shapes, which depend on the style and taste of the draftsman (or the plotter designer, for that matter). Differences among Arrowheads in the same drawing, however , are much less significant. The similarity of Arrowheads within a drawing is taken advantage of in the parameter adaptation procedure described below.

A

Figure

44. Magnified ideal (left) and typical Arrowheads and their detected edges

Magnifications of an ideal and of a typical Arrowhead and their surrounding, as well as the result of their edge-detection are depicted in figure 44. The trapezoid shape is characteristic of the first six shapes of Arrowheads of figure 43. All of them have in common the property, that their outer contour forms a trapezoid-like shape. The trapezoid is ideally isosceles, that is, AD = BC in the bottom left corner of figure 44. Because of this specific shape of the six types of Arrowheads customary in machine drawings , the detection of Arrowheads is based on template matching of the trapezoid.

5.3.2

Geomet ric locations a nd pa rameters of arrowheads

An arrowhead is an object consisting of two sides, which are the sides of the isosceles trapezoid. Following are definitions of several useful geometric locations of arrowhead . •

front : the middle of the short basis of the trapezoid (point

E in figure 44).

The DDI Algorithm



back: the middle of the long basis of the trapezoid (point F).



axis: the line which connects front and back (line EF).

The detection of arrowheads is based on a search for all the possible pairs of vectors, which simultaneously meet a set of conditions imposed on a. set of parameters. Their names, descriptions, and preliminary means and standard deviations are given below. The figures are estimations based on measurements and observations using a sample of 800 Arrowheads from 50 different machine drawings,

*

side-length: the length of side-of-arrows . The preliminary mean length is 4.5mm and the standard deviation is 1.5rrun.

*

angle-between-sides: the angle between the two s ide-of-arrows.The preliminary mean angle is 22° and the standard deviation is 4°.

*

dis tance-between-sides: the distance between the midpoints of the two s ides of arrowhead . The preliminary mean distance is l.4mm and the standard deviation is 0.6mm.

*

width-of-front: the distance between the two close edges of the two sides. The preliminary mean distance is 0.8mm and the standard deviation is 0.7mm.

*

width-of-back: the distance between the two remote edges of the two sides. The preliminary mean distance is 2.8mm and the standard deviation is l.2mm.

5.3.3

Prepa ring candidate side pai rs

The vector file of even a medium-size drawing may contain thousands of vectors. Therefore, an exhaustive search for pairs of vectors w:hich meet the demands of the arrowhead parameters on the original vector file which requires O(n 2 ) time, with n being the number of vectors in the vector file, is costly in terms of computing time. To reduce this time the search is confined to side- list, which is a subset of the vector file containing all the vectors whose length is between two specified values, which are related to the preliminary mean and standard deviation of length-of-side. side-list is smaller by at least an order of magnitude than n, reducing the computation time by two orders of magnitude. In addition to saving computation time, s ide-list is designed in order to solve, at least partially, two problems: the problem of broken sides and the problem of multiple detected Arrowheads, both of which are described below. The problem of broken sides arises when the vectorization of the edge raster file, performed during the Raster to Vector (RTV) step of the preprocessing, produces from at least one of the sides of the Arrowhead a broken line, which consists

83

84

The DDI Algorithm

of a chain of more than one vector, as is the case in the bot tom right corner of figure 44. To avoid a failure to detect arrowheads in such cases, we first apply a straightening procedure on the original vector file. To limit the complexity of the procedure, we assume that the number of vectors in the chain does not exceed 2. Adjustments of the scanning resolution and the value of the arc parameter applied during RTV can usually satisfy this requirement. -...._,,._

__

~

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

Figure 45. Straightening and averaging candidates for sides of arrowheads

In the straightening procedure, pairs of connected vectors, which form an obtuse angle and the sum of their lengths is within the specified tolerance to match the length of side-of-arrowhead , are redefined as one vector, as demonstrated on the left hand side of figure 45. This vector is inserted into sides- list. The value of the obtuse angle in this case is a decreasing function of the length of the shorter of the two vectors; the shorter the line, the smaller (less obtuse) the angle. A typical value for the angle when the two vectors have about the same length is 170°. The multiple detected arrowheads problem arises when the same arrowhead is detected more than once as different arrowheads. Such an event may occur in cases where the original Arrowhead was not of the filled-in type, such that each of its real original sides yielded two vectors, giving rise to four different combinations which are actually the same arrowhead . If axis exists as a physical line in the original drawing, the number of combinations is much bigger. To avoid such a misleading multiple detection, each pair of similar vectors (vectors whose edges are close) in side-list is replaced by their average, as shown on the right side of figure 45. (An average of two vectors is defined in Chapter 6). An outline of the procedure which describes the preparation of side-list is provided below. Define fu nction prepare-s ide-list set max-length to be mean-side-length+ 2 x standard-deviation-side-length set min-length to be mean-side- length - 2x standard-deviation- side-length

The DDI Algorithm

set side-list to be an empty list prepare short-sides as a sublist of vector-file whose vectors are shorter than max-length to reduce computation time of straighten procedure apply straighten procedure on short-sides push straightened vectors onto side-list Foreach vector in vector-file do: If length of vector is between low-value a nd high-value then begin averaging similar vector3 Foreach side in sublist do: if vector is similar to side then replace side by the average of vector and side else push vector onto side-list end return side-list

5.3.4

The arrowhead parameter adaptation mechanism

As already noted, different machine drawings contain Arrowheads which do not necessarily look the same. This is reflected in their characteristic parameters, which can also be significantly different. To improve the detection capability of the algorithm, it is equipped with a "learning" mechanism which enables it to impro~e the values of the parameters of the specific drawing under examination as the number of recognized Arrowheads increases. Since there is no a-priori knowledge about the sh ape of the Arrowheads in the drawing under examination, each of the four parameters is primarily assigned external values for their mean and standard deviation. These external parameters are relaxed enough so as to allow for a variety of shapes of Arrowheads which occur normally in machine drawings. The detection of the first Arrowheads is based on these parameters. To save unnecessary computations, the value of each parameter for each pair of vectors is computed only if the result of the test for the previous parameter is positive. The order of the tests is arranged such that the a less likely event (e.g. the distance between two vectors meets the corresponding parameter demands) precedes a more likely one. Thus, angle-between-sides of the the two candidate vectors is computed only if the distance between them meets the demands of distance-between-sides. Only if both the distance and angle are adequate then width-of-top is computed, etc. Since the parameters are relaxed, there is a considerable chance that pairs of candidate sides which are actually not Arrowheads will meet the demands and

85

86

The DDI Algorithm

cause a false recognition. Therefore, each of the first detected Arrowheads is further checked for the number of long vectors or arcs (which appear in the original vector file and are exi)ected to belong either to a Witness or to a Contour) that pass or end near the top of the candidate Arrowhead. Only if there is at least one such vector or arc, the pair is considered as a detected Arrowhead. Since this additional test has to be carried out on the entire vector-file, it is costly in terms of computing time, and therefore it is done only for the first Arrowheads, which serve as a sample representing the Arrowheads population in the drawing under examination. After having detected a certain number of Arrowheads, denoted samplemagnitude (10, as a typical example) using this procedure, we ascertain that the Arrowheads are not concentrated in a specific region, for if they are, they may not be representative of the rest of the Arrowheads. If the Arrowheads are located in a specific region we search for additional sample-magnitude Arrowheads to have better statistics. We then calculate the mean and the standard deviation of the parameters using the geometry of the arrowheads detected so far. From this point the detection starts again, this time with the new set of computed parameters, which are supposedly more tight and enable a "safe" recognition without having to apply the additional costly test applied for the first detected arrowheads. At the end of the detection of all the arrowheads it is possible to update also the set of preliminary-parameters using the data gathered from all the newly detected arrowheads. In this way, the system "learns from its experience,, and eventually improves its performance. Whether to consider cumulative data or to compute a "moving average,, with optional reset is a matter of implementation and both alternatives should be provided as options to be decided by the MDUS operators.

5.3.5

Outline of the arrowhead detection algorith m

Two arrowheads are similar if their tops are similar (that is, closer than a certain proximity-parameter, e.g. lmm, which is twice the width of a typical wide line), and their pointing-directions are also similar (that is, the absolute value of the difference between these two angles is less than some same-directionparameter, e.g. 12°, about half of angle-between-sides). Before inserting the detected arrowhead into the list detected-arrowheads, we check whether there is no other arrowhead in detected-arrowheads, which is similar to the new detected arrowhead. If such a similar arrowhead is found, then if its angle-between-sides is greater than that of the new arrowhead , then the new one is not inserted into the list, else it replaces the similar arrowhead which was in the list. This prevents the possibility that an Arrowhead, which originally was not filled in, but whose axis was drawn as a line, will mistakenly yield more than one arrowhead as a result of considering its axis as a side. The test described above ensures that only the real arrowhead is inserted. To summarize this section, we provide the outline

The DDI Algorithm

of the algorithm for detection of Arrowheads. Defi ne Fu nction detect-arrowheads with preliminary-parameters angle-between-sides tolerance-of-angle-between-sides distance-between-sides tolerance-of-distance- between-sides width-of-front tolerance-of-width-of-front width-of-back tolerance-of-width-of-back create from sides-list a list of all possible pairs-of-sides Foreach pair-of-sides until sample-magnitude arrow heads are detected do if pair-of-sides meets the demands of preliminary- parameters then begin make possible-arrowhead from pair-of-sides if number of long vector in vector-file which pass or end near the top of possible-arrowhead to prevent fa/Je detectionJ is eq ual or greater than 1 then push poss ible-arrowhead onto sample-arrowheads end if sa mple-arrowheads are in a specific region find sample-magnitude more possible-arrowheads using the above procedure, and push them onto s ample-arrowheads compute updated-parameters based on sa mple-arrowheads Foreac h pair-of-sides do begin if pair-of-sides meets the demands of updated- paramet ers then make detected-arrowhead from pair-of-sides if detected-a rrowhead is not similar to any arrowhead in detected-arrowheadsthen to prevent insertion of multiple arrowheads resulting from the same original arrow. push detect ed-arrowhead onto detected-arrowheads end return detected-arrowheads

To conclude this section, we note that in order to detect a dimension-set , at least one A rrowhead per dimension-set needs to be detected. Assuming a modest 0.9 probability of detecting a single A rrowhead, the probability of not detecting a complete dimension-set through one of its .Arrowheads is about 0.01.

87

88

The DD! Algorjthm

5.4.

Detecting Arrow-strips

According to the dimensioning grammar, the Shape is a component which exists in any dimension-set. However, there are several situations in which the Shape does not exist physically (''phantom" Shape see figure 10), or is not continuous. Discontinuity of the Shape occurs in the case of regular symmetric ANSI dimension-sets, where the Shape is combined of two portions (vectors or arcs) rather than one to allow the Text to be inserted in the gap formed between them. To avoid dealing with these various manifestations of Shape, we avoid looking for it directly. Rather, we define arrow as an object consisting of an arrowhead accompanied by an arrowtail. The arrowtail is a line* attached to the back of the arrowhead. There are two kinds of arrows: linear-arrows, whose attached arrowtails are vectors, and angular-arrows, whose attached arrowtails are arcs.

Linear

Angular

~

~

arrowhead arrowtoil arrow arrow - strips : ISO

symmetric

ISO

asymmetric

ANSI symmetric ANSI asymmetric

~

...

... ... ~

.-- __. __. .__

F ~ ~ ¥ ~

/'

~

Figure 46. ISO and ANSI linear and angular arrow-related objects

We further define arrow-strip as an object consisting of two matching arrows. A linear-arrow-strip contains a linear-arrow and an angular-arrow-strip contains an angular-arrow. The ISO and ANSI versions of these arrow-related objects are depicted in figure 46.

• A line in this context means either a. vector or a.n arc

The DDI Algorithm

5.4.1

The "tip" associator as an arrow combiner

vVe first detect the arrowtail of each detected arrowhead. A line is an arrowtail of a given arrowhead if the requirements, specified by the tip associator, ~, are fulfilled.

Figure 41. Conditions for combining arrowheads and arrowtails

These requirements, which are also described in figure 47, are the following: 1.

If arrowtail is a vector, then axis (line AB in figure 47) should be co-linear with the vector, else ( arrowtail is an arc) it should be co-linear with the tangent to the arc at the back (point A).

2.

axis and arrowtail should have a common edge, which is either back or front (point B).

3.

back should be located along arrowtail (to prevent a situation in which only front is located along arrowtail).

Each pair of objects, an arrowhead and its matching arrowtail constitutes an arrow . The output of this step of detection of arrows is two lists: linear-arrows and angular- arrows . The procedure which outputs these two lists is given below.

Defi ne function find-arrows Foreach arrowhead in detected-arrowheads do begin search arrowtail of arrowhead (according to the conditions for the tip associator, ~ ). if arrowtail was found then if arrowtail is a vector then arrowtail is linear begin make linear- arrow from arrowhead and arrowtail push linear-arrow onto linear-arrows end

else

arrowtail is angular

89

90

The DDI Algorithm

begin make angular-arrow from arrowhead and arrowtail push angular-arrow onto angular-arrows end end

5.4.2

Combining arrows to arrow-strips

We proceed by matching pairs of linear-arrows to obtain linear-arrow-strips and pairs of angular-arrows to obtain ,angular-arrow-strips.

0

~

A

cc -~ BA



0

B

Figure 48. Two valid {left} and four invalid combinations of arrows

A pair of linear-arrows is matched if it meets the following conditions: 1.

The arrowtails of the two linear-arrows (angular-arrows) are co-linear (cocircular).

2.

The two corresponding arrowheads point either towards the midpoint of the vector or arc connecting the two arrowheads , or away from this point.

3.

No other arrowhead is located along the neighborhood of the (either physical or imaginary) line connecting the two arrowheads.

4.

The distance between the two fronts exceeds a proximity-parameter (to prevent two adjacent arrowheads , which point at each other and pierce the same Witness to be considered as an arrow-strip ).

Figure 48 illustrates the effect of the above conditions by demonstrating several valid and invalid combinations of arrows . The output of this step of combining arrows to arrow-strips is two lists: linear-arrow-strips and angular-arrow-strips.

The DDI Algorithm

5.4.3

Determining the kind of arrow-strips

We need to determine the kind of arrow- strip in order to be able to locate the Text. Each of the arrow-strips detected in the previous step may be either regular or irregular as well as symmetric or asymmetric, yielding four arrow-strip categories. To classify the arrow-strips we compare for each arrow-strip the distance between the fronts of its two arrowheads , denoted distance-betweenarrowheads, with the distance between the edges of its two arrowtails that are remote from the arrowheads . h ~

~ ~ I

I .., I ,#

t

t"'" ' I~

~ r
j , are fulfilled (see figure 50): 1.

The point front should lie along the line.

2.

If the line is a vector then it should be perpendicular to axis, else (the line is an arc) axis should be perpendicular to the tangent to the arc at the point where front touches the arc.

Since a Witne3s cannot be an arc (as can be seen by checking all its possible line descriptors in the Line Description Table M, table 7), if the pierced line is an arc, then, according to the dimensioning grammar, the only possibility is that the arc is a Contour of a simple bottom-strip of a complete Circular dimension-set. If the pierced line is a vector, then it can be either a witness of a compound bottom-strip or a contour of a simple bottom-strip .

5.5.2

Free and bound edges of a vector

We define a free edge of a vector as an edge which is not connected to any vector, except for the following two possible vectors: 1.

A vector which is the other edge of the original line. It is a parallel vector, whose distance from the vector under consideration is not more than proximity-parameter (the width of a wide line).

93

94

The DDI Algorithm

2.

A vector which is formed during edge detection as the narrow edge of the original line. It must not be longer than proximity- parameter.

free edge

bound edge

\

Figure 51. Free and bound edges of a Witness

A bound edge of a vector is an edge which is not free. Free and bound edges are demonstrated in figure 51. To distinguish between simple and compound bottomstrips we make use of the fact that a Witness must have at least one free edge, whereas each of the edges of any Contour must be bound.

5.5.3

The "guid e" associa tor

H the pierced vector is a witness , then it should lead to a contour. A witness leads to a contour if the following conditions, specified by the guide associator, JJ, are fulfilled:

25

Figure 5£. Conditions for a Witness to lead to a Contour

1.

If the contour is a vector or a point, then the distance d between the close edge of the witness and the contour should not exceed three times proximity-parameter.

2.

If the contour is a vector then the witness and the vector have to be co-

The DDI Algorithm

linear. 3.

If the contour is an arc, then the bound edge of the witness should touch it.

4.

If the contour is a point, then that point should be the intersection of at least two vectors.

Figure 52 exemplifies these conditions. The search for bottom-strips proceeds as follows: Defi ne function detect-bottom-strips Foreach dimension-set in dimension-sets do Foreach of the two arrows in arrow-strip do apply the pierce associator, ~ , to detect contour-or-witness

(as specified above) if the two contour-or-witnesses are both arcs then

they cannot be Witness s. begin insert t he first arc and the second arc as contours in the first and second (simple) bottom-strips, respectively insert the two bottom-strips into dimension-set if dimension-set belongs to symmetric- or to asymmetric-linear-dimension-sets then push dimension-set onto symmetric-circular-dimension-sets or asymmetric-circular-dimension- sets , respectively end if one contour-or-witness is an arc and the other is a vector

This is an illegal combination; no such dimension-set. then print "contradicts the dimensioning grammar" if both contour-or-witnesses are vectors then Foreach of the two contour-or-witnesss do if contour-or-witness has a free edge then (contour-or-witness is a witness) begin make witness from contour-or-witness apply the guide associator, _.D, to detect contour

(as specified above ) make (a compound) bottom-strip from witness and contour insert bottom-strip into dimension-set end else

( contour-or-witness is a contour) begin make contour from contour-or-witness

95

96

The DDI Algorithm

make (a 3imple) bottom-strip from contour insert bottom-st rip into dime ns ion-s et end end

5.6.

Detecting t he Text Strip

Since the Text, like the A rrowhead, is an obj ect-dissimilar component (see Chapter 3), it too, can be detected by statistical, decision-theoretic methods, which do not involve any syntactic considerations. Text components can be located anywhere on the plane of the paper drawing, hence their independent detection involves searching the entire vector file. Furthermore, a machine drawing usually contains pieces of text which are irrelevant to climension-sets. Rather, these may be manufacturing or quality control directions, or administrative information. Even though a sublist of short vectors can be extracted from the vector file, on which the search for Text is done, it still is a costly procedure which is therefore deferred to the advanced stage. At the advanced stage most of the Text componen ts have already been detected, and the search is restricted to a much smaller list. At this section we discuss the detection of T ext which does make use of syntactic considerations; the search is confined to regions where, according to the dimensioning grammar, it is anticipated to be located.

5.6.1

Assumptions and specifications for the detection of text

The following assumptions are made in the procedure of the Text detection: 1.

The same drawing may contain a mixture of both the ISO and ANSI styles of recorcling Text. This is a realistic situation, because such a mixed style is frequently found in machine drawings.

2.

The Text is recorded in the approximate location specified by the standards.

3.

Each alpha-numeric character in Text is isolated both from its neighboring characters (if they exist) and from the component (Shape or Tail) to which the Text is botuld by the bind associator, D.

4.

In addition to the ten digits, The Text may contain a decimal point and the characteristic symbols of the various types of dimension-sets (see table 10).

5.

The Text does not contain any tolerance notations.

The DD! Algorithm

6.

The original line of each character is not disconnected, and is wide enough such that the result of the preprocessing is at least one closed chain of vectors.These vectors follow the edge (boundary) of the character.

7.

Each two Text components are recorded apart from one another, such that the minimal distance between them is more than the height of an average digit.

The following specifications are required from the detection of Text:

1.

The procedure should fit drawings that use a mixed ISO/ ANSI style.

2.

Each Text should list groups of vectors, each of which contains the vectors which construct one of the characters of Text.

3.

Actual reading of the contents of the Text is not required since it is beyond the scope of this work. Thus, no attempt is made at recognizing each character specifically, but the output list of the procedure can serve as input to a character recognition procedure.

5.6.2

The hierarchy of objects defining text

We define the object word as a list of characters. Each character is, in turn, an object which is a special case of the object loop. A loop is a special case of the object chain . A chain is an ordered list of vectors, in which each vector, except for the first and the last ones, has one edge which is identical to an edge of the previous vector in the list and another edge, which is i (length-of vector) length)) if the length of vector is greater than length, true is returned The predicate shorter is the negation of longer.

6.6.3

Finding the midpoint of a vector or of two points

The computant midpoint is designed to accept either a vector or a pair of points. In both cases it returns the point which resides in the middle of the vector which is either given or defined by the two given points, as follows: ( defun midpoint (first &optional second) (if ( null second) If the second parameter is not provided then first is a vector. (setq second (ptl first) first (pt2 first)) convert first and second to the two end-points of the vector. (make-poi nt (fix(/ ( + (xcor first) (xcor second)) 2)) the average of the x's (fix(/ ( + (ycor first) (ycor second )) 2)))) the average of the y's To illustrate the dual role of this computant, suppose that point-a is (ma ke-point 200 200), point-b is (make-point 400 400 ), and vector-a b is (make-vector point-a point-b). Both (mi dpoint vector-ab) and (midpoint point-a point-b) are acceptable as parameters of (midpoi nt ... ) and yield the same result, (make-point 300 300). Thus if we write (setq midl (midpoi nt point-a point-b )), and (setq mid2 (midpoint

119

120

Language and Implementation

vector-ab)) then the point-examiner (point-are-the-same midl mid2) returns true.

6.7.

Intersections and Projections of Points and Lines

A line is defined by the vector which lies along it. Therefore, any line can be represented by an infinite number of vectors, all of which have the same slope, (slope vector), and the same intercept (point of intersection with the y-axis), {intercept vector). This section deals with several functions concerning the spatial relations between lines and points.

6.7.1

Finding the intersection between two lines

The point of intersection between two lines defined by their coefficients al, bl, a2, and b2 is calculated using the two equations of the two lines as follows: {defun lines-intersection {al bl a2 b2 &aux da) (if (ne al a2) the lines are not parallel, their slopes are different. (setq da (- a2 al)) (make-point (fix(/ (- b2 bl) da)) (fix(/ (-(*al b2) (* a2 bl)) da))))) This computant is used to find the point of intersection of two lines represented by their vectors: ( defu n intersection-between-lines ( vectorl vector2) (lines-intersection (slope vector!) (intercept vector!) (slope vector2) (intercept vector2)))

6.7.2

Finding the projection of point and vector on line

To find the projection of a point on a line, we make use of the fact that the projected point is the point of intersection between the given line and a line which is perpendicular to it and passes through the given point. (defu n projection-of-point-on-line (vector point &aux al a2 bl b2) ( setq a 1 (slope vector) a2 {if(= al 0) -9999999 (- 0 (/ 1 al))) the slope of the perpendicular line is the reciprocal of the given

~ine.

Language and Implementation

b1 (intercept vector) b2 (- (ycor point)(* a2 (xcor point)))) (if ( = bl b2) point if the b 's are the same then the point lies on the line. (li nes-i ntersection al bl a2 b2))) elu the projection of the point is the intersection of the lines. The projection of a vector on a line is the vector defined by the the projection of the two end-points on the line: ( defun projection-of-vector-on-line (vector line) (make-vector (projection-of-poi nt-on-line (ptl vector) line) (projection-of-point-on-line (pt2 vector) line)))

6.7.3

Examining the proximity of a point to a line

The distance from a point to a line is found as the distance from that point to the projection of the point on the line: ( defun distance-from-point-to-line (point line) (d istance-between-points point (projection-of-point-on- line point line))) It is frequently desirable to know whether or not a point is on a line, that is, if it is closer to a line by more than a specified parameter. This is carried out by the following predicate:

( defun point-is-on-line (point line &optional proximity-parameter) ( < (distance-from-point-to-line point line) proximity-parameter)) Similarly, ( point- is-on-vector ... ) returns true if a given point is on the line determined by vector and the projection of point on that line is also on vector (between its two end-points). (symmetric-point point line)returns the symmetric point of the given point, with line serving as an axis of symmetry.

6.7.4

Functions involving two vectors

(vectors-are-on-the-same-line vectorl vector2 a-tolerance b-tolerance) is a predicate which returns true if the two vectors lie on lines whose parameters a and b are within a-tolerance and b-tolerance, respectively. (first-vector-is-on-second vectorl vector2) returns true if the projection of each one of the edges of vector 1 is on vector2 and the distance between each one of the

121

122

Language and Implementa tion

edges of vectorl and the line on which vector2 lies is less than proxim ity-parameter). (vectors-have-common-edge vectorl vector2) returns true if an edge of the first vector is adjacent to an edge of the second one. (vectors-are-continuous vectorl vector2) if they are on the same line and have common edge, but neither one of them is on the second . (intersection-of-vectors vectorl vector2) is a computant which returns the point of intersection between the lines represented by the two vectors, if it lies on both vectors, else it returns nil.

6.8.

Some Aspects of the DOI Implementation

In this section we describe some of the important functions and procedures applied in the actual implementation of the DDI algorithm. For the sake of brevity and clarity we provide only the important parts of definitions and principles underlying procedures, trying not to repeat procedures described in the previous chapter, and omitting technical details and optional parameters such as proxi mityparameter. In order to avoid a very long and complex program, we assume that the only shape that a projection of the object can assume is that of a normalon. as a result , both Shape and Contour are only vectors, and no arcs are involved.

6.8.1

Arrowheads and Related Associators

An arrowhead is defined as an object consisting of two sides, sidel and side2, both of which are vectors. Three associators, pierce ( t>l ), tip {-f> } , and point (r>-) involve the association between an arrowhead and either a vector or an arc. An arrowhead and a vector are associated by the pierce associator, ~ , as follows: ( defun pierce (a rrowhead vector) (a nd (point-on-vector (top arrowhead) vector) (vectors-a re-perpendicular (axis arrowhead) vector)) An arrowhead and a vector are associated by the tip associator, (defu n tip (arrowhea d vector) (or (first -vector-is-on-second (axis arrowhead ) vector) (and (vectors-are-conti nuous (axis arrowhea d) vector) (point-is-on-vector (ba ck arrowhead) vector))))

~,

as follows:

Language and Implementation

An arrowhead and a vector are associated by the point associator, t>-, as follows: ( defun point (arrowhead vector) (and (vectors-a re-continuous (axis arrowhead) vector) (point-is-on-vector (top arrowhead) vector)))

6.8.2

Making arrow-strips

By applying the tip associator for each detected arrowhead , we find the corresponding arrowtail , and these two objects build up an arrow. A pair of arrows is combined to yield an arrow-strip if the following predicate returns true. ( defun arrows-form-strip ( arrowl arrow2) (and (vectors-are-on-the-same-line ( arrowtail arrowl) ( arrowtail arrow2)) ( = (diffe rence-between-pointing-directions (arrowhead arrowl) (a rrowhead arrow2)) 180°) to ensure that they point towards opposite directions. (= 0 ( number-of-tops-along-vector ( make-vector (top (arrowhead arrow!)) (top (arrowhead arrow2)))) to avoid presence of Arrowheads along the anticipated Shape.

6.8.3

Witnesses, Contours, and related functions

A witness is a vector which is pierced by an arrow and has at least one freeedge. A contour is a vector, an arc, or a point, but since we deal only with normalons, we will only refer to it as a vector. Unlike witness , both edges of contour must be bound. To determine whether (ptl vector) is free, we count (n umber-of-li nes-ending-a t-point (ptl vector)). This number does not include vectors which are on vector or which are shorter than proximity-parameter. In order for ( ptl vector) to be a free edge, the number should be zero, otherwise the edge is bound. For each one of the two arrowheads in each detected arrow-strip, we find the vector which it pierces. Since this vector can be only a segment of the entire real WitneJs, which may be pierced by additional Arrowheads from both directions, we detect the entire WitneJs or Contour by adding segments whose edges are tops of arrowheads. If the resulting vector has a free edge then it is a witness, else it is a contour. If a witness is detected, then we find the contour by the guide associator, _D.

123

124

Language and Implementation

(defun guide (wit ness contour) (vectors-are-conti nuous witness contou r maximal-ga p)) maximal-gap is the maximal allowed gap between the bound edge of the witneJJ and the neareJt edge of the contour. The association of Text to Shape or Tail by the bind associator , CJ, is discussed in detail in Chapter 5 and will not be rehearsed here

6.9.

Sample drawings and their DOI

Tills section describes the grapillc editor that has been developed for the purpose of producing "synthetic" vector files of normalons. These serve as input to the implemented DDI module. We then provide several examples willch illustrate the capabilities of the implementation, willch has been written in SPADEL on a Symbolics 3670 Lisp Machine, release 6.

6.9.1

The grap hic ed itor

To avoid the necessity to undergo all the stages of the preprocessing, each of willch is difficult by itself, a graphic editor has been developed. Tills facility enables direct input to the graphic screen of sample drawings by simulating the way they look after the preprocessing stages (i.e. vectorized edges of the original drawing). Using a mouse directed by the human editor it is possible to interactively enter one vector at a time by clicking its edges , as well as a chain of vectors. The inserted vector is displayed on the screen and at the same time it creates an instance of the object vector which is pushed onto the top of a stack. This stack is converted to a vector file when the drawing is ready, and may be redispalyed and changed. The mouse enables also deletions from the screen and the stack of either the vector on top of the stack or any vector from within the stack by pointing at it.

Language and Implementation

~1ndo"

3

Figure 61. A normalon drawn by the graphic editor

Although the synthetic vector file created by the graphic editor avoids problems such as noise and thresholding encountered in vector files produced by real preprocessing of drawings, the created image is similar to the processed one, as can be seen in figure 61.

The DDI is run on the vector file. The code comprises eight files and about 4200 SPADEL (Lisp) lines.

125

126

Language and Implementation

;;; FIHO THE TIP OF AH ARROW (definethod (arrow :tip)(aaux ) (intersection-between- lines sidel s1de2)) ;;; FINO THE CENTER OF THE ARROW (defmethod (arrow :center)(&aux midpointl midpoint2 midline) (setq midpointl (send sidel :midpoint) •1dpo1nt2 (send side2 :midpoint) •1d11ne (11ake-1nstance 'line)) (send •1d11ne '1set-pt1 •1dpo1nt1) (send •id11ne ':set-ptZ m1dpolnt2) (send •idline :•idpoint))

Figure 62. A sample of the file detect-arrows

Figure 62 is a listing of a small portion of the file called detect-arrows, which is one of the eight files of the system.

14indo"

3

Figure 63. Detection results for the normalon of figure 61

The result of the detection phase for the normalon of figure 61 is described in

Language and Implementation

figure 63. The run-time of this stage on the above example is about 8 minutes. The detected Arrowheads are filled in, Witnesses are marked by dashed lines, Shapes by dense dashed lines, and Contours - by solid lines. Texts are not included in this example, but the small horizontal numbers near the Shapes denote the length (in mm units, taking into consideration scanning and display resolution, as well as the scale of the original drawing). InterDretetion Notes: 12 di"ension-sets were detected.

e are

hori1ontal;

e are

vertical.

Contour Model:

Contours for" a CLOSED chain, Proper Di"ensionlng !Ato"etric Hor i 1ontel Graph:

~

v

Horizontal di"ensloning is O.K. ProDer Di"ensioning Cllio"etric Vert i cal Graph:

Vertical di"ensioning Is O.K.

LHndoM 3

Figure 64. Interpretation re.mlts for the normalon of figure 61

Figure 64 shows the results of the interpretation phase. The "contour model" in the figure is a small scale drawing which includes only those lines which are Contour of one of the detected dimension-sets. It enables a quick human diagnosis of the performance of the system. The contour model indicates if at least one dimension-set is missing, and if so - where. In addition, the system itself determines whether or not the normalon is properly dimensioned by examining the conditions stated by the :'formalon Proper Dimensioning theorem described in

127

128

Language and Implementation

Chapter 5. In this example, since both horizontal and vertical geometric dimensioning graphs, which are depicted in figure 64, are trees, and the detected sides form a closed loop, the normalon is properly dimensioned. A failure to detect at least one contour segment may in turn point out either a failure of the detection phase to detect a dimension-set which exists in the original drawing, or a real lack thereof.

llindow l

Figure 65. An input normalon with Text

Language and Implementation

Jl~ o~~

z: c 0

" .. c

t"

"

2 .,0

s

~ ~ ~L

Cl ~

,, .,

..

(I)

....c

...

"' ¥

L

....0 L

.. ::>

0

8

CD

"'c..::>

.. 0

c: 0

u

.. 0

~

G

>< 0

c

0

u

0

! c

c .... ID

c

L 0

129

L

Cl G L

'".,' ..

..c: 0

L 0

:c

c

,,"c

..c" .. 0

CD

c

c

.c

0

,,"c ."u L

~

:J 0

,,c:

"'

Figure 66. D etection and interpretation results for the normalon of figure 65

Language and Implementation

131

130

Language and Im plementation

Figure 65 displays another input normalon with its Text. T he result of the detection and interpretation stages are shown in figure 66. T he digits which were recognized as part of the Text appear in thick contour lines. Only 2 out of 22 digits were not identified as a part of a Text. Note the similarity between the measured and recor ded values.

IHndo" 1'I

Figure 67. The normalon of figure 65 with a "bad" Arrowhead

The importance of detecting Arrowheads is demonstrated in the following example. In figure 67 we used the same input of figure 65, only this time the lower side of the leftmost Arrowhead was deleted, using the graphic editor. Consequently, the Arrowhead was not detected, so there was no Arrowhead to match the second Arrowhead of the dimension-set, which was detected. Therefore, the Shape was not detected and no Witness was searched for. The left Witness exists anyway because there are two more Arrowheads of two other dimension-sets that point at it. Since the right Witness was not discovered, the Contour to which it

Language and Implementation

leads is left undetected. The interpretation notes indicate that 4 horizontal and 3 vertical dimension-sets were detected. The contour model shows the li:i.ck of a Contour and the system indicates that the Contours do not form a closed chain. Interpretation Notes: 1 di"ension-seta ~ere detected .

• """ ""'"°"'"~'°·'.

""'""" "''•'.

~

Contours do NOT ro,... a closed chain.

Horl ronta l Graph:

HorlEontal dtnenaioning is O.K.

Vertica l Graph:

Vertical dlnenaion1ng Is O.K.

~ indow

1'4

Figure 68. Detection and interpretation results for the normalon of figure 67

The graphic effects of this "chain reaction" are shown in figure 68. According to the proper dimensioning theorem, although both horizontal and vertical geometric dimensioning graphs are trees, since the chain formed by the Contours is not closed, the dimensioning is not proper.

6.10.

Discussion and Subjects for Further Research

According to Rich (Ri83], when we set out to design an AI program, we should attempt to specify as well as possible the criteria for success for that particular

131

132

Language and Implementation

program functioning in its particular domain. Winston (Wi82) provides the following working criteria for judging results we shall refer to with respect to the work described in this Thesis. •

I.s the ta.sk clearly defined? Exact definitions of MDUS and DDI were provided in Chapter 2; the task of the DDI module within the MDUS system is to detect dimensions in machine drawings and to use them as a part of the information needed to understand the drawing.



Is there an implemented procedure performing the defined ta.sk? If not, much difficulty may be lying under a rug .somewhere. Chapter 5 includes a detailed description of the implemented procedure as well as the assumptions and limitations of the procedure.



I.s there a .set of identifiable regularities or con.straint.s, from which the implemented procedure get.s it.s power? If not, the procedure may be an ad hoc toy, capable perhap.s of .superficially impre.s.sive performance on carefully Jelected exampleJ, but incapable of effective treatment of of the other itemJ, which it should have been able to tackle. The theory underlying the implemented procedure is the dimensioning grammar described in Chapter 4. It provides a high degree of certainty that the procedure is robust, subject to all the assumptions and limitations discussed during the work.

The output of a machine vision system, according to Horn (Ho86] must satisfy two criteria:

*

It must bear some relation to what is being imaged. The output of the DDI algorithm is clearly related to the input drawing by that it lists the detected dimension-sets and comments on their appropriateness.

*

It must (explicitly) contain all the information needed for some given task. As discussed, since dimension-sets are objects on the top of the hierarchy of lower-level comprising objects, the list of detected dimension-sets is actually a structured data-base which includes all the necessary information about the dimension-sets themselves,as well as information necessary for higher level understanding of the machine drawing.

6.10.1

Subjects for furthe r research and development

The work carried out within the framework of this Thesis can be considered as a feasibility study of automatic understanding of machine drawings. Although it seems that feasibility has been proved, there is still a lot to be done in order to be able to set out with a really working system. First, real vector-files which result from the preprocessing stages, rather than

Language and Implementation

synthetic ones, should be used as input to the system. Their usage should probably point out unanticipated probleID:s with noise and undesirable accumulating effects of the various preprocessing stages, which will have to be tackled. Second, the implementation should be augmented to include treatment of all the types of dimension-sets and of objects whose contours are more complex than normalons and involve interactions of vectors and Arrowheads with arcs. The conditions for proper dimensioning of these contours should also be investigated. Taking into consideration width of lines will provide a means to handle cases in which Witnesses cross each other and to verify the distinction between Witnesses, Tails and Shapes on one hand and Contours and other object lines on the other hand. Recognition of the content of the Text of the detected dimension-sets will provide an indication or a verification as to the type of the dimension-set. Knowing the value of the recorded Text (possibly with the accompanying tolerance) will enable to obtain a precise geometric definition of the object, to examine the correspondence between the stated and the measured dimensions, and to issue a warning in case of a severe contradiction between these two values. In the broader area of MDUS, interpretation lines which are not dimension lines have to be characterized and classified. These include crosshatching, "balloons" (circled part numbers), cross-section marks, isometric views, surface quality and welding marks, threads and their symbolism, manufacturing and quality control instructions, and drawing frame and title fields. Finally, the important issue of correspondence between lines and surfaces in the different principal orthogonal views of the object provided in the drawing should be addressed as a pre-requisite for application of any 3D reconstruction algorithm of the object.

*

*

133

References [AEG86]

"Polyfont" Form Reader Model PPFL-6510, AEG Al..-tiengesellschaft, Ulm, West Germany, 1986.

[Al83]

Aldefeld, B. , On Automatic Recognition of 3D Structures from 2D Representations, Computer Aided Design, Vol. 15, No. 2,, pp. 59-64, 1983.

(Ba87]

Baird, H. S ., Industrial Applications, prepublica tion draft of chapter 14 of the book Syntactic and Structural Pattern Recognition - Fundamentals and Applications by H . Bunke, A. Sanfeliu (Eds.) to be published by the end of 1987.

[BB82]

Ballard, D. and Brown, C. M., Computer Vision Prentice-Hall, 1982.

(Bl84)

Bley, H ., Segmentation and Preprocessing of electrical Schematics Using P icture Graphs, Comp. Vision, Graph. and Image Process. No. 28 , pp. 271-288 , 1984.

[Da75)

Davis, L. S., A Survey of Edge Detection Techniques, Computer Graphics and Image Processing No. 4, pp . 248-270 , 1975.

(Do81]

Dom , M., The Use of Automatic Digitizers in Geodata Processing Computers and Geosciences, Vol 9, No. 3 , pp. 345-350 1981.

[DP86]

Dori, D. and Pnueli, A. , The Gramma r of Dimensions in Machine Drawings, accepted for p ublication in Computer Vision, Graphics and Image Processing , 1987.

[EP86)

Eran, Y. and Pnueli , A ., Interpreta tion of Schematic Diagrams, The Weizmann Institute of Science, Rehovot, Israel, Technical Report CS86-06, March 1986.

(Fr77)

Freeman , II. , Analysis of Line Drawings, in Digital Processing and Analysis, ed . by J .C. Simon and A . Rosenfeld, Noordhoff, Leyden , 1977.

(Fr78]

Freeman , H ., Shape Description via the Use of Critical Points, Pattern Recognition, Vol. 10, pp.159-166 , 1978.

[FS78]

Freeman , H . and Saghri , A., Generalized Chain Codes for Planar C urves, 4th International Joint Conference on Pattern Recognition, Kyoto, Japan , 1978.

[Fu82]

Fu, K .S. S yntactic Pattern R ecognition and Applications, Prentice Hall , Inc., 1982.

[Fu84]

Fukuda, Y ., A Primary Algorithm for the understanding of Logic Circuit Diagrams, Pattern Recognition Vol. 17 No . 1 pp. 125-134, 1984.

[Ga75)

Gallo, V ., A Program for Geometrical Pattern Recognition Based on the Linguistic Method of the Description and Analysis of Geometrical Structures, Fourth Intl. Joml Con/. ·on AI, Tbilisi Georgia, USSR, pp 628-634, 1975.

[Gr85]

Groen , F., Sanderson , A.G. an 1987 l::m:n

Suggest Documents