Chip border extraction - I

Welcome to my series on microchip-image extraction techniques.

This algorithm was designed during my internship in a microchip manufacturing factory. Its primary objective is to autonomously compute the sizes and positions of chips within a package, simplifying subsequent processing by a machine operator. Our approach relies on employing discrete Fourier transformations on images, and a method was chosen for its efficacy in distinguishing repetitive patterns. You can find full code in my GitHub.

Let’s take a look into the images that the algorithm takes.
Each image captures a package segment, potentially depicting different package sizes and orientations. Before outlining the borders of the chips, it’s crucial to cut the potential boundaries to mitigate their impact on the element’s frequencies in the Fourier analysis. Numerous algorithms exist for edge extraction, each with merits and drawbacks. I experimented with various techniques, including random pixel searches near edges [1], only to discover that they are too complicated to use in the current scenario, where chip borders are already parallel with the image axes.

Initial

Given the noise from multi-camera sensors and ambient lighting, we normalize the image colors, convert them to grayscale, and apply a median filter for smoothing:

normalized = 255*(original - np.min(original))(np.max(original)-np.min(original))

filtered = scipy.signal.medfilt(normalized, 7)
filtered[filtered < np.percentile(filtered.reshape(-1), 60)] = 0

smoothed = gaussian_filter(filtered, sigma=55)

Process

Typically, chip borders exhibit darker shades near the edges where light coverage is limited. Hence, we identify darker pixels within the 10th percentile of the color distribution. Subsequently, we employ a filter with a large sigma to approximate the chip locations and generate the chip masks:

masked = original >= np.percentile(smoothed, 50)

Mask

Moving forward, we’ll implement a technique for rough border extraction:

  1. Imagine a line parallel to the image border that is initially located on one of the image borders.
  2. Start moving this line from one edge of the image to the opposite.
  3. If the line intersects the chip mask, stop it and proceed to the next edge.

Initial

Why is this method considered a rough estimation?
- The chip mask was derived using intense smoothing, obscuring the actual edges! Bad crop

To correct this, we’ll employ a reverse process:

  1. Extend each stopped line from its new position to the edge of origin.
  2. When the mean color along the line falls below a predefined threshold, stop the line again.
  3. Now, we can be sure that all lines align with the chips’ edges or the image boundaries. Valid crop

Finally, the edges are being cropped out, and we obtain a new image containing only chip data, ready to be processed in the next steps!

References

  1. Hongdou Ren, Shengmei Zhao, and Jozef Gruska, “Edge detection based on single-pixel imaging,” Opt. Express 26, 5501-5511 (2018)

Developing an alorithm for chip package border removal

By Lohachov Mykhailo, 2023-01-11