Presentation is loading. Please wait.

Presentation is loading. Please wait.

October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet.

Similar presentations


Presentation on theme: "October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet."— Presentation transcript:

1 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet the following criteria: Efficiency: The contour should be a simple, compact representation. Efficiency: The contour should be a simple, compact representation. Accuracy: The contour should accurately fit the image features. Accuracy: The contour should accurately fit the image features. Effectiveness: The contour should be suitable for the operations to be performed in later stages of the application. Effectiveness: The contour should be suitable for the operations to be performed in later stages of the application.

2 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 2Contours The accuracy of a contour representation is determined by the form of the curve used to model the contour, the form of the curve used to model the contour, the performance of the curve-fitting algorithm, and the performance of the curve-fitting algorithm, and the accuracy of the estimation of edge locations. the accuracy of the estimation of edge locations. Using an ordered list of edges as the representation is simple and as precise as the edge information itself. It is not a compact representation and may be difficult to process in subsequent stages.

3 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 3Contours Using an appropriate curve model increases the accuracy of the representation. This is because errors in the location of individual edges can be eliminated (if the correct model is used!). The result is a more compact representation that is well-suited for subsequent analysis. We will talk about the elementary differential geometry of 2D curves, the elementary differential geometry of 2D curves, techniques for calculating contour properties, and techniques for calculating contour properties, and curve models and how to fit them to contours. curve models and how to fit them to contours.

4 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 4Definitions We will use the term edge to refer to edge points regardless of the edge orientation. Most standard algorithms do not consider the orientation of edges, but just their location. Definitions: An edge list is an ordered set of edge points or fragments. A contour is an edge list or the curve that has been used to represent the edge list. A boundary is the closed contour that surrounds a region.

5 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 5 Geometry of Curves We usually avoid the description of curves in the x-y plane by functions of the kind y = f(x). This is because this notation only allows one y-value for a given x-value. So, for example, it cannot be used to describe a circle, rectangle, or any other closed contour. Instead, we will use the parametric form (x(u), y(u)). It uses two functions x(u) and y(u) of a parameter u to specify the points along the curve from a starting point p 1 = (x(u 1 ), y(u 1 )) to an end point p 2 = (x(u 2 ), y(u 2 )).

6 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 6 Geometry of Curves The length of the curve is given by the arc length: The unit tangent vector is given by: where p(u) = (x(u), y(u)) and p’(u) = (x’(u), y’(u)).

7 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 7 Geometry of Curves Imagine three points along our curve: p(u +  ), p(u), and p(u -  ). If these three points all differ from each other, then there is exactly one circle that passes through all three points. In the limit   0, this circle is the osculating (touching) circle of the curve at the point u. The center of this circle lies along the line containing the normal to the curve at point u. The curvature is the inverse of the radius of the osculating circle.

8 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 8 Digital Curves When we are dealing with actual curves in digital images, the situation is slightly different. There are only eight possible angles between neighboring pixels, which makes the computation of slope and curvature difficult. The idea to overcome this problem is to also account for non-adjacent edge points. Let p n = (i n, j n ) be the coordinates of edge n in our edge list. Then the k-slope is the (angle) direction vector between points that are k edges apart.

9 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 9 Geometry of Curves The left k-slope is the direction from p n-k to p n, and the right k-slope is the direction from p n to p n+k. The k-curvature is the difference between the left and right k-slopes. If we have N edge points (i 1, j 1 ) to (i N, j N ) in the edge list, then we can approximate the length S of the digital curve as follows:

10 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 10 Fitting Curve Models to Edges Most contours can be well described by combining several “round” elements (e.g., circular arcs) and “straight” elements (straight lines). First we will study a method for fitting connected straight lines to edge data. First we will study a method for fitting connected straight lines to edge data. Then we will discuss how to fit a circular arc to a given set of points. Then we will discuss how to fit a circular arc to a given set of points. Later we will apply a very general and sophisticated method (the Hough transform) for fitting straight lines to edge points. Later we will apply a very general and sophisticated method (the Hough transform) for fitting straight lines to edge points.

11 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 11 Fitting Curve Models to Edges Assume that you found edge data that seem to belong to one contour. The shape of these data is somewhat non-linear, but you would like to use multiple connected straight lines (polylines) to describe the contour. Then you can use the technique of polyline splitting. If you have an open contour, start with a straight line connecting the two (estimated) end points. If you have a closed contour, start with an appropriate polygon (a rectangle usually works well).

12 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 12 Fitting Polylines to Edges Let us look at an example for an open contour: First, use a single straight line to connect the end points. Then find the edge point with the greatest distance from this straight line.

13 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 13 Fitting Polylines to Edges Let us look at an example for an open contour: Then split the straight line in two straight lines that meet at this point. Now repeat this process with each of the two new lines.

14 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 14 Fitting Polylines to Edges Let us look at an example for an open contour: Recursively repeat this process until the maximum distance of any point to the polyline falls below a certain threshold. The result is the fitting polyline.

15 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 15 Fitting Circular Arcs to Edges Now we will discuss how to fit a circular arc to a set of edge points. Consider three points p 1 = (x 1, y 1 ), p 2 = (x 2, y 2 ), and p 3 = (x 3, y 3 ), which are pairwise different and do not lie on the same straight line. Then we already know that there is exactly one circle that goes through all of these points. We will now describe how to find this circle, i.e., determine its center and radius.

16 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 16 Fitting Circular Arcs to Edges The points (x, y) of a circle centered at (x 0, y 0 ) and with radius r are given by the following equation: (x – x 0 ) 2 + (y – y 0 ) 2 = r 2. To simplify the computation, we will use a coordinate system whose origin is in point p 1 = (x 1, y 1 ). In the new coordinate system we have: x’ = x – x 1 y’ = y – y 1 (x’ – x’ 0 ) 2 + (y’ – y’ 0 ) 2 = r 2.

17 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 17 Fitting Circular Arcs to Edges Since the equation (x’ – x’ 0 ) 2 + (y’ – y’ 0 ) 2 = r 2 is true for all points (x’, y’) on the circle, it must also apply to p 1, p 2, and p 3. Substituting (x’, y’) with p 1, p 2, and p 3 gives us: x’ 0 2 + y’ 0 2 - r 2 = 0 x’ 2 2 - 2x’ 2 x’ 0 + x’ 0 2 + y’ 2 2 – 2y’ 2 y’ 0 + y’ 0 2 - r 2 = 0 x’ 3 2 - 2x’ 3 x’ 0 + x’ 0 2 + y’ 3 2 – 2y’ 3 y’ 0 + y’ 0 2 - r 2 = 0 Subtract the first equation from the other two: 2x’ 2 x’ 0 + 2y’ 2 y’ 0 = x’ 2 2 + y’ 2 2 2x’ 3 x’ 0 + 2y’ 3 y’ 0 = x’ 3 2 + y’ 3 2

18 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 18 Fitting Circular Arcs to Edges This gives us two linear equations with two unknown variables x’ 0 and y’ 0. From these we can easily determine the center (x’ 0, y’ 0 ) of the circle. The radius of the circle can then be determined by: r 2 = x’ 0 2 + y’ 0 2. We simply add (x 1, y 1 ) to (x’ 0, y’ 0 ) to get the center (x 0, y 0 ) of the circle in the original coordinate system. Then we have completely determined the circle going through points p 1, p 2, and p 3.

19 October 14, 2014Computer Vision Lecture 11: Image Segmentation I 19 Fitting Circular Arcs to Edges In practice we usually have more than three edge points through which we want to fit a circular arc. One possible way to do the fitting in such a case is to take the two end points of those edges as points p 1 and p 2. Then we successively take every other edge point as point p 3 and fit a circular arc to each generated set of points p 1, p 2, and p 3. In each case, we measure the deviation of the arc from all edge points. The arc with minimum deviation is chosen as the curve model for these edges.


Download ppt "October 14, 2014Computer Vision Lecture 11: Image Segmentation I 1Contours How should we represent contours? A good contour representation should meet."

Similar presentations


Ads by Google