Open source machine vision with Linux and OpenCV are the way forward.
I’m afraid I have a bit of a history of heading off in different directions than most people do. It’s a trailblazing streak that sometimes opens up great new opportunities, but also oftentimes makes things just plain hard.
A while ago-17 years-I got very excited about trying to do industrial-grade machine vision on the Windows platform. This launched me onto a path across many hot stones and pointy objects that took years to navigate. But in the end, aided by the prolonged efforts of many other individuals and organizations, Windows-based machine vision won the race against proprietary “vision engines” running their own embedded operating systems and even defeated machine vision on the Mac (for those of you that might still remember the great products from Automatix).
Why did Windows win? The key ingredients were an easy-to-implement graphical user interface (GUI) and ready-made networking tools, coupled with the wide variety of off-the-shelf applications that integrators could add to their systems easily to provide broader value to their customers. It was simply much easier to develop and deploy complex, complete, integrated systems on the Windows platform. And it worked well enough.
Now it’s 2009. It was a great idea. It has been a great ride. Everyone does it this way now, factories are comfortable with Windows PCs everywhere, and it is a perfect time to put a permanent end to the whole idea.
Why? Well, we’re in the midst of another wonderful technological/business trend transition. Windows is still around, and still ubiquitous. It still generally works. But many of the features that have been added to it in this century are of much more use to the business enterprise than to the scientific or industrial imaging community. And these features introduce overhead, instability and bugs. Microsoft has addressed this issue by introducing in sequence Windows CE, Embedding, WinMobile, and XPEmbedded-all stripped-down versions of the larger flagship products that should have been, in theory, more efficient and practical than standard desktop clients, but which in practice can be flaky and frustrating.
And the perfect storm for Microsoft has re-emerged, since there is something else around that works just fine, has an easy-to-program GUI, and has ubiquitous networking and ever-growing, third-party applications support: Linux. For those of you who thought I was going to say Mac OS X, I’m not there yet. I’m a huge fan, but OS X is really itself just another Unix variant (Mach kernel with BSD extensions) and adds a very heavy-duty GUI on top, introducing overhead and programming hurdles that are often not valuable on a machine vision processor.
The roots of Linux, based on the original Unix and the GNU open software phenomenon, predate Windows by decades. The fact that there are many flavors of Linux, even though they are relatively similar, has confused the market and hampered widespread acceptance. But we can get some hints from Dell. The company currently sells two versions of Linux, Red Hat and Novell/SUSE, pre-installed on its large-business servers. And, for almost two years, Dell has sold Ubuntu Linux pre-installed on select laptops and desktops.
Ubuntu is an enormously popular, forever-free open source version of Linux that is enjoying spectacular growth. You can buy a bag full of Ubuntu books off the shelf at Barnes & Noble (like Dell, another of my technology-readiness metric resellers). Add the free, open source OpenOffice and you have a word processor, spreadsheet, presentation and database package that are easier to use and more powerful for most users than, ahem, certain other options from other vendors. And since Internet networking was invented on Unix, everything works easily: file sharing, Web serving, FTP, DNS, DHCP, CSS, PHP, Perl, Python… you know, all of that “Internet stuff.”
OK, fine, you think. I can configure a small, lean, inexpensive system running Ubuntu and have networking, office/data analysis apps, and flawless networking for just the cost of the hardware. I can even have gcc, the world-class C/C++ compiler that so many embedded systems depend on, and for which there are several really nice open source graphical Interactive Development Environments (IDEs). But how can I do machine vision?
Enter Open Computer Vision, or OpenCV for short. OpenCV is a 10-year-old project started by Intel to accelerate use of the high-performance capabilities of Intel processors. It is an open source cross-platform library that is free for commercial use and available for Windows, Mac OS X, Linux, and even Playstation and other embedded smart camera OSs. It provides, in both compiled and source form, the entire gamut of machine vision algorithms that we machine vision professionals have implemented over and over for different platforms.
Here, though, they are supplied in a public application framework compatible with Visual Studio, Linux IDEs, Mac Xcode, or straight command-line, old school C. It has been downloaded more than two million times, and has a very active parallel download and documentation site in China, a mega-emerging machine vision market. It is easy-to-use, portable, full-featured and free.
And how can you argue with free? In this economy, with margins so tight in manufacturing concerns, it is nice to be able to put more money into custom engineering work than off-the-shelf software and hardware component fees.
OpenCV has extensive camera and frame grabber support, including industrial cameras from Basler and Prosilica. The USB 2.0 and IEEE-1394/Firewire standards are fully supported, as is the modern GigE Vision standard for Gigabit Ethernet-connected cameras.
Now, for simple machine vision applications, a stand-alone smart camera might still be the easiest way to go. Plug in, configure the inspection via convenient menus, tie in a solenoid to knock the bad parts into the waste bin and send you a text message, and you’re done. But as an alternative, consider a $200 camera and a $300 Ubuntu embedded system running free open-source software. These will require some more programming up front but will result in a much lower per-system cost when duplicated in the field. Plus, you’ll get a fully programmable, customizable system without having to go all the way to a massive Windows PC.
Want more information? Look at www.ubuntu.com and opencv.willowgarage.com, and be sure to look up both on Wikipedia for good high-level overviews and more links.