Replace your Calipers with a Microscope and Image Analysis

Getting a good measurement is a matter of using the right tool for the job. A tape measure and a caliper are both useful tools, but they’re hardly interchangeable for every task. Some jobs call for a hands-off, indirect way to measure small distances, which is where this image analysis measuring technique can come in handy.

Although it appears [Saulius Lukse] purpose-built this rig, which consists of a microscopic lens on a digital camera mounted to the Z-axis of a small CNC machine, we suspect that anything capable of accurately and smoothly transitioning a camera vertically could be used. The idea is simple: the height of the camera over the object to be measured is increased in fine increments, with an image acquired in OpenCV at each stop. A Laplace transformation is performed to assess the sharpness of each image, which when plotted against the frame number shows peaks where the image is most in focus. If you know the distance the lens traveled between peaks, you can estimate the height of the object. [Salius] measured a coin using this technique and it was spot on compared to a caliper. We could see this method being useful for getting an accurate vertical profile of a more complex object.

From home-brew lidar to detecting lightning in video, [Saulius] has an interesting skill set at the intersection of optics and electronics. We’re looking forward to what he comes up with next.

19 thoughts on “Replace your Calipers with a Microscope and Image Analysis

      1. Just realized the wording made it sound like the link I posted was my blog, it is someone else’s. Wish I was clever enough to have come up with that.

        Here are some other random things that came to mind while thinking about precision.

        http://pergatory.mit.edu/research/archive/Kotilainen/hydrobushing.htm

        http://www.microscopy-uk.org.uk/mag/indexmag.html?http://www.microscopy-uk.org.uk/mag/artaug09/ng-microwriter.html

        Somebody needs to write an article on the ruling engines used to make diffraction gratings.

  1. Awesome, I’ve been wondering about DIY optical measuring systems… especially with the quality of cameras that are cost effective more-so now. Seems we can do laser measuring easy also commercial off the shelf and I am guessing touch probe… though the later will be more complex… especially the resonating probes (feather probes).

    This is another reason (besides location and portability) I’m hesitant to built a multi-function CNC machine since I’m still overconfident that I can make something that can cover the full range of operations, i.e. plasma cutting, milling metal and other materials, laser cutting/pattern making/burning, water jetting, printing pretty much whatever, etc (other than a solar sintering system which would be a pain in the the liberal donkey to integrate indoors) and as noted in this neat article optical coordinate measuring systems.

    I holistically validated (hardware, software, standards, documents, training, methods) a OGP SmartScope Flash 500 System that was acquired before I implemented the Design Qualification (DQ) into the equipment life cycle SOP and was an interesting challenge with sabotage, slander, false pretense back stabbing and maybe even worse Perigo.

    Salius Lukse work is great.

      1. Yeah, seems like there is some middle point where the systems accuracy, volume used and portability can have systems combined with one design with like 80/20 material and suitable mounting platform… then the more accurate and rigid system needs something more heavy duty with hardened materials and even a granite table below with consideration for the environmental variables unless there are environmental sensors to mitigate and subtract the influence. I’ve not observed anything like before other than like say Cheyenne Mountain or maybe a refrigerator compressor where using springs to dampen and instead I’ve envisioned using springs and electronic (most likely electromagnetic) actuators. I’m probably overthinking and more in the range of sub micro-grams and ten-thousandths measurements. Thanks for the feedback.

  2. Awesome! I have a small Chinese toy CNC and I used a pointed top to measure z-depth via electrical contact (i.e. same autolovelling functionality used to Mill PCs just using a finer measurement grid and being ready to wait quite a bit). But this is faster, works with insulators and needs no physical contact! Is there already any software package to do this?

    1. Suimo, there are few pieces of code co control GRB, capture and process images. I guess in order to adapt to your cnc controller special plugin or dedicated software should be written. I might write specialized software package, but most likely it will not be compatible with cnc controller you use.

    2. I heard about Fiji/ImageJ but I forgot about it. I will have a look at it, thanks!
      I’m controlling my grbl-1.1f based CNC using bCNC (https://github.com/vlachoudis/bCNC). I tried several grbl command senders for MAC OS and so far I like bCNC the most: running z-probing depth measures was trivial. This software already supports a camera just for precise X-Y alignment (via OpenCV if I recall correctly), i.e. not for z-depth measurements nor to stitch together hi-resolution pictures. Thank you very much Saulius Lukse for this inspirational blog.

  3. In case anyone was wondering and didn’t already know, machine shops with advanced inspection capability use these for years now as a new class of machine called VMM- a vision measurement machine.

    They don’t work for everything, but its like the modern evolution of the old optical comparator. The physical measuring equivalent of these has been around for a while, called CMM- coordinate measuring machine.

    Not affiliated with them, but ny AMScope trinocular stereo microscope came with vision measurement software when I got a microscope camera- all you need to calibrate it is a graduated calibrated glass slide thats about 10$.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.