Dashed line detection



Yüklə 45,58 Kb.
tarix01.11.2017
ölçüsü45,58 Kb.
#25551

A Framework for Graphics Recognition

Liu Wenyin1 Dov Dori2



1 Microsoft Research, Sigma Center, #49 Zhichun Road, Beijing 100080, PR China

wyliu@microsoft.com



2Faculty of Industrial Engineering and Management

Technion¾Israel Institute of Technology, Haifa 32000, Israel, dori@ie.technion.ac.il



Abstract

The principal contribution of this paper is an object-oriented application framework for graphics recognition applications, which is a problem domain of increasing interest. The technical concept is that the recognition applications of all graphic objects could follow a similar procedure. The goal of the graphics recognition framework is to abstract and model such similar procedure and supply generic code for graphics recognition algorithms to be used as ready made and easily extendible components in the graphics recognition systems being developed in the future. In addition to the generic graphics recognition process model, the framework consists of reusable classes of graphic objects that appear in engineering drawings as well as in other classes of line drawings. Either white-box or black-box technique can be used to extend the framework to the recognition application of a specific graphic class. The new graphic class may inherit from the available graphic classes in the framework or be totally independent as long as its interface conforms to the framework's. Applications to several graphic classes are also discussed.



Keywords: Frameworks, Software Reuse, Object-Oriented Design, Software Engineering, Graphics Recognition, Document Analysis and Recognition, Engineering Drawings Interpretation

1.Introduction


Being a domain of engineering, software engineering strives to establish standard, well-understood building blocks, which are expected to be developed and stored in libraries for common use and as a basis for extensions and modifications in the spirit of the reusability concept. Although software reuse had existed in software development processes since software engineering began as a research field in 1969, it was not before 1978 that the concept of reusability was clear in the minds of people as a solution to the “software crisis” (Freeman 1987). Currently, software reuse is getting a great deal of attention for its potential in increasing productivity, reducing costs, and improving software quality, and quite a few reuse techniques have been proposed (Krueger 1992).

The advent of object-oriented techniques (Coad and Yourdon 1991, Jacobson et al. 1992, and Booch 1994) makes the reuse technology even more powerful. Framework (Johnson and Foote 1988), as an object-oriented reuse technique, is playing an increasing important role in contemporary software development (Fayad and Schmidt 1997). While people are developing and utilizing frameworks, the definitions of frameworks vary. Johnson (1997) listed two common definitions of frameworks as follows.



  • A framework is a reusable design of all or part of a system that is represented by a set of abstract class and the way their instances interact.

  • A framework is a skeleton of an application that can be customized by an application developer.

Although it is hard to define frameworks formally and clearly, there are several common features of frameworks:

  • A framework is for reuse purpose (in the development of applications in some specific problem domain).

  • A framework is an skeleton program that can be extended to a complete application by being filled with necessary components at hot spots, the implementations of which vary from application to application of the framework (Pree 1994).

  • A framework is customizable to fit the applications being developed.

  • A framework predefines some interfaces of the filling components as the framework contract so that the components fit each other and into the framework.

  • A set of abstract classes are usually used to describe the behaviors of frameworks.

  • Corresponding concrete classes should be implemented as the filling components when extending the framework to applications.

From the above features, we can see that framework is a design reuse technique for developing new applications. There are a lot of advantages of using frameworks in application development. Rather than developing an application from scratch, extending and customizing an appropriate framework to cater to the need of the application will save much efforts and therefore speed up the development process. Another important advantage is that the quality guarantee of the framework as a product also assures its applications of quality.

Fayad and Schmidt (1997) categorized the existing frameworks into three scopes: system infrastructure frameworks, middleware integration frameworks, and enterprise application frameworks. Frameworks can also be classified into white-box frameworks and black-box frameworks by the technique used to extend them. White-box frameworks are extended to applications by inheriting from some base classes in the frameworks and overriding their interface methods, whilst black-box frameworks are extended by customizing new components according to particular interfaces defined by the frameworks and plugging them into the frameworks. However, the white-box and black-box reuse techniques frequently coexist in one framework (Johnson and Foote 1988), since some common abstractions among many black-box components (object classes) within the same problem domain may also be expressed and implemented using inheritance and overriding.

In this paper, we present a framework for graphics recognition applications. It is an enterprise application framework in the problem domain of graphics recognition. The recognition of graphic objects from files of scanned paper drawings, known as graphics recognition—which is part of engineering drawings interpretation and document analysis and recognition (DAR)—is a topic of increasing interest in the field of pattern recognition and computer vision. Although many algorithms and systems have been developed, the result is not satisfactory due to the complex syntax and semantics these drawings convey and more powerful algorithms and systems are strongly needed. To reduce the efforts involved in developing basic algorithms for such systems, we have developed the graphics recognition framework. After comprehensive domain analysis, the design of the graphics recognition framework is inspired by the observation that all classes of graphic objects consist of several or many primitive components and the algorithms of recognizing them can employ an incremental, stepwise recovery of the primitive components. The framework is implemented using a C++ template class with the graphic class used as parameter. It is a black-box framework, whose application can be easily generated by instantiating the template class with a concrete graphic class that conforms to the framework contract. Some common graphic classes are also defined in a preliminary inheritance hierarchy so that new concrete graphic classes can also inherit from some appropriate class in the hierarchy. The framework has been successfully used in developing the applications of dashed line detection (Dori et al. 1996), text segmentation (Dori and Liu 1996), hatching line detection (Liu and Dori 1997), arc detection (Dori and Liu 1998a), leader and dimension set detection (Liu and Dori 1998a), and general line detection (Liu and Dori 1998b).

The rest of the paper is organized as follows. In Section 2 we describe the domain analysis process. Section 3 presents the design of the framework. Section 4 presents the implementation and applications of the framework. We present a summary in Section 4.


2.domain analysis of graphics recognition


Like other domain frameworks, the graphics recognition framework is a vertical reuse component (Hooper and Chester 1991) in the problem domain of graphics recognition. The first step of developing such a framework is domain analysis (Prieto-Diaz 1990), in which the common knowledge is identified, captured, and organized. In order to clearly present the domain analysis, we briefly introduce the graphics recognition problem and the solution approaches in Section 2.1.

2.1The Graphics Recognition Problem and Its Solutions


Graphics recognition is an important basic problem in engineering drawings interpretation, an area within the document analysis and recognition domain, the interest in which is constantly increasing, as more research and development of experimental and commercial systems to solve this problem are conducted. The entire task is as follows.

The engineering drawings interpretation accepts as input the raster image of a scanned drawing. Vectorization, or raster-to-vector conversion, applied on the raster image, yields coarse bars and polylines. Extra processing yields fine bars and polylines in complex and noisy drawings. After vectorization, the coarse bars and polylines are input to the extraction of text, arcs, dashed lines, and other forms of higher level graphic objects. We refer to this procedure as Graphics Recognition.

We define the problem of graphics recognition as grouping the raw wires resulting from the vectorization according to certain syntax rules, recognizing these groups as types of graphic objects, and determining their attribute values. The low level graphic objects include bars, polylines, and arcs. Higher level graphic objects include characters and text, arrowheads and leaders, dashed lines, entities (geometric contours), hatched areas, and dimension sets.

Traditional algorithms (e.g., Dori 1995) recognize each class of graphic objects by clustering all the potential constituent segments at once before determining their type and attributes. This blind search procedure tends to introduce inaccuracies in the grouping of the graphic primitive components that constitute the graphic objects, which ultimately account for inaccurate graphics recognition. Liu et al. (1995) propose an incremental, stepwise approach, which is more flexible and adaptive as it constantly checks the syntactic and semantic constraints of the graphic object while gradually grouping its primitive components.


2.2The Graphic Objects and the Graphic Database


The graphic objects that appear in engineering drawings include solid straight lines, solid arcs, solid polylines, dashed straight lines, dashed arcs, dashed polylines, dash-dotted straight lines, dash-dotted polylines, dash-dot-dotted straight lines, dash-dot-dotted arcs, dash-dot-dotted polylines, character boxes, character string boxes, logic text boxes, filled arrowheads, hollow arrowheads, straight leaders, angular leaders, entities (close geometric contours), hatched areas, longitudinal dimension sets, angular dimension sets, radial dimension sets, diametric dimension sets, etc. The graphics recognition includes the recognition of these classes of graphic objects. The intermediate and final recognized objects are stored in a graphic database. Based on observations and analysis of these classes of graphic objects, we have found that all of them are composed of several or many vector-form primitive components. Even a bar may consist of several coarse line segments. This common feature can be generalized and modeled in the UML Class Diagram (Rational 1997a,b) of Figure 1. The repository of graphic objects and primitive objects is called "GraphicsDatabase" and can be modeled in the UML Class Diagram of Figure 2.

Figure 1. The generic model of the composition of graphic objects.

Figure 2. The GraphcsDatabase model.

2.3The Generic Graphics Recognition Process


The incremental, stepwise approach proposed by Liu et al. (1995) can be applied to the recognition of all these classes of graphic objects. The algorithm consists of two main phases based on the hypothesis-and-test paradigm. The first step is the hypothesis generation, in which the existence of a graphic object of the class being detected is assumed by finding its first key component from the "GraphicsDatabase". The second step is the hypothesis test, in which the presence of such graphic object is proved by successfully constructing it from its first key component and serially extending it to its other components. In the second step, an empty graphic object is first filled with the first key component found in the first step. The graphic object is further extended as far as possible in all possible directions in the extension process—a stepwise recovery of its other components. In the extension procedure, an extension area is first defined at the current extension direction. All candidates of possible components that are found in this area and pass the candidacy test are then inserted into the candidate list, sorted by their nearest distance to the current graphic object being extended. The nearest candidate undergoes the extendibility test. If it passes the test, the current graphic object is extended to include it. Otherwise, the next nearest candidate is taken for the extendibility test, until some candidate passes the test. If no candidate passes the test, the extension process stops. If the graphic object is extended, it is added to the graphic database. The algorithm can be modeled using the UML Sequence Diagram (Rational 1997a,b) of Figure 3, which outlines the framework and shows the hot spots of the recognition process of all graphic classes. The recognition of any graphic class requires only the implementation of these hot spot functions.

Figure 3. The model of the generic graphics recognition algorithm of Liu et al. (1995).

3.Design of the graphics recognition Frmaework

3.1The Initial White-box Framework


The inheritance feature among the classes of graphic objects listed in Section 2.2 is obvious and it is necessary to organize them in a classes inheritance hierarchy, which is shown in Figure 4.



Figure 4. The inheritance hierarchy of the graphic classes.

At the root of the hierarchy is the class "Primitive", which abstracts all features of all graphic objects. At the second level of the hierarchy, there are several abstract classes. The class "Line" abstracts the most common features of all line classes. Lines are classified into types by two attributes: geometry (shape) and style (continuity). The three line geometry classes are straight, circular, and polygonal. The four line style classes are solid, dashed, dash-dotted, and dash-dot-dotted. However, each concrete line class should be specified by the geometry and style simultaneously. Parallel inheritance can therefore be used to depict this feature. "Textbox" is inserted into the hierarchy to generalize the features of the classes "Charbox", "Stringbox", and "LogicTextbox". "Arrowhead" generalizes the classes "FilledArrowhead" and "HollowArrowhead". "Leader" generalizes the classes "BarLeader" and "ArcLeader". Both "Entity" and "HatchedArea" are concrete classes, but "HatchedArea" can be considered as a subclasses of "Entity". "DimensionSet" can be used to generalize all kinds of dimension sets.

Based on the classes generalization shown in Figure 4, the generic composition model of graphic objects shown in Figure 1 and the graphic database model in Figure 2 can be abstracted and combined to the one in Figure 5. The recognition process can be extracted and implemented inside "Primitive" by the member function "doRecognition(gdb)", which can be considered as a white-box framework. In the framework, the hot spots, which are also abstracted to the top abstract class "Primitive" as abstract member functions, can be delegated to be implemented in some lower level abstract or concrete graphic classes. In this case, a hot spot may be divided into several smaller hot spots that vary in different descendant classes. For example, the "extensionArea()" function for all line classes can be implemented inside "Line" while the implementation of "endPoint()" and "tangetAngle()" are delegated further to the descendant classes. The sub-framework of "extensionArea()" for all line classes is shown in Figure 6.

Figure 5. The abstract model of graphic objects and the graphic database.

Figure 6. The sub-framework of "extensionArea()" for line classes.

3.2The Black-box Framework Architecture


Following the framework evolution guideline of Roberts and Johnson (1997), we update the generic graphics recognition framework from a white-box one to a black-box one, so that it can be applied to any graphic class, no matter the graphic class inherits from "Primitive" or not. The black-box framework is depicted as a parameterized class in Figure 7. In the framework, the parameter class "AGraphicClass" is the overall "hot spot" and the contract object, which can be easily plugged into the framework. It can be replaced with any class as long as the class meets the framework contract (the relationship among objects in the framework) depicted in Figure 7. However, the graphic class is preferred to inherits from the classes in Figure 4 in order to fully reuse the framework. Figure 8 shows three possible recognition applications of "RecognizerOf", "RecognizerOf", "RecognizerOf" by instantiating the parameterized class "RecognizerOf " using arguments of "DashedArc", "CharBox", "HatchedArea", separately.

Figure 7. The black-box framework for recognition of any class of graphic objects.

Figure 8. The black-box graphics recognition framework architecture and three possible applications.

template

class DetectorOf

{

DetectorOf() {}



void runWith(GraphicDataBase& gdb) {

while (1) {

AGraphicClass* gobj = new AGraphicClass();

Primitive* prm = gobj->findFirstComponentFrom(gdb);

if (prm == null)

return;


if (!gobj->fillWith(prm))

continue;

for (int d=0; d<=gobj-> numOfExtensionDirections(); d++)

while (extend(gobj, d, gdb));

if (!gobj->isCredible())

delete gobj;

else gobj->addTo(gdb)

}

}



boolean extend(AGraphicClass* gobj, int direction, GraphicDataBase& gdb) {

Area area = gobj->extensionArea(direction);

PrimitiveArray& candidates = gdb.search(area);

for (int i=0; i < candidates.getSize(); i++) {

if (!gobj->extensible(candidates[i]))

continue;

gobj->updateWidth(candidates[i]);

break;


}

if (i < candidates.getSize())

return true;

return false;

}

};

Figure 9. Outline of the C++ implementation of the generic graphics recognition algorithm.


4.Implematation and Applications of the Framework


We implement the graphics recognition framework using a C++ template class, as shown in the code in Figure 9. The application of the framework to a specific graphic class is as simple as the following line of code.

(new RecognizerOf())->runWith(gdb);



The graphics recognition framework is used as the kernel of the Machine Drawings Understanding System (MDUS) (Liu and Dori 1996, Dori and Liu 1998b). The framework has been applied to dashed line detection (Dori et al. 1996), text segmentation (Dori and Liu 1996), hatching line detection (Liu and Dori 1997), arc segmentation (Dori and Liu 1998a), leader and dimension set detection (Liu and Dori 1998a), and generic line detection (Liu and Dori 1998b). We have tested the graphics recognition framework with MDUS using real world drawings of various complexity levels. Experiments show that it is very successful in detecting many classes of graphic objects in engineering drawings.

5.Summary


We have presented the domain analysis, design, implementation, and applications of an object-oriented application framework for developing graphics recognition systems. It is based on the generic graphics recognition algorithm developed by Liu et al. (1995). The interfaces of the framework and potential filling components are defined in an abstract class—"Primitive"—which contains a set of pure virtual member functions. Some common graphic classes are organized into an inheritance hierarchy deriving from "Primitive". New concrete graphic classes can inherit from "Primitive", either directly or indirectly, and implement these member functions so that it can be plugged into the framework. However, it is also a black-box framework that can take as input any independent but well-defined graphic class component. It is implemented using a C++ template class with the graphic class used as parameter. Applications can be easily generated by instantiating the template class with a real graphic class, whose interface conforms to the framework contract. The applications of the framework to several classes of graphic objects have shown great success of the framework.

References

  1. Booch, G. (1994) Object-Oriented Analysis and Design with Applications, 2nd Ed., Benjamin-Cummings, Redwood, CA

  2. Coad, P. and Yourdon, E. (1991) Object-Oriented Analysis, 2nd Ed., Yourdon Press, Prentice-Hall, Englewood Cliffs, NJ

  3. Cohen, J. (1989) GTE Software Reuse for Information Management Systems. In Proceedings of the Reuse in Practice Workshop, eds. J. Baldo and C. Braun. Software Engineering Institute, Pittsburgh, PA

  4. Dori D. (1995) Vector-based Arc Segmentation in the Machine Drawing Understanding System Environment. IEEE Transactions on PAMI 17(11):959-971

  5. Dori D., Liu W., and Peleg M. (1996) How to Win a Dashed Line Detection Contest. In: Graphics Recognition -- Methods and Applications (Lecture Notes in Computer Science, vol. 1072), eds. Kasturi R and Tombre K, Springer, Berlin, pp 286-300

  6. Dori D. and Liu W. (1996) Vector-Based Segmentation of Text Connected to Graphics in Engineering Drawings. In: Advances in Structural and Syntactical Pattern Recognition (Lecture Notes in Computer Science, vol. 1121, Proc. of 6th International Workshop on Structural and Syntactical Pattern Recognition, Leipzig, Germany, August, 1996), eds. Perner P, Wang P, and Rosenfeld A, Springer, pp 322-331

  7. Dori D. and Liu W. (1998a) Stepwise Recovery of Arc Segmentation in Complex Line Environments. International Journal on Document Analysis and Recognition (IJDAR) 1(1)

  8. Dori D. and Liu W. (1998b) Automated CAD Conversion with the Machine Drawing Understanding System, to appear in IEEE Trans. on System, Man and Cybernetics 28(A5), Sept. 1998

  9. Fayad M.E. and Schmidt D.C. (1997) Object-Oriented Application Frameworks. CACM 40(10), 32-38

  10. Freeman, P. (1987) A Perspective on Reusability. In Tutorial: Software Reusability, ed. Freeman P., IEEE Computer Society Press, Washington, pp 2-8

  11. Hooper, J. W. and Chester R. O. (1991) Software Reuse: Guidelines and Methods, Plenum Press, New York

  12. Jacobson I., Christensson M., Jonsson P., and Overgaard G.G. (1992) Object-Oriented Software Engineering, Addison-Wesley, Reading, MA

  13. Johnson R.E. (1997) Frameworks = (Components + Patterns). CACM 40(10):39-42

  14. Johnson R.E. and Foote B. (1988) Designing Reusable Classes. Journal of Object-oriented Programming 1(5):22-35

  15. Krueger C.W. (1992) Software Reuse. ACM Computing Surveys 24(2):131-183

  16. Liu W., Dori D., Tang L. and Tang Z. (1995) Object Recognition in Engineering Drawings Using Planar Indexing, In: Proceedings of the First International Workshop on Graphics Recognition, Penn. State Univ., PA, USA, pp 53-61

  17. Liu W. and Dori D. (1996) Automated CAD Conversion with the Machine Drawing Understanding System, In: Proc. of 2nd IAPR Workshop on Document Analysis Systems, Malvern, PA, USA, October, pp 241-259

  18. Liu W. and Dori D. (1997) Recognition of Hatching Lines in Engineering Drawings. In: Proc. 13th Israeli Symposium of AI, CV, and NN, Tel Aviv University, Tel Aviv, Israel, February 1997. (An electronic version can be available at http://iew3.technion.ac.il:8080/~liuwy/papers/hatchtau.ps.gz)

  19. Liu W. and Dori D. (1998a) Genericity in Graphics Recognition Algorithms. In: Graphics Recognition -- Algorithms and Systems (Lecture Notes in Computer Science, Vol. 1389), eds. Tombre K. and Chhabra A., Springer, pp. 9-21

  20. Liu W. and Dori D. (1998b) A Generic Integrated Line Detection Algorithm and Its Object-Process Specification. Computer Vision and Image Understanding 70(2) (Special issue on Document Image Understanding and Retrieval)

  21. Pree W. (1994) Design Patterns for Object-Oriented Software Development, Addison-Wesley, Reading Mass

  22. Prieto-Diaz R. (1990) Domain Analysis: An Introduction. ACM Software Eng. Notes 15(2):47-54

  23. Rational (1997a), UML Semantics, v1.1, 1997, available from http://www.rational.com/uml

  24. Rational (1997b), UML Notation Guide, v1.1, 1997, available from http://www.rational.com/uml

  25. Roberts D. and Johnson R.E. (1997) Evolving Frameworks: A Pattern Language for Developing Frameworks. In: Pattern Languages of Program Design 3, eds. Riehle D., Fuschmann F., and Martin R.C., Addison-Wesley, Reading Mass



Yüklə 45,58 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©muhaz.org 2022
rəhbərliyinə müraciət

    Ana səhifə