Draft:Edge Linking and Boundary Detection FOSIP
Submission declined on 14 May 2024 by Grabup (talk). This submission is not adequately supported by reliable sources. Reliable sources are required so that information can be verified. If you need help with referencing, please see Referencing for beginners and Citing sources.
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources
|
Edge Linking and Boundary Detection
[edit]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
[edit]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:
- Gradient-based: Compute the gradient of image intensity and find maxima, such as the Sobel, Prewitt or Canny operators.
- Laplacian-based: Find zero-crossings in the second derivative, such as the Marr–Hildreth operator.
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
[edit]The gradient of an image at location is given by:
Where and are the partial derivatives in the x and y directions respectively. These can be approximated by convolving with derivative filters such as:
Sobel Operators:
The gradient magnitude is used to identify edge pixels as those exceeding a threshold.
Laplacian of Gaussian (LoG)
[edit]
The LoG computationally approximates the second derivative, finding zero-crossings which indicate edges.
Example Canny Edge Detection
[edit]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
[edit]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
[edit]The Hough transform maps edge points to parameters of lines:
Curves in the image map to points in the parameter space. Boundaries correspond to peaks in the accumulator array counting co-linear points.
Edge Thinning
[edit]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
[edit]Thinning iteratively removes outer boundary pixels if certain conditions are met, based on consecutive neighbors in a square neighborhood .
Common algorithms evaluate a hit-or-miss transform kernel to identify removable pixels while preserving connectivity.
Example
[edit]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
[edit]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.