41
Tracing and c Tracing and c ompressing ompressing digital curves digital curves András Hajdu Department of Computer Graphics and Image Processing Faculty of Informatics, University of Debrecen, Hungary 17th Summer School on Image Processing, July 2-11 2009, Debrecen.

Tracing and c ompressing digital curves

  • Upload
    gerek

  • View
    25

  • Download
    0

Embed Size (px)

DESCRIPTION

Tracing and c ompressing digital curves. András Hajdu Department of Computer Graphics and Image Processing Faculty of Informatics, University of Debrecen , Hungary 17th Summer School on Image Processing , Ju ly 2-11 2009, Debrecen . Overview of the problem. Overview - PowerPoint PPT Presentation

Citation preview

Page 1: Tracing and c ompressing digital curves

Tracing and Tracing and ccompressingompressing digital curvesdigital curves

András Hajdu

Department of Computer Graphics and Image ProcessingFaculty of Informatics, University of Debrecen, Hungary

17th Summer School on Image Processing, July 2-11 2009, Debrecen.

Page 2: Tracing and c ompressing digital curves

Overview Overview of the problemof the problem

Tracing a curve having Tracing a curve having general topologygeneral topology

Partitioning the curve Partitioning the curve into lineinto line s segmentsegments

Page 3: Tracing and c ompressing digital curves

Overview Overview of the proposed approachof the proposed approach

• Assign an underlying graph to the curve

• Find an Euler decomposition of the graph

• Trace the Euler components with respect to a linear optimality criterion at junctions

• Compress the curve components using an alphabet of line segments (polygon approximation)

Page 4: Tracing and c ompressing digital curves

Assigning an underlyingAssigning an underlyinggraph to the curve - Basicsgraph to the curve - Basics

• A graph G = ( V, E )V: set of vertices, E = V×V= {{v1, v2} | v1, v2 V }: set of edges.

• G is undirected, loops and multiple edges allowed.

• The degree of a vertex is the number of edges containing it.

• A path is a list of edges: {v1,v2}, {v2,v3}, . . . , {vn-1,vn}.

• A route is a closed path with v1= vn.

• A path containing all the edges exactly once is an Euler path (route)

Page 5: Tracing and c ompressing digital curves

Assigning an underlyingAssigning an underlyinggraph to the curve - Basicsgraph to the curve - Basics

• An Euler decomposition of G is the union of its edge-disjoint Euler subgraphs Gi (i=1,...,n).

• Results on Euler graphs and decompositions:– Every Euler graph is connected,

– A connected graph has Euler route iff all of its vertices have even degree,

– A connected graph has Euler path iff at most two vertices have odd degree,

– Every connected graph has an Euler decomposition.

Page 6: Tracing and c ompressing digital curves

Assigning an underlyingAssigning an underlyinggraph to the curvegraph to the curve

The curve tracing (CT) algorithm:

1. Assign a graph GC = ( VC, EC ) to the curve C, where VC contains all the end and junction points of C. The edges are the curve segments connecting these vertices.

2. Create an Euler decomposition Ci of C based on GC.

3. Trace all the Ci’s separately through their Euler paths.

i=1

n

Page 7: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -preprocessingpreprocessing

• The input can be any one-pixel wide self intersecting object (curve) for graph assignment.

• To guarantee one-pixel wideness, thinning can be applied first to remove undesired thickening pixels.

Page 8: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -locating verticeslocating vertices

• Vertices are assigned to curve junctions and end pointsJunctions: curve points with more than two 8-neighbors,

End points: curve points with exactly one 8-neighbor.

Page 9: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -extracting edgesextracting edges

• Non-vertex 8-neighbors of vertices with exactly two 8-neighbors are marked as edge end points.

• Edges are 8-connected paths connecting edge end points.

edge end point

edge point

junction point

Page 10: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -the underlying graphthe underlying graph

end points:1,10junction points:2,3,4,5,6,7,8,9,11,12,13

Page 11: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -junctions of special typejunctions of special type

• Junctions degenerate if tangents of curve segments almost coincide.

• Junction points closer than a threshold K are found, and the pixels between them are merged.

edge end point

edge point

junction point

degenaratedintersection

K = 2

K = 9

Page 12: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -tracing the componentstracing the components

• The first step to trace an Euler curve is to locate a starting vertex having odd degree.

• Then, we take an edge from the starting vertex to initialize the tracer.

possible starting vertices:1 (finishing at 10)10 (finishing at 1)possible starting edges:{1,4} (finishing with {8,10}){10,8} (finishing with {4,1})

Page 13: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -tracing through junctionstracing through junctions

• More Euler paths may exist. Which edge to take next at junctions?

• For better polygon approximation, go on straight:– calculate the centre of the junction having E1, . . ., Ek

edge end points (we arrive at E0)

– calculate the change of direction for all Ei:

– select the most linear direction towards El with:

Page 14: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - - tracing through junctions tracing through junctions

we arrive at E0 ... ... we go on with E2

Page 15: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - -restrictions for tracingrestrictions for tracing

The most straight direction cannot be always selected freely at junctions.

We must obey the graph traversal (Fleury’s) algorithmto extract an Euler path:– Always leave one edge available to get back to the

starting vertex or to the other odd vertex.– Do not use an edge to go to a vertex unless there is

another edge available to leave it.

Page 16: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - - complete tracing complete tracing

Euler path:{1,4,5,2,4,8,13,11,7,5,2,3,6,7,9,13,12,6,3,12,11,9,8,10}Start

End

Page 17: Tracing and c ompressing digital curves

Realization of CT algorithmRealization of CT algorithm - - complete tracing complete tracing of the of the

curvecurve

Page 18: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -steps of compressionsteps of compression

• A finite alphabet of digital line segments is defined.

• The traced curve is compressed online to replace curve segments with letters from the alphabet.

• Complementary variable length (Huffmann) coding is applied.

Page 19: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -alphabet of digital line segmentsalphabet of digital line segmentsΛ is a finite alphabet of Bresenham line segments of all orientations having length at most T.

T=6, first octant

Page 20: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -alphabet of digital line segmentsalphabet of digital line segments

all orientations

Page 21: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -alphabet of digital line segmentsalphabet of digital line segments

• Cardinality of Λ:

• Number of bits to code a letter:

To keep cardinality small, we consider unique (Bresenham) segments to connect two points.

Page 22: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -replacing curve segmentsreplacing curve segments

• Online curve compression is used:during tracing the curve, current curve segment is replaced from Λ if it violates linearity:

Information loss is allowed as Bresenham segments differ, but linearity is common criterion.

the segment should stay between two parallel lines [Rosenfeld and Klette].

Page 23: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with JBEAMcomparing with JBEAM

• JBEAM [Huo and Chen] is a state-of-the-art algorithm for the compresson of one-pixel wide objects.

• It divides binary (curve) imageusing quadtree decomposition till having single linear curve segments in cells to be substituted by beamlets.

Page 24: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with JBEAMcomparing with JBEAM

Test curvesTest curves

Euler curvesEuler curves Non-Euler curveNon-Euler curve(decomposition)(decomposition)

Page 25: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with JBEAMcomparing with JBEAM

~50% improvement

With tracing, the proposed CT algorithm avoids subdivision.

Page 26: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

• In MPEG-4 a vertex-based shape approximation was developed to code the outline of shapes.

• The boundary is approximated by a polygon, with a recursive splitting process that starts with the longest axis (diameter).

• If the distance of the curve and polygon segment is > dmax the segment is splitted into two new parts.

Page 27: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

ddmax max = 2 / 2= 2 / 2 guarantees straight polygon segments.guarantees straight polygon segments.ddmax max = 1= 1 had similar performance than the proposed.had similar performance than the proposed.ddmax max = 1.4= 1.4 is reported perceptually acceptable.is reported perceptually acceptable.

Page 28: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

Test curves (shapes have simple closed boundary)Test curves (shapes have simple closed boundary)

Page 29: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

~similar performance with MPEG-4 for dmax=1

(dmax=1 violates the linearity criterion for MPEG-4)

Page 30: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

Partitioned test curvesPartitioned test curves

Page 31: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -comparing with MPEG-4comparing with MPEG-4

MPEG-4 recommends the application of a complementary variable length coding, e.g. Huffmann coding

~50% improvement in compression performance.

Page 32: Tracing and c ompressing digital curves

Compressing the curve -Compressing the curve -more MPEG-4 improvementsmore MPEG-4 improvements

Some more minor recommendations from MPEG-4:

– For lossy shape coding the selection of the vertices on the object boundary is not optimal. Therefore, the vertices can be shifted by 1 pixel within a neighborhood of size 3 × 3.

– The maximal length of the alphabet elements can be fixed dynamically as the length of the longest polygon segment. In this case, this length information should be transmitted, as well.

Page 33: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –weighted graphsweighted graphs

• The same finite alphabet of line segments and online curve compression is considered.

• Weighted graph approaches can be considered with a natural weight function for the edges:

• The number of letters needed:

Page 34: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –weighted graphsweighted graphs

number of letters needed to compress edges (weights)

Page 35: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –compressing edges separatelycompressing edges separately

• Compression can be executed at edge level without tracing.

• This simple approach also avoids curve subdivision, but has drawbacks:– the coordinates of the start pixel of each curve

segment for appropriate geometric positioning.

– lack of junction information leads to distortion at junctions during decompression (the curve segments must be connected ad-hoc).

Page 36: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –compressing edges separatelycompressing edges separately

Optimal tracing performs well for curves having more straight sections (e.g. General, Lines)

Page 37: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –avoiding Euler decompositionavoiding Euler decomposition

• Our basic approach is to decompose every underlying graph into Euler subgraphs.

• Decomposition can be avoided with taking some edges more than once (Chinese Postman Problem, CPP).

• Advantage is that we can avoid graph decomposition.

• Disadvantage is the redundant compression of edges.

• Algorithmic solution is known for the CPP problem:we must try to select the redundant edges with keepingthe extra weight sum minimal.

Page 38: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –avoiding Euler decompositionavoiding Euler decomposition

• Vertices 1,2,3,12,16,17 are of odd degree (non-Euler)• Allowing edges {2,3} and {16,17} twice gives

minimal weight sum for an Euler traversal.

Page 39: Tracing and c ompressing digital curves

Alternative approaches –Alternative approaches –avoiding Euler decompositionavoiding Euler decomposition

Path with minimal weight sum:{1,6,7,4,6,10,15,13,9,7,4,{1,6,7,4,6,10,15,13,9,7,4,3,2,33,2,3,5,8,9,11,15,,5,8,9,11,15,16,17,1616,17,16,14,8,5,14,13,11,10,12},14,8,5,14,13,11,10,12}

Start

End

Page 40: Tracing and c ompressing digital curves

Discussion,Discussion,applicationsapplications

• To ”untie” curves can have impact in curve watermarking (with providing the data in terms of few large blocks)

• Tracing the curve according to its ”natural” direction looks feasible to reconstruct hand-written text or figures, or to classify vessel types (arterial/venous):

(image is from Rothaus et al. 2007)

Page 41: Tracing and c ompressing digital curves

Related publicationsRelated publications

• A. Hajdu and I. Pitas: Piecewise linear digital curve representation and compression using graph theory and a line segment alphabet, IEEE Trans. on Image Processing 17/2 (February 2008), 126-133.

• A. Hajdu and I. Pitas: Compression optimized tracing of digital curves using graph theory, IEEE International Conference on Image Processing (ICIP 2007), San Antonio, Texas, USA, Vol. VI, 453-456.

ACKNOWLEDGEMENTThis work was partially supported by the project SHARE: Mobile Support for Rescue Forces, Integrating Multiple Modes of Interaction, EU FP6 Information Society Technologies, Contract Number FP6-004218.