Contour Tracing 2006. 03. 25 Seo, Jong-hoon Media System Lab. Yonsei University.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science for Some.
Advertisements

Two Segments Intersect?
Solving LP Models Improving Search Special Form of Improving Search
Graphs COP Graphs  Train Lines Gainesville OcalaDeltona Daytona Melbourne Lakeland Tampa Orlando.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
Graph Isomorphism Algorithms and networks. Graph Isomorphism 2 Today Graph isomorphism: definition Complexity: isomorphism completeness The refinement.
Brute-Force Triangulation
Playing Fair at Sudoku Joshua Cooper USC Department of Mathematics.
One of the most important problems is Computational Geometry is to find an efficient way to decide, given a subdivision of E n and a point P, in which.
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
By Groysman Maxim. Let S be a set of sites in the plane. Each point in the plane is influenced by each point of S. We would like to decompose the plane.
Some Basic Morphological Algorithm
September 10, 2013Computer Vision Lecture 3: Binary Image Processing 1Thresholding Here, the right image is created from the left image by thresholding,
Voronoi Diagram Presenter: GI1 11號 蔡逸凡
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Connected Components, Directed Graphs, Topological Sort COMP171.
An Euler Circuit is a cycle of an undirected graph, that traverses every edge of the graph exactly once, and ends at the same node from which it began.
1 Shira Zucker Ben-Gurion University of the Negev Advisors: Prof. Daniel Berend Prof. Ephraim Korach Anticoloring for Toroidal Grids.
Connected Components, Directed Graphs, Topological Sort Lecture 25 COMP171 Fall 2006.
Connected Components, Directed graphs, Topological sort COMP171 Fall 2005.
Using Social Networks to Analyze Sexual Relations by Amanda Dargie.
Digital Image Processing
 Jim has six children.  Chris fights with Bob,Faye, and Eve all the time; Eve fights (besides with Chris) with Al and Di all the time; and Al and Bob.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Triangulating a monotone polygon
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
Chapter 9.  Mathematical morphology: ◦ A useful tool for extracting image components in the representation of region shape.  Boundaries, skeletons,
CS 6825: Binary Image Processing – binary blob metrics
September 23, 2014Computer Vision Lecture 5: Binary Image Processing 1 Binary Images Binary images are grayscale images with only two possible levels of.
Genome Rearrangements Unoriented Blocks. Quick Review Looking at evolutionary change through reversals Find the shortest possible series of reversals.
Welcome to BC Splash!. Financial Planning The smart way to start planning for retirement before you turn 20.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
G52IVG, School of Computer Science, University of Nottingham 1 Edge Detection and Image Segmentation.
CGMB214: Introduction to Computer Graphics
Introduction Image geometry studies rotation, translation, scaling, distortion, etc. Image topology studies, e.g., (i) the number of occurrences.
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
CSCI 115 Chapter 8 Topics in Graph Theory. CSCI 115 §8.1 Graphs.
Digital Topology CIS 601 Fall 2004 Longin Jan Latecki.
COP 3530 Discussion Session #6 Yilin Shen. Outline Chapter 7 o Q35p 250 o Q39p 265 Chapter 8 o Problem 8.5.3: Rearranging Railroad carsp 289 o Problem.
Some Basic Relationships Between Pixels Definitions: –f(x,y): digital image –Pixels: q, p –Subset of pixels of f(x,y): S.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 11 Representation and.
Course 3 Binary Image Binary Images have only two gray levels: “1” and “0”, i.e., black / white. —— save memory —— fast processing —— many features of.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Relationship between pixels Neighbors of a pixel – 4-neighbors (N,S,W,E pixels) == N 4 (p). A pixel p at coordinates (x,y) has four horizontal and vertical.
TIRGUL 10 Dijkstra’s algorithm Bellman-Ford Algorithm 1.
1 GRAPHS – Definitions A graph G = (V, E) consists of –a set of vertices, V, and –a set of edges, E, where each edge is a pair (v,w) s.t. v,w  V Vertices.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
CS552: Computer Graphics Lecture 16: Polygon Filling.
Image Sampling and Quantization
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
IT472: Digital Image Processing
CSE 554 Lecture 1: Binary Pictures
Bitmap Image Vectorization using Potrace Algorithm
Computer Vision Lecture 13: Image Segmentation III
CSC317 Graph algorithms Why bother?
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Fill Area Algorithms Jan
Mean Shift Segmentation
Computer Vision Lecture 12: Image Segmentation II
Depth-First Search.
Computer Vision Lecture 5: Binary Image Processing
Binary Image processing بهمن 92
Connected Components, Directed Graphs, Topological Sort
Computational Geometry
Graph Implementation.
Presentation transcript:

Contour Tracing Seo, Jong-hoon Media System Lab. Yonsei University

Seo, Jong-hoon in MSL  Connectivity  Square Tracing Algorithm  Moore-Neighbor Tracing Algorithm  Radial Sweep Algorithm  Theo Pavlidis’ Algorithm Contents

Seo, Jong-hoon in MSL Connectivity  4-Connectivity ﻬ 4-neighbor: و A pixel, Q, is a 4-neighbor of a given pixel, P, if Q and P share an edge. و The 4-neighbors of pixel P : P2, P4, P6 and P8

Seo, Jong-hoon in MSL Connectivity  4-Connectivity(cont’) ﻬ Definition: و A set of black pixels, P, is a 4-connected component if for every pair of pixels p i and p j in P, there exist a sequence of pixels p i, …, p j s.t. a.All pixels in the sequence are in the set P i.e. are black, and b.Every 2 pixels that are adjacent in the sequence are 4-neighbors

Seo, Jong-hoon in MSL Connectivity  8-Connectivity ﻬ 8-neighbor: و A pixel, Q, is an 8-neighbor (or simply a neighbor) of a given pixel, P, if Q and P either share an edge or a vertex. و The 8-neighbors of a given pixel P make up the Moore neighborhood of that pixel.

Seo, Jong-hoon in MSL Connectivity  8-Connectivity(cont’) ﻬ Definition و A set of black pixels, P, is an 8-connected component (or simply a connected component) if for every pair of pixels p i and p j in P, there exists a sequence of pixels p i, …, p j s.t. a.All pixels in the sequence are in the set P i.e. are black, and b.Every 2 pixels that are adjacent in the sequence are 8-neighbors

Seo, Jong-hoon in MSL Square Tracing Algorithm  Main Idea ﻬ If the current pixel is black.  turn left ﻬ Otherwise (the current pixel is white.),  turn right ﻬ Until current pixel encounters the start pixel again.  The important thing in the square tracing algorithm is the “sense of direction”. The left and right turns you make are with respect to your current positioning, which depends on the way you entered the pixel you are standing on.  Therefore, it’s important to keep track of your current orientation in order to make the right moves.

Seo, Jong-hoon in MSL Square Tracing Algorithm (cont’) Algorithm Input: A square tessellation, T, containing a connected component P of black cells. Output: A sequence B(b 1, b 2, …, b k ) of boundary pixels i.e. the contour. Begin Set B to be empty From bottom to top and left to right scan the cells of T until a black pixel, s, of P is found. Insert s in B. Set the current pixel, p, to be the starting pixel, s. Turn left i.e. visit the left adjacent pixel of p. Update p i.e. set it to be the current pixel. While p not equal to s do If the current p is black Insert p in B and turn left (visit the left adjacent pixel of p). Update p i.e. set it to be the current pixel. Else Turn right (visit the right adjacent pixel of p). Update p i.e. set it to be the current pixel. End while End

Seo, Jong-hoon in MSL Square Tracing Algorithm (cont’)  Demonstration

Seo, Jong-hoon in MSL Square Tracing Algorithm (cont’)  Two problems ﻬ The Stopping Criterion a.Stop after visiting the start pixel n times, where n is at least 2, OR b.Stop after entering the start pixel a second time in the same manner you entered it initially. (This is called “Jacob’s stopping criterion.”)

Seo, Jong-hoon in MSL Square Tracing Algorithm (cont’)  Two problems ﻬ Fails to contour trace an 8-connected pattern

Seo, Jong-hoon in MSL Moore-Neighbor Tracing  Moore Neighborhood ﻬ The Moore neighborhood of a pixel, P, is the set of 8 pixels which share a vertex or edge with that pixel. These pixels are namely pixels P 1, P 2, P 3, P 4, P 5, P 6, P 7 and P 8. ﻬ The Moore neighborhood (also known as the 8-neighbors or indirect neighbors) is an important concept that frequently arises in the literature.

Seo, Jong-hoon in MSL Moore-Neighbor Tracing (cont’) Algorithm Input: A square tessellation, T, containing a connected component P of black cells. Output: A sequence B(b 1, b 2, …, b k ) of boundary pixels i.e. the contour. Define M(a) to be the Moore neighborhood of pixel a. Let b denote the current boundary pixel. Let c denote the current pixel under consideration i.e. c is in M(p). Begin Set B to be empty. From bottom to top and left to right scan the cells of T until a black pixel, s, of P is found. Insert s in B. Set the current boundary point p to s i.e. p=s Backtrack i.e. move to the pixel from which s was entered. Set c to be the next clockwise pixel in M(p). While c not equal to s do If c is black - insert c in B - set p=c - backtrack (move the current pixel c to the pixel from which p was entered) else - advance the current pixel c to the next clockwise pixel in M(p) end While End

Seo, Jong-hoon in MSL Moore-Neighbor Tracing (cont’)  Demonstration

Seo, Jong-hoon in MSL Moore-Neighbor Tracing (cont’)  Problem a.Stop after visiting the start pixel n times, where n is at least 2, OR b.Stop after entering the start pixel a second time in the same manner you entered in initially.  Jacob’s stopping criterion.

Seo, Jong-hoon in MSL Radial Sweep  Main Idea ﻬ It turns out that the Radial Sweep Algorithm is identical to Moore- Neighbor Tracing. ﻬ Every time you locate a new boundary pixel, make it your current pixel, P, and draw an imaginary line segment joining P to the previous boundary pixel. Then, rotate the segment about P in a clockwise direction until it hits a black pixel in P's Moore neighborhood. Rotating the segment is identical to checking each pixel in the Moore neighborhood of P.

Seo, Jong-hoon in MSL Radial Sweep (cont’)  Stopping Criterion ﻬ Conventional stopping criterion: و Terminates when “Jacob's stopping criterion” is satisfied. و But, this time can not use above criterion – this algorithm doesn’t define the concept of the “direction” in which it enters a boundary pixel.

Seo, Jong-hoon in MSL Radial Sweep (cont’)  Stopping Criterion (cont’) ﻬ Let B is a contour list that has P 1, P 2, …, P i in order. (As P 1 is the start pixel, and P i-1 is the previous boundary pixel of current boundary pixel P i. And as for the start pixel, we will assume that P 0 is an imaginary pixel – not equivalent to ANY pixel on the grid – which comes before the start pixel in the sequence of boundary pixels) ﻬ With the above assumptions in mind, we can define stopping criterion: ﻬ In other words, the algorithm terminates when it visits a boundary pixel, P, for a second time provided that the boundary pixel before P (in the sequence of boundary pixels) the second time around, is the same pixel which was before P when P was first visited. The algorithm terminates when: a.The current boundary pixel, P i, has appeared previously as pixel P j (where j<i) in the sequence of boundary pixels, AND b.P i-1 = P j-1

Seo, Jong-hoon in MSL Theo Pavlidis’ Algorithm  Important restriction regarding the direction in which you enter the start pixel ﻬ You can actually choose ANY black boundary pixel to be your start pixel as long as when you’re initially standing on it, your left adjacent pixel is NOT black. (“left” here is taken with respect to the direction in which you enter the start pixel)  Main Idea ﻬ Set P1, P2, and P3 as below (We will define P2 to be the pixel right in front of you, P1 is the pixel adjacent to P2 from the left and P3 is the right adjacent pixel to P2). ﻬ Like in the Square Tracing algorithm, the most important thing in Pavlidis’ algorithm is your “sense of direction”

Seo, Jong-hoon in MSL Theo Pavlidis’ Algorithm (cont’) Algorithm Repeat the following If pixel P1 is black Insert P1 in B Update p=P1 Move one step forward followed by one step to your current left else if P2 is black Insert P2 in B Update p=P2 Move one step forward else if P3 is black Insert P3 in B Update p=P3 Move one step to the right, update your position and move one step to your current left else if you have already rotated through 90 degrees clockwise 3 times while on the same pixel p terminate the program and declare p as an isolated pixel else rotate 90 degrees clockwise while standing on the current pixel p Until p=s (End Repeat)

Seo, Jong-hoon in MSL Theo Pavlidis’ Algorithm (cont’)  Demonstration

Seo, Jong-hoon in MSL Theo Pavlidis’ Algorithm (cont’)  Stopping Criterion ﻬ Instead of terminating the algorithm when it visits the start pixels for a second time, make the algorithm terminate after visiting the start pixel a third or even a fourth time. This will improve the general performance of the algorithm.

Seo, Jong-hoon in MSL Theo Pavlidis’ Algorithm (cont’)  Stopping Criterion (cont’) ﻬ Go to the source of the problem; namely, the choice of the start pixel و You take the start pixel as the pixel has no left adjacent pixel. - since you always consider the 3 pixels in front of you in a certain order, you’ll tend to miss a boundary pixel lying directly to the left of the start pixel in certain patterns. و Not only the left adjacent pixel of the start pixel is at risk of being missed, but also the pixel directly below that pixel faces such a threat. و Therefore, we suggest that a start pixel should be entered in a direction such that the pixels corresponding to pixels L, W and R show below are white.

Seo, Jong-hoon in MSL References   Applet  Theo Pavlidis  Jacob Eliosoff