You can edit almost every page by Creating an account and confirming your email.

Edge Linking and Boundary Detection FOSIP

From EverybodyWiki Bios & Wiki

Edge Linking and Boundary Detection

Edge linking and boundary detection are fundamental techniques in digital image processing and computer vision for identifying the boundaries or edges of objects within an image. These methods are used to segment an image into distinct regions corresponding to different objects or parts of objects.

Edge Detection

The first step is to apply an edge detection operator to the image to identify pixels where there are sharp intensity changes or discontinuities. Common edge detection algorithms include:

The output is typically a binary image with pixels marked as edge (1) or non-edge (0). However, edges are usually thick and disconnected after applying these operators.

Gradient-Based Edge Detection

The gradient f of an image f(x,y) at location (x,y) is given by:

f=[GxGy]=[fxfy]

Where Gx and Gy are the partial derivatives in the x and y directions respectively. These can be approximated by convolving with derivative filters such as:

Sobel Operators:

Gx=[+101+202+101]*AandGy=[+1+2+1000121]*A

The gradient magnitude |G|=Gx2+Gy2 is used to identify edge pixels as those exceeding a threshold.

Laplacian of Gaussian (LoG)

LoG(x,y)=1πσ4(1+x2+y22σ2)e(x2+y2)/2σ2

The LoG computationally approximates the second derivative, finding zero-crossings which indicate edges.

Example Canny Edge Detection

import cv2
import numpy as np 
from matplotlib import pyplot as plt

img = cv2.imread('sample.jpg',0)
edges = cv2.Canny(img,100,200)

plt.subplot(121),plt.imshow(img,cmap='gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap='gray')
plt.title('Edge Image'), plt.xticks([]), plt.yticks([])
plt.show()

Edge Linking

Once we have a binary edge image, the next step is to link the edges together into coherent edge chains or curves corresponding to the boundaries of objects. Common algorithms include:

  • Hough Transform: Maps edge points to parameters of lines/curves, clustering peaks identify boundaries.
  • Graph Search: Treat edge points as nodes, link neighbors with 8-connectivity, find minimum cost boundaries.

The output is a list of linked edge point coordinates representing the object boundaries.

Hough Transform

The Hough transform maps edge points (xi,yi) to parameters (r,θ) of lines:

r=xicosθ+yisinθ

Curves in the (x,y) image map to points in the (r,θ) parameter space. Boundaries correspond to peaks in the accumulator array H(r,θ) counting co-linear points.

Edge Thinning

The extracted boundaries are often thick after linking due to the initial edge operator response. So a final thinning step is applied to obtain thin, one pixel-wide boundary curves. Popular thinning algorithms include:

  • Morphological thinning: Successively erode away outer boundary pixels without breaking connectivity.
  • Tracking Methods: Follow the boundary, keeping only selected pixels on the medial axis.

Morphological Thinning

Thinning iteratively removes outer boundary pixels p if certain conditions are met, based on consecutive neighbors in a square neighborhood N(p).

Common algorithms evaluate a hit-or-miss transform kernel to identify removable pixels while preserving connectivity.

Example

import cv2
import numpy as np

img = cv2.imread('sample.jpg',0)  
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS,(3,3))
edges = cv2.Canny(img,100,200)
dilated = cv2.dilate(edges,kernel,iterations=1)
eroded = cv2.erode(dilated,kernel,iterations=1) 
result = cv2.bitwise_and(dilated,eroded)

cv2.imshow('Thinned Edges',result)
cv2.waitKey(0)
cv2.destroyAllWindows()

Applications

Boundary detection has many applications in image analysis, including:

  • Object recognition and classification
  • Shape analysis and measurement
  • Motion tracking and segmentation
  • Medical image analysis (organ/tumor boundaries)
  • Machine inspection (defect detection)

While conceptually simple, reliable boundary detection remains a challenging problem, especially for objects with complex, irregular shapes or in the presence of noise, occlusions, and other artifacts.


This article "Edge Linking and Boundary Detection FOSIP" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Edge Linking and Boundary Detection FOSIP. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.