Presentation is loading. Please wait.

Presentation is loading. Please wait.

Master Training par Norolala Ramangaseheno Tutors : Eric Trupin, Tony Pridmore Date : 2005-09-06 Unformating SVG Documents Application To Graphic Document.

Similar presentations


Presentation on theme: "Master Training par Norolala Ramangaseheno Tutors : Eric Trupin, Tony Pridmore Date : 2005-09-06 Unformating SVG Documents Application To Graphic Document."— Presentation transcript:

1 Master Training par Norolala Ramangaseheno Tutors : Eric Trupin, Tony Pridmore Date : 2005-09-06 Unformating SVG Documents Application To Graphic Document Indexing FRE 2645

2 PSI 2005N. Ramangaseheno Unformating SVG Documents ● Presentation of the Project – Environment of Work – Introducing the Subject – Unformat Process Applied to Graphics Indexing ● Contributions ● Applications

3 PSI 2005N. Ramangaseheno Environment of Work Laboratories : DI (Document Interaction) team of PSI (Perception, Systèmes, Information) laboratory, University of Rouen, France, IPI (Image Processing and Interpretation) research group of SCSIT (School of Computer Science and Information Technology), University of Notthingham, England. Tutors : Eric Trupin, « Directeur de Recherche » within the PSI, Tony Pridmore, Senior Lecturer, member of IPIresearch group. Collaborations : Mathieu Delalandre, post-doc within the IPI group, Karim Zouba, master traineewithin the PSI. Integrated project : Indexation de graphiques vectoriels Programming language : Java Trainning period : april 2005 - september 2005

4 PSI 2005N. Ramangaseheno ● Presentation of the Project – Environment of Work – Introducing the Subject – Unformat Process Applied to Graphics Indexing ● Contributions ● Applications Unformating SVG Documents

5 PSI 2005N. Ramangaseheno Vector Graphics miyamoto.ai <rect x="400" y="100" width="400“ height="200" fill="yellow" stroke="navy" stroke-width="10" /> (a)(b) Common vector formats : AI (Adobe Illustrator) SVG (Scalable Vector Graphic) WMF (Windows Metafile) EPS (Encapsulted PostScript) DXF (AutoCAD) a vector graphic a SVG rectangle a WMF pen an EPS plane

6 PSI 2005N. Ramangaseheno Image Indexing Graphics types : - raster images or bitmaps - vector mages Indexing : automatic extraction of informative characteristics from multimedia containers to aid retrieval and browsing through large databases. Architecture of an image indexing system Graphic document Conception of visual descriptors Image signature Image database Measure of similarity Classification

7 PSI 2005N. Ramangaseheno ● ● Presentation of the Project – – Environment of Work – – Introducing the Subject – – Unformat Process Applied to Graphics Indexing ● ● Contributions ● ● Applications Unformating SVG Documents

8 PSI 2005N. Ramangaseheno Diagram of the Indexing System Vector graphic Analyzer Generator of synthetic documents Unformat process Low-level representation High-level representation

9 PSI 2005N. Ramangaseheno SVG document unformated document R2R1R3 Why unformat before analysing ? Problem with Unformating

10 PSI 2005N. Ramangaseheno region graph R2R1R3 acquiringmodellingfiltering SVG document unformated document Problem with Unformating

11 PSI 2005N. Ramangaseheno ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications Unformating SVG Documents

12 PSI 2005N. Ramangaseheno filtering parsing modelling intersection search Diagram of the Unformat System SVG document

13 PSI 2005N. Ramangaseheno ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications Unformating SVG Documents

14 PSI 2005N. Ramangaseheno The SVG Format Norm and advantages: ● ● W3C norm for describing 2D graphics => open standard ● ● Growing format => growig number of visualizers and users ● ● Vectorial description of graphical objects => scalablility ● ● Based on XML (described by a DTD); compatible with XLink, XPointer, CSS/XSL, and SMIL (animation language) => textual, separation between semantic and presentation ● ● Scripts and animations started on associated events => interactif Inconvenient : ● ● Lack of realism Adapté pour : ● ● Interactive geographic maps ● ● Technical drawings ● ● XML accounts <rect x="400" y="100" width="400“ height="200" fill="yellow" stroke="navy" stroke-width="10" /> (a)(b) a SVG rectangle

15 PSI 2005N. Ramangaseheno Structure of a SVG Document <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> Un joli rectangle Exemple : SVG tagcorresponding declaration SVG document group of objects geometrical shape,, ou text image definition of links link towards an internal graphical object

16 PSI 2005N. Ramangaseheno Common shapes ● Ellipse: ● Rectangle: ● Circle: ● Line: ● Polyline: ● Polygon: Complex shape ● Path: Geometrical Shapes

17 PSI 2005N. Ramangaseheno Unformating SVG Documents ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications

18 PSI 2005N. Ramangaseheno SAX Parser ● ● Any XML handling need a parser – – a parser is a syntaxic analyzer; it is placed between the XML file and the application – – a parser can be used : ● ● from a program (script, java, C++) ● ● from a navigator ● ● SAX, event driven parser – – handler methods called from special events – – file sequentially analyzed before being transmitted to the application Handler startDocument() startElement() endElement() endDocument() treated events Architecture of a SAX application

19 SVG Parsing SVG code vectorial representation PSI 2005N. Ramangaseheno Parser SAX startDocument() startElement() characters endElement() endDocument() SVG document graphical objects met events

20 PSI 2005N. Ramangaseheno Unformating SVG Documents ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications

21 OGraphic OGraphicImpl OPointOLine OHL OExtremityOJunction PSI 2005N. Ramangaseheno GOMLib [Delalandre 2004]: Graphical Objects Modelling Library XML and SVG export Multi-model : different representations possible Graphical Objects Modelling line graph hierarchical list hierarchical graph linked-squares point list line list

22 PSI 2005N. Ramangaseheno Unformating SVG Documents ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications

23 PSI 2005N. Ramangaseheno Filtering superfluous lines visuallly in reality Need filtering to respect orders 1 point of a 2D planimetry = 1 single representation

24 PSI 2005N. Ramangaseheno Preliminary Tests (1/2) Given - two lines L1 et L2 - b1(x b1,y b1 ) begin point of L1 ; b2(x b2,y b2 ) begin point of L2 - e2(x e2,y e1 ) end point of L1 ; e2(xe2,ye2) end point of L2 L1 isEqual L2 : L1 and L2 are equal if x b1 = x b2 ; y b1 = y b2 ; x e1 = x e2 ; y e1 = y e2 ; L1 isParallel L2 : L1 and L2 are parallel if (( x e1 - x b1 ) * ( x e2 - x b2 ) - ( y e1 - y b1 ) * ( y e2 - y b2 )) = 0 L1 isColinear p : a point p(x,y) is colinear to L1 if y = t * x + o (t = ( y e1 - y b1 ) / (x e1 - x b1 ) and o = y b1 - t * x b1 ) L1 isColinear L2 : L2 is colinear to L1 if L1 isColinear b2 and L1 isColinear e2b1e1 b2e2

25 PSI 2005N. Ramangaseheno L1 overlaps p : L1 overlaps a point p(x,y) if (( x - x b1 ) * ( x - x e1 )) < 0 or (( y - y b1 ) * ( y - y e1 )) < 0 L1 overlaps L2 : L1 overlaps L2 if L1 overlaps( b2 ) or L1 overlaps( e2 ) L1 isConnected p : L1 is connected to the point p(x,y) if b1 = p ore1 = p L1 isConnected L2 : L1 is connected to L2 if L1 isConnected b2 orL1 isConnected e2 l 1 is connected to l 2 Preliminary Tests (2/2)

26 Filtering Tests (1/3) PSI 2005N. Ramangaseheno L1 sameAs L2 : L1 and L2 are the same if L1 isEqual L2 orx b1 = x e2 ; y b1 = y e2 ; x e1 = x b2 ; y e1 = y b2 ; in this case, line L2 is filtered (erased) l 1 same as l 2

27 PSI 2005N. Ramangaseheno L1 includes L2 : L1 includes L2 case (a) : L2 totally included inside L1 if L1 isColinear L2 and L1 overlaps b2 and L1 overlaps e2 case (b) : L2 included inside and connected to L1 or L1 isConnected L2 and L1 isParallel L2 and [ L1 overlaps b2 or L1 overlaps e2 ] l 1 includes l 2 (a) (b) Filtering Tests (2/3)

28 PSI 2005N. Ramangaseheno L1 isJoined L2 : L1 and L2 join together case (a) : L1 is extended by L2, without overlapping if L1 isConnected L2 and L1 isParallel b2 and « L1 overlaps e2 » is false case (b) : L1 is extended by L2, with overlapping or L1 isColinear L2 and L1 overlaps L2 and L2 overlaps L1 l 1 and l 2 join together (a) (b) Filtering Tests (3/3)

29 PSI 2005N. Ramangaseheno Unformating SVG Documents ● ● Presentation of the Project ● ● Contributions – – Diagram of the Unformat System – – The SVG Format – – Parsing – – Modelling – – Filtering – – Intersection Search ● ● Applications

30 PSI 2005N. Ramangaseheno X junction T junction Multi-degree junction Segments separation Get Line Intersection (1/3)

31 PSI 2005N. Ramangaseheno Intersections processing algorithm   Search and list all junctions of the document,   For each line, test if it contains the junction   If yes, break the line in two at the junction point Used tests L1 isIntersected L2 : L1 and L2 intersects themselves on a point p(x,y) so that p <-- L1 getIntersection L2 case (a) : X junction if p is not null case (b) : T junction if p is null L1 overlaps p and L2 overlaps p or L1 isConnected p and L2 overlaps p or L2 isConnected p and L1 overlaps p In both cases, add junction p(x,y) to the junctions list Get Line Intersection (2/3)

32 L1 isIntersected L2 : returns intersection point p(x c,y c ) between lines L 1 and L 2 null if lines are parralel or colinear null if x<0, y<0 Four cases to take into account : 1.L 1 and L 2 are regular y 1 = a 1 * x 1 + b 1 ; y 2 = a 2 * x 2 + b 2 ; y c = y 1 = y 2 ; x c = x 1 = x 2 ; x c = (b 2 - b 1 )/(a 1 - a 2 ) ; y c = a 1 * x c + b 1 = a 2 * x c + b 2 ; 4. L 1 and L 2 are irregular (see case 2.) Two cases: L 1 is vertical, L 2 horizontal L 2 is vertical, L 1 horizontal PSI 2005N. Ramangaseheno Get Line Intersection (3/3) 2. L1 is regular, L2 irregular Two cases: L 2 is horizontal y 1 = a 1 * x 1 + b 1 ; x 2 = c ; -  y 2   ; y c = c ; x c = (c - b 1 )/ a 1 ; L 2 is vertical y 1 = a 1 * x 1 + b 1 ; y 2 = c ; -  x 2   ; x c = c ; y c = a 1 * c + b 1 ; 3. L1 is irregular, L2 regular (see case 2.) Two cases: L 1 is horizontal L 1 is vertical

33 PSI 2005N. Ramangaseheno ● ● Presentation of the Project ● ● Contributions ● ● Applications Unformating SVG Documents

34 PSI 2005N. Ramangaseheno Experiments & Results (1/3) Unformating results on SVG documents created with the 2gT system ("graphic ground Truth").

35 PSI 2005N. Ramangaseheno Colour index – – black vectors : no change – – red vectors : filtered vectors – – blue vectors : « broken »vectors «visually », all original lines are retrieved After reduction, we do see that all intersections have been erased original SVG document unformated documentafter reduction of 20% Experiments & Results (2/3)

36 PSI 2005N. Ramangaseheno Algorithm complexity : n(n-1) Filtering : n + (n-1) + (n-2) + … + 1 comparaisons Intersections retrieval : n + (n-1) + (n-2) + … + 1 comparaisons Runtime : about 1,5 min for 100 documents (2500 vectors and 100 intersections per document) Experiments & Results (3/3)

37 Conclusion PSI 2005N. Ramangaseheno Outcome Technical achievement Unformating system effective and functional Perspectives Use upstream pattern recognition tools


Download ppt "Master Training par Norolala Ramangaseheno Tutors : Eric Trupin, Tony Pridmore Date : 2005-09-06 Unformating SVG Documents Application To Graphic Document."

Similar presentations


Ads by Google