Labsmore / pyuscope

Python machine vision platform
BSD 2-Clause "Simplified" License
80 stars 17 forks source link

Focus correction improvements: 4-point or 3D-printer-style levelling #474

Open philpem opened 5 months ago

philpem commented 5 months ago

There's probably an element of "my setup is crap and should be improved but I'm not sure how" in this feature request, but I hope you can humour me!

I've been imaging a 10mm square (approximately, but it's big) SoC die this evening which is proving impossible to align for tilt/focus. My focus jig sits atop the XY table, and has a steel ball bearing and two springs in one corner, two thumbscrews on the corners adjacent to the ball, and an open gap diagonally opposite it. Normally this is fine for most chips, but I'm finding that for the SoC, if I adjust the thumbscrews so the three adjustable corners are focused "OK", the fourth corner is up in the air.

Sadly because Pyuscope only does 3-point focus interpolation, it has no hope of getting a good image of this chip - because the 4th focus measurement simply isn't there to work from.

I have two ideas for fixing this:

The "bed levelling" style suggestion I had would take 9 or 16 measurements in a grid - this would likely have to be done entirely manually, or manually for the corners and with Pyuscope using its Autofocus code to refine the measurements.

It would probably be necessary to have some kind of "margin" feature too, as I often image past the edge of the chip (to deal with mechanical quirks e.g. XY stage inaccuracy or the chip being rotated or chipped). Obviously it's not possible to focus on empty air - so the margin would move the focus points in towards the centre of the die by a configurable amount.