Python Automation and Machine Learning for EM and ICs

An Online Book, Second Edition by Dr. Yougui Liao (2024)

Python Automation and Machine Learning for EM and ICs - An Online Book

Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

Canny Filter

The Canny filter is an edge detection algorithm that identifies sharp changes in intensity in an image, which correspond to edges of objects. Developed by John Canny in 1986, it is widely used in image processing and computer vision. The filter aims to detect edges while minimizing noise and avoiding the detection of false edges. The algorithm follows several steps: 

  • Noise Reduction: The image is smoothed using a Gaussian filter to reduce noise.
  • Gradient Calculation: The algorithm calculates the intensity gradient of the image using techniques like Sobel filters to find areas where the intensity changes rapidly.
  • Non-Maximum Suppression: After finding the gradient, it keeps only the local maxima, which are potential edges, and suppresses all other gradient values.
  • Double Thresholding: It uses two threshold values, a high and a low one. Edges with gradients above the high threshold are considered strong edges, while those between the two thresholds are considered weak edges. Edges below the low threshold are discarded.
  • Edge Tracking by Hysteresis: Weak edges that are connected to strong edges are kept, while the rest are discarded. This helps in reducing noise and refining edge detection.

The Canny filter is popular because it balances sensitivity to edges with noise reduction, making it effective for many image analysis tasks.

Canny filter. code:          
          Add a new slide on ppt     
Input:              
          Add a new slide on ppt
Output:              
          Add a new slide on ppt

============================================

Cross correlation between two images in any sizes. Multiscaling is used to avoid the issue caused by the different sizes of the template and original image, in order to find match in a original image, namely, the size of template is larger than the original image. code:          
          Add a new slide on ppt
          Add a new slide on ppt
Output:              
          Add a new slide on ppt

============================================

Image matching with cross correlation and overlap of template edge. code:          
          Add a new slide on ppt     

There can be an edge doubling issue from Canny edge detection which occurs due to the way Canny edge detection inherently works, where it detects both the leading and trailing edges of line features. To correct this and ensure that we measure from the middle of the line edges, we can modify the approach by dilating the edges and then finding contours, which will help in reducing the double-edge effect.