Machine vision with the Raspberry Pi
If you’ve been living under a technological rock for the last few years, the Raspberry Pi is a single-board computer available for under $50. This device is capable of many computing tasks and, because of its low cost and small form factor, it’s popular in MakerPro projects for small robotics applications or even video game cabinets. Controlling motors, taking basic sensor inputs, or even running older video games is fun, but using vision systems capabilities could make things much more interesting.
For a little more insight into the Raspberry Pi itself, here’s a great discussion of what it can do in an image processing context, along with some specifics as to how to use it. What is interesting to me, coming from an industrial context, is the fact that the program and libraries used (Python and OpenCV/SimpleCV) work not directly from the webcam or dedicated Raspberry Pi camera, but instead process the images the camera has taken and stored in memory. I suppose this is what is going on with any vision system, but having programmed industrial applications, one doesn’t really think about this aspect.
Those making the jump from industrial systems will immediately notice that this piece of software has the ability to recognize nondescript shapes of a certain color called “blobs”. This can be used to judge how large something is, perhaps recognizing a defect like a hole or missing part in an assembly. Line recognition will also be familiar, and probably many of the other tools available. On the other hand, facial recognition, though useful in many contexts, is not something an engineer in manufacturing would generally run into.
One thing that seems to be universal with this type of system is that, according to that write-up linked above, “Lighting plays a primary role, and the same goes for the distances, the camera angle, the dimensions, the contract, and the color uniformity.” I also wouldn’t expect all cameras that can be hooked up to the ‘Pi to display things quite the same way.
Related to lighting and the type of camera used, one has to recognize that there is sometimes a fine line between what the computer recognizes as a straight line or a dark or white spot. Vision systems are amazing pieces of equipment, and even more amazing is that they can now be implemented with a Raspberry Pi, but one has to recognize their limits and plan accordingly.
For a video tutorial of how to install a vision system and use it specifically with facial recognition, this YouTube video should be of interest. The author bases much of that tutorial on the less verbose installation guide found here.
Coming from manufacturing, it’s interesting to see MakerPro tools like the Raspberry Pi start to creep into industrial automation. Larger vision equipment manufacturers like Cognex or Keyence perhaps don’t have anything to fear in the short term, but years from now when engineers are more and more familiar with these inexpensive tools, perhaps this market will start to become crowded, at least in the lower end. For now though, most MakerPros will have to be content with an automatic Nerf gun, or perhaps a small robotic arm that can recognize parts with its camera.