Thursday, May 31, 2012

Measuring pipe diameter by machine vision

Control Engineering magazine has an interesting story on their website about a Cognex VisionPro application, and it’s left me scratching my head.

Vision-guided robots automate oil tool assembly” (April 19th, 2012) describes an application where a robot threads a pipe end, then screws on a cap. One of the challenges in this is to deal with various diameters of pipe.
The approach chosen by integrator JMP Engineering is described thus: “A brick red light shines on the pipe at an oblique angle to create a shadow that enables accurate measurement of the pipe diameter.” There’s a picture in the article that shows what the camera sees as a result of this lighting approach. (I’m not copying it here because I don’t want to run afoul of copyright.)

Leaving aside the fact that I think they actually mean a red brick light is used, (“brick red” is hardly an engineering term,) what the lighting does is to make the pipe white in the image, with a semicircular shadow in the bore. I presume that VisionPro analyzes this shadow to determine the diameter, but I’m not exactly sure how.

My guess is there’s some dark blob detection followed by extraction of some key parameter, perhaps the feret diameter, but I’m not sure and frankly, I’m rather intrigued. So please click the link above and read the article, then let me know how you’d approach the diameter measurement task.


Anonymous said...

It sounds like they're fitting a circle (or a 3d projection of a circle, if cognex supports that) to the left part of the pipe opening where they have a high contrast edge.

Kevin Ackerman said...

I first used a PatMax to roughly find the location of the pipe, then used a 'FindCircle' tool. The FindCircle can work on an arc, which made this possible. It very accurately found the center and diameter of the pipe. (Center used for proper location of threading robot, diameter used just as a sanity check to make sure correct pipe size present).