About this Journal Submit a Manuscript Table of Contents
Advances in Mechanical Engineering
Volume 2013 (2013), Article ID 259152, 7 pages
Research Article

Using Fuzzy Hybrid Features to Classify Strokes in Interactive Sketches

School of Mechanical Engineering, Northwestern Polytechnical University, P.O. Box 559, 127 YouYi Xilu, Xi’an, Shaanxi 710072, China

Received 5 June 2013; Accepted 22 July 2013

Academic Editor: Gongnan Xie

Copyright © 2013 Shuxia Wang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.


A novel method is presented based on fuzzy hybrid-based features to classify strokes into 2D line drawings, and a human computer interactive system is developed for assisting designers in conceptual design stage. Fuzzy classifiers are built based on some geometric features and speed features. The prototype system can support rapid classification based on fuzzy classifiers, and the classified stroke is then fitted with a 2D geometry primitive which could be a line segment, polyline, circle, circular arc, ellipse, elliptical arc, hyperbola, and parabola. The human computer interaction can determine the ambiguous results and then revise the misrecognitions. The test results showed that the proposed method can support online freehand sketching based on conceptual design with no limitation on drawing sequence and direction while achieving a satisfactory interpretation rate.

1. Introduction

Sketching is an effective means of visualizing information, which can convey information and rapidly express creative ideas. Sketching plays a key role in conceptual design process, in which conceptual designers frequently use vague and imprecise geometry to convey information via 2D or 3D sketches. A computer aided conceptual design (CACD) system which is based on the CAD system for the conceptual design with a user friendly interface can permit the geometric specification of these sketches [1] and permit online freehand sketching input [24]. However, conceptual designers still would rather use paper and pencil than operating CAD systems for expression, communication, and recording of novel ideas [5] due to the nonuser friendly interface of the CAD systems [6].

As part of CACD system, sketch recognition interface provides a paper-like interface for users to sketch their ideas [7], and automatically recognize them into line drawing which can seamlessly enter into the computer aided detail design step. Two main methods have been developed to solve the challenges of freehand sketch recognition, that is, (i) gesture-based recognizers and (ii) geometric-based recognizers. The first method only interprets freehand sketches as two-dimensional gestures by using some sketching constraints on the user. And the second method which focuses on the shapes rather than the gestures can interpret input stroke as geometrical shape [810]; to date, this method has obtained more and more attentions [11]. However, these geometric-based recognizers, which just can recognize basic primitives by thresholds and heuristic hierarchies, are not enough for ambiguous sketches. This paper presents a novel method for classifying stroke into geometry primitive based on fuzzy hybrid features. The approach consists of three stages: (i) stroke preprocessing, (ii) fuzzy hybrid-based features classifying, and (iii) human computer interaction. A prototype system, Online Freehand Sketch Recognition (OFSR), was developed successfully. Compared with the other low-level fuzzy recognizers [8, 9], this method displays three outstanding advantages: (i) it returns multiple interpretations when the freehand sketch is very ambiguous, (ii) it is much easier to correct the recognition errors when users find that the recognition result is not right, and (iii) it recognizes more primitives, for example, distinguishing circle from ellipse and circular/elliptical arc from open conic curve.

The paper structure is as follows: Section 2, which follows this introduction, summarizes the related works on online sketch classification models and methods; Section 3 demonstrates the method for classifying sketches; and Section 4 reports the implementation of the algorithm and shows some examples before the conclusion.

2. Related Works

Although more and more researchers reported the application of sketch in CAD modeling [1217], these reports focused on the feature recognition by using primitive recognition techniques. The main methods in these reports can be classified into two categories, namely, gesture-based recognition and geometric-based recognition.

The gesture-based recognition method is an active research area in robotics as well as in human computer interaction community [18]. This method typically focuses on how a sketch was drawn rather than on what the final sketch actually looks like. The typical goal of this method is to take an input stroke and classify each one into a set of predefined gestures [19]. In 1991, Rubine [20] firstly proposed thirteen features which could be used to classify simple gestures with an accuracy of 98% on a fifteen-class gesture set when trained with at least fifteen examples per class by using pen-based gesture recognition. But it can only handle single stroke which must be drawn in a predetermined manner. Later, Long et al. [21] extended Rubine’s features by decreasing two time-based features and increasing eleven new features. However, these two systems required strokes that are drawn in the same pattern. The ink features were presented in [22]. These feature sets were well designed, but they often troubled user because they need to be extracted by manual entry way. In a word, this approach used mathematical sound classifiers to produce fast classification along with normalized confidence value, but this method required individual training to give good recognition result. In addition, this method displays sensitivity to change in scale and rotation.

Due to the limitations of gesture-based recognition as described previously, a shift has occurred towards more geometric-based recognition [810]. For this reason, more and more single stroke recognition systems have been developed that do not use gesture-based approach but, rather, use geometric attributes to classify stroke in basic primitive [810]. This method has been used to describe shapes geometrically, focusing on what the sketch looks like and less on how it was actually drawn. This method includes two systems: (i) low-level system and (ii) high-level system.

In low-level system, the strokes are segmented into various primitives such as straight line and circle, which can be used to produce higher-level shapes. Yu and Cai [9] presented an alternative low-level sketch recognition. They introduced a feature area error metric and achieved near 98% accuracy. Sezgin et al. [8] reported an interesting work which focused on the low-level geometric descriptions by using scale space theory. They claimed that this theory looks like a promising way of detecting different scales inherent in the data and avoiding a priori judgments about the size of relevant features. The system was limited to only a few primitive shapes: lines, ellipses, and complex fits. For complex fits and vertex (corner) approximation, the authors reported an accuracy of 96%.

Typically, diagrams and sketches consist of symbols that are more complex than the primitives supported by these recognizers. Therefore, tools such as LADDER [23] have been created which allow users to describe higher-level symbols as a combination of lower level primitives meeting certain geometric constraints. UML diagrams, mechanical engineering diagrams, circuit diagrams, military course of action diagrams, and flow charts are all examples of various sketch systems that have been produced by using this shape definition language. However, it will be very difficult to define geometrical shape by using this method. Avola et al. [24] proposed a method to handle ambiguous strokes by introducing the spatial and temporal information that represent the user’s sketching, editing, and overtracing process. This method allows users to sketch in free manner without any sketching constraints. However, their method just focused on the ambiguity interpretation of the few geometrical elements including point, polyline, and polygon. Furthermore, the recognition accuracy was not very high except for a specific domain.

Comparing gesture-based methods with geometric-based methods, because the latter recognize a stroke to an ideal primitive using geometric formula, it is more natural, where the user can be allowed to draw without interruption to ensure a continuous flow of ideas. However, some of the present geometric-based methods just consider the geometry features and just blend the speed features. Some of them adopt a set of related fixed thresholds and are short of human computer interaction for ambiguous results and revising misrecognition.

3. New Methods

The OFSR system for the sketch classification process is shown in Figure 1. The geometry primitives (e.g., line segment, polyline, ellipse, etc.) can be recognized in the OFSR system. The classification method is based on four procedures, namely, (i) remove of redundant points in the stroke preprocessing, (ii) detection of shapes by using distinctive criteria that are based on hybrid features, (iii) determination of membership degree by using fuzzy logic to recognize primitives, and (iv) development of HCI tool for determining recognition results and revising misrecognition. Therefore, it allows recognition indeterminacy or error to be easily corrected or determined by the users through a simple click which could be used to switch to a human computer interaction.

Figure 1: Process of classification based on fuzzy hybrid features.
3.1. Stroke Preprocessing

In the OFSR system, a stroke is defined as a sequence of mouse positions which is obtained from pressing a button, moving the mouse while the button is still pressed, and releasing it. The split and merge algorithm of polygonal approximation is used to represent a stroke by an approximate polygon. The algorithm depends on a given threshold which is expressed by a measure function as described in [25]. Assuming a stroke is represented by a sequence of sampling points , where is the coordinate and time of the th point in the sampling list. The distance of any point from the line segment consisting of two endpoints is The sign of can be used to compute the deflected times from line segment between the first point and the last point. The normalized maximum absolute error is The stroke is represented initially as a line segment between the first and last points which were labeled as and , respectively (see Figure 2(a)). The farthest point from the straight line can be determined by (1). If the normalized maximum error is above a threshold, then the initial stroke will be represented as a polyline (), as shown in Figure 2(b). Then, the splitting algorithm is used recursively to calculate both of the line segments . The splitting algorithm will terminate when the normalized maximum error , for all sampling points along the polyline, is less than the threshold .

Figure 2: Split and merge method for an approximate polygon.

In the stroke preprocessing step, a sequence of vertices with drawing position and time can be obtained. The vertices are linked orderly to create a polyline which can represent the stroke. The vertices and the polyline are defined as polygon vertices and an approximate polygon, respectively.

3.2. Fuzzy Feature Detection

In order to solve the problems of imprecision and uncertainty when sketching by using the traditional method, in the OFSR system, fuzzy logic is used to determine the degree of membership for classifying strokes, which is a more natural method of handling ambiguities.

3.2.1. Fuzzy Logic

The selection of fuzzy membership functions is a key step in this process, and the functions should meet two requirements: (i) reflecting users’ intention correctly and precisely and (ii) high computational efficiency [26]. Three frequent triangular membership functions are shown in Figure 3.

Figure 3: Definition of membership function.

Consider In this paper, a general membership function is defined as depicted in (3) with three scalar parameters , , and , which can, respectively, represent the special triangular membership functions , normal triangular , and , as shown in Figure 3. These functions are shown in (4), respectively A stroke is classified by computing their degrees of membership. Each geometry primitive is defined by several fuzzy sets which do not have the same number of features for all primitives.

3.2.2. Fuzzy Feature

In our OFSR system, each classified stroke will be fitted into a corresponding conic curve (see (5)) by least median squares method. The open/closed classifier is used, which was detailed in [11] to detect open or closed when the stroke is in the conic section. This method permits users to draw a stroke by any direction of rotation. A closed conic can be circle or ellipse; otherwise it can be circular arc, elliptical arc, hyperbola, and parabola.


(1) Open/Closed Detection. Suppose a stroke is represented by a sequence of vertices with drawing position and drawing time. The open/closed detecting method is designed for determining open or closed when the stroke is a conic section. Firstly, the mass center of the stroke is calculated. Linking the mass center to the vertex accordingly, a sequence of radius vectors, , is built. In light of whether the cross product directions of all neighboring vectors are coincident, we can classify whether the stroke is conic section or not. If it is a possible conic curve, we calculate the circumferential angle between two adjacent radii in clockwise (positive value) and anticlockwise (negative values). A sequence of the corresponding circumferential angles is represented as . Define the sum of all circumferential angles as the rotation angle of this stroke. Comparing this rotation angle with the rotation angle of the closing conic curve, we can estimate easily whether the stroke is open or closed.

(2) Fitting Error Detection. By employing least median squares method [15] to fit the polygon vertices of a stroke to a conic curve in (5), we can get a series of constructed functions of fitting error detection. The mean absolute error is calculated as follow: Equation (7) is the standardized error measurement function with the stroke length : The measurement function of maximum absolute value is described as The membership functions of the aforementioned measurement functions for standardized error and maximum absolute value can be constructed by triangular membership function.

(3) Subdivision of Conic Curve. When a stroke is classified as conic curve, OFSR system will determine the details deeply. The invariants of conic section are used to filter the detail categories. For example, I2 can be used to determine the stroke which belongs to ellipse, hyperbola, or parabola. If the stroke is ellipse type, it will be segmented into closed (ellipse, circle) and open (ellipse arc, arc) by the aforementioned open/closed detection.

3.3. Hybrid-Based Classifiers

After drawing a new stroke, obtaining the polygon vertices by stroke preprocessing, a set of approximation features are calculated, such as first/last points, stroke length, enclosing rectangle of the stroke, and speed features. Each primitive employs various classifiers. Next, we exemplify how to develop hybrid-based classifiers for sketch recognition.

(1) Line-Segment Classifier. We classify line segment by comparing the length and its width of the minimum enclosure rectangle. The ratio will have values near 0 for line segment and near 1 for other geometry primitives. It ascertains that very slim stroke should be recognized as line segment.

(2) Polyline Classifier. For the polyline classifier, the stroke is broken into sub-strokes by the polygon vertices. First, a least median squares line is fitted to sub-stroke sampling points. The orthogonal average distance (OAD) between the fitted line and the sub-stroke sampling points is calculated, which is similar to the [27]. Second, the sum of orthogonal average distances for every sub-stroke is divided by the stroke length, which is defined as the least median squares error for the polyline fitting which must be below a certain threshold .

(3) Conic Section Classifier. Through the experiment analysis in the OFSR system, the membership functions of conic curve based on hybrid features are related to some aforementioned classifiers. The membership functions of conic section are different for open/closed strokes.

3.4. Classification with Human Interaction

In our OFSR system, a human computer interactive dialog is developed for determining the ambiguous recognition result and revising misrecognition, as shown in Figure 4. On the one hand, it is designed for resolving the indeterminacy by interaction with the users. In this OFSR system, whenever the fuzzy classifiers return more than one geometry primitive,in other word, whenever there are at least two values in all membership degree values close to 1, as a result, this OFSR system displays a dialog in which all possibilities are activated (see Figure 5(a)), allowing the user to choose their intentions by themselves.

Figure 4: Human interactive dialogs.
Figure 5: Examples of single stroke recognition.

On the other hand, it is designed for correcting the error recognition result. If the user finds that the recognition result is not in accordance with their intentions, the wrong result can be corrected easily by moving the mouse near the stroke. The user just needs to the click right-hand button of the mouse to activate the dialog of human computer interaction, as shown in Figure 5(b). This interactive method makes the stroke recognition easier and eliminates the need to redraw the sketch for the desired result.

4. Implementation and Examples

This OFSR system has been implemented on Windows XP by using Visual C++. This input sketch interface of OFSR system allows the user to sketch freely as though using pencil and paper. The input device is a computer mouse. The system interprets the strokes into geometry primitives, if the results are ambiguous, OFSR system will need the users to say the last word, as shown in Figure 5(c).

This OFSR system has been tested in many fields such as 2D/3D engineering drawing, flow chart, and statistical diagram, and some examples of them are shown in Figure 6. The first column shows the original sketches in different colors to indicate the difference strokes; the second column gives the comparisons of input sketches and recognition results; the recognition results are shown in the third column, which has consisted of 2D line drawings. The results show that the OFSR system can interpret users’ freehand single strokes into 2D line drawing correctly and effectively.

Figure 6: Examples of the application in different fields.

The OFSR system has been tested for 3D reconstruction from freehand sketches with several examples and some of them are shown in Figure 7. Figure 7(a) shows the original sketches, and Figure 7(b) gives the results of elementary recognitions. The endpoint clustering result and 3D reconstruction result are shown in Figures 7(c) and 7(d), respectively. Figure 7(e) is the recovered 3D model from the freehand sketches.

Figure 7: Examples of 3D reconstruction from freehand sketches.

This system gives users greater freedom to quickly specify 2D/3D geometry through 2D drawing and can encourage users with poor sketching skills to use it for a creative design task. Table 1 gives the statistical result of freehand sketch recognition. It can be inferred from the statistical data, before the human computer interaction, that recognition rates are all more than 97% except for hyperbolas and parabolas. The recognition rate can receive apparent improvement after the human computer interaction, especially the hyperbolas and parabolas.

Table 1: Statistical result of freehand sketch recognition.

5. Conclusion

This paper presents a novel stroke fuzzy classification method based on hybrid features to interpret sketches into line drawing for low-level recognition, which is aimed to enable the user to use it easily and intuitively. The OFSR system developed is capable of classifying eight primitive shapes including line segment, polyline, circle, circular arc, ellipse, elliptical arc, hyperbola, and parabola. The proposed method is suitable for online freehand sketching. It can easily correct the recognition errors and determining the recognition result by activating a dialog of human computer interaction. Furthermore, through the integration of our researches into the high-level sketch recognition system, we are developing interpretations system for fitting overtraced strokes [27]. The work presented here is only a part of our final sketched-based 3D modeling system. The future work is to improve the endpoint clustering method and reconstruct a 2D line drawing to 3D model.


This work was partly supported by National Natural Science Foundation of China (Grant no. 51105310).


  1. P. Serré, A. Ortuzar, and A. Rivière, “Non-cartesian modelling for analysis of the consistency of a geometric specification for conceptual design,” International Journal of Computational Geometry and Applications, vol. 16, no. 5-6, pp. 549–565, 2006. View at Scopus
  2. H. Lipson and M. Shpitalni, “Optimization-based reconstruction of a 3D object from a single freehand line drawing,” CAD Computer Aided Design, vol. 28, no. 8, pp. 651–663, 1996. View at Publisher · View at Google Scholar · View at Scopus
  3. L. Eggli, C.-Y. Hsu, B. D. Brüderlin, and G. Elber, “Inferring 3D models from freehand sketches and constraints,” CAD Computer Aided Design, vol. 29, no. 2, pp. 101–112, 1997. View at Scopus
  4. S.-F. Qin, D. K. Wright, and I. N. Jordanov, “A conceptual design tool: a sketch and fuzzy logic based system,” Proceedings of the Institution of Mechanical Engineers B, vol. 215, no. 1, pp. 111–116, 2001. View at Scopus
  5. S. Lim, S. F. Qin, P. Prieto, D. Wright, and J. Shackleton, “A study of sketching behaviour to support free-form surface modelling from on-line sketching,” Design Studies, vol. 25, no. 4, pp. 393–413, 2004. View at Publisher · View at Google Scholar · View at Scopus
  6. S. F. Qin, D. K. Wright, and I. N. Jordanov, “From on-line sketching to 2D and 3D geometry: a system based on fuzzy knowledge,” CAD Computer Aided Design, vol. 32, no. 14, pp. 851–866, 2000. View at Publisher · View at Google Scholar · View at Scopus
  7. G. Costagliola, T. Hammond, and B. Plimmer, “JVLC special issue on sketch computation,” Journal of Visual Languages and Computing, vol. 21, no. 2, pp. 67–68, 2010. View at Publisher · View at Google Scholar · View at Scopus
  8. T. M. Sezgin, T. Stahovich, and R. Davis, “Sketch based interfaces: early processing for sketch understanding,” in Proceedings of the 33rd International Conference on Computer Graphics and Interactive Techniques (SIGGRAPH '07), Boston, Mass, USA, August 2007. View at Scopus
  9. B. Yu and S. Cai, “A domain-independent system for sketch recognition,” in Proceedings of the 1st International Conference on Computer Graphics and Interactive Techniques in Australasia and South East Asia (GRAPHITE '03), pp. 141–146, February 2003. View at Publisher · View at Google Scholar · View at Scopus
  10. B. Paulson and T. Hammond, “PaleoSketch: accurate primitive sketch recognition and beautification,” in Proceedings of the 13th International Conference on Intelligent User Interfaces (IUI '08), pp. 1–10, January 2008. View at Publisher · View at Google Scholar · View at Scopus
  11. S. H. Bae, W. S. Kim, and E. S. Kwon, “Digital styling for designers: sketch emulation in computer environment,” in Computational Science and Its Applications, vol. 2669 of Lecture Notes in Computer Science, pp. 690–700, Springer, Berlin, Germany, 2003. View at Publisher · View at Google Scholar
  12. D. Pugh, “Designing solid objects using interactive sketch interpretation,” in Proceedings of the Symposium on Interactive 3D graphics, pp. 117–126, ACM, 1992.
  13. S. Donikian and G. Hégron, “A declarative design method for 3d scene sketch modeling,” in Proceedings of the Computer Graphics Forum, pp. 223–236, Wiley Online Library, 1993.
  14. M. Bloomenthal, R. Zeleznik, R. Fish et al., “Sketch-N-Make: automated machining of CAD sketches,” in Proceedings of the International Design Engineering Technical Conferences (IDETC '98), pp. 1–11, ASME, 1998.
  15. J. Pu, K. Lou, and K. Ramani, “A 2D sketch-based user interface for 3D CAD model retrieval,” Computer-Aided Design and Applications, vol. 2, no. 6, pp. 717–725, 2005. View at Scopus
  16. T. Ijiri, S. Owada, and T. Igarashi, “The sketch l-system: global control of tree modeling using free-form strokes,” in Smart Graphics, vol. 4073 of Lecture Notes in Computer Science, pp. 138–146, Springer, Berlin, Germany, 2006.
  17. L. Olsen, F. F. Samavati, M. C. Sousa, and J. A. Jorge, “Sketch-based modeling: a survey,” Computers and Graphics, vol. 33, no. 1, pp. 85–103, 2009. View at Publisher · View at Google Scholar · View at Scopus
  18. A. Basçetinçelik, WiiRobot: Controlling Robots With Wii Gestures, Department of Computer Science Brown University, Providence, RI, USA, 2009.
  19. B. Paulson, P. Rajan, P. Davalos, R. Gutierrez-Osuna, and T. Hammond, “What!?! no Rubine features? using geometric-based features to produce normalized confidence values for sketch recognition,” in Proceedings of the VL/HCC Workshop: Sketch Tools for Diagramming, pp. 57–63, IEEE, Herrsching am Ammersee, Germany, 2008.
  20. D. Rubine, “Specifying gestures by example,” in Proceedings of the 18th Annual Conference on Computer Graphics and Interactive Techniques, pp. 329–337, ACM, 1991.
  21. A. C. Long Jr., J. A. Landay, L. A. Rowe, and J. Michiels, “Visual similarity of pen gestures,” in Proceedings of the Conference on Human Factors in Computing Systems (CHI '00), pp. 360–367, April 2000. View at Scopus
  22. R. Patel, B. Plimmer, J. Grundy, and R. Ihaka, “Ink features for diagram recognition,” in Proceedings of the Sketch-Based Interfaces and Modeling, ACM SIGGRAPH/Eurographics Symposium, pp. 131–138, August 2007. View at Publisher · View at Google Scholar · View at Scopus
  23. T. Hammond and R. Davis, “LADDER, a sketching language for user interface developers,” Computers and Graphics, vol. 29, no. 4, pp. 518–532, 2005. View at Publisher · View at Google Scholar · View at Scopus
  24. D. Avola, M. C. Caschera, F. Ferri, and P. Grifoni, “Classifying and resolving ambiguities in sketch-based interaction,” International Journal of Virtual Technology and Multimedia, vol. 1, pp. 104–139, 2010.
  25. S. Wang, M. Gao, and L. Qi, “Freehand sketching interfaces: early processing for sketch recognition,” in Human-Computer Interaction. Interaction Platforms and Techniques, vol. 4551 of Lecture Notes in Computer Science, pp. 161–170, Springer, Berlin, Germany, 2007.
  26. C. L. P. Chen and S. Xie, “Freehand drawing system using a fuzzy logic concept,” CAD Computer Aided Design, vol. 28, no. 2, pp. 77–89, 1996. View at Publisher · View at Google Scholar · View at Scopus
  27. J. Wang, G. Lu, L. Chen, Y. Geng, and W. Deng, “Customer participating 3D garment design for mass personalization,” Textile Research Journal, vol. 81, no. 2, pp. 187–204, 2011. View at Publisher · View at Google Scholar · View at Scopus