Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

What Software Make Sense for Machine Vision?

Machine-vision software offers choices between ease of use and overall control.

Jon Titus, Editorial Director -- Test & Measurement World, 4/15/2000

you
You’ve started working on a machine-vision application and you’re wondering about software tradeoffs. Ready-to-run machine-vision software looks good, but will such standardized software run your specific hardware, and will it produce useful results? On the other hand, programmers at your company continue to push you to look at C++, a language that can produce compact, fast code. It’s difficult to decide which route to take.

The best bet is to start simple and first determine whether any machine-vision software will meet your requirements. You may need to put together a prototype system to see what machine-vision software can do. (Such a setup also lets you experiment with lights, optics, and cameras.) At the prototype stage, you can get quick proof-of-concept results by spending as little as a few hundred dollars on commercial software. Such software, which lets you rapidly set up a machine-vision system, will help you determine if you can achieve the goals set for the machine-vision system. Those goals could cover throughput, ease of use, interfacing with existing equipment, and producing quality reports.

Several companies offer graphical programs or menu-based programs that will let you get a prototype up and running quickly. Graphical programs such as WiT from Coreco, LabView from National Instruments, and Vision Program Manager (VPM) from PPT Vision (see “Product Information,” p. 26) provide graphic elements, or icons, that represent machine-vision or image-processing tasks and algorithms. By connecting the elements, you can prototype image-acquisition and image-processing operations, and you can produce graphical-user interface (GUI) designs. So running new tests is easy; you just rearrange the graphical building blocks to try a new approach.1

TMW00_042F2Fig1.gif (44608 bytes)
Figure 1. A menu-based machine-vision package lets you select operations (middle list) from tools presented on the screen. This screen also shows the images acquired and the results of running the menu of selected algorithms and processing steps. (Courtesy of Data Translation.)

TMW00_042F2Fig2.gif (19004 bytes)

Figure 2. Commercial software packages include manuals and a CD-ROM or floppy disks of software. The Sherlock software from Imaging Technology also includes an introductory videotape.

Menu-based software tools provide an approach that let you build machine-vision applications by choosing actions and tasks from lists or menus (Fig. 1). Sherlock from Imaging Technology, DT Vision Foundry from Data Translation, and IMAQ Vision Builder from National Instruments all fall into this category (Fig. 2).

The software you choose for prototyping depends on your preferences—connecting icons or making menu choices. Both packages provide useful tools for processing images.2

Before you buy a software package, be sure it will work with the hardware you plan to use during prototyping and in your complete system. The hardware drivers and the software packages must interface easily. Software vendors provide drivers for the hardware they sell, but if you need drivers for other hardware, ask about them when you’re talking with software suppliers. If you’re new at using machine-vision software, you might gain by buying at least your prototype hardware and software from one supplier. You’ll ensure the hardware and software work together, and you won’t get caught in the middle of technicians from several suppliers blaming each other for any problems you encounter.

Which Option Is Better?
Once your prototype proves that a machine-vision system will meet your requirements, how do you decide which type of software to use? In many cases, you can just continue using the commercial software and the routines you’ve developed. You may want to go back to clean up loose ends and document what you did, but these commercial software packages work well in many applications. And the software is flexible, so you can modify or update the routines when you need to account for new product types, new inspection criteria, improved inspection hardware, a different user interface, and so on. If a new application calls for a gauging measurement, you can go back to the development tools, add a gauging “block,” or menu item, to the software, and create a numeric indicator. Then, you can compare the measured value to upper and lower limits and display a pass/fail message. In many cases, you won’t have to go any deeper into software development.

But despite the versatility of ready-to-use commercial packages, those pesky programmers keep pitching C++ as an alternative. They say C++ code offers more flexibility and will run faster than point-and-click software. By using C++, you get the most control over the machine-vision system because you’re working “close” to the components. Higher-level software insulates you from the details of the system, and it may prevent you from doing some things, such as directly controlling I/O ports.

For some applications, the programmers are right: C++ makes sense. But it’s not for everyone. Here’s a rule of thumb for deciding which software route to take: If you need high throughput and need to tweak algorithms to get the best performance from a system, or if you’re making dozens or more of the same machine-vision system, and if you’re an intermediate to advanced C++ programmer, then choose C++ as your development language.

On the other hand, if you’re more concerned with getting a system set up and working quickly, and you are unfamiliar with application programming interface (API) calls, dynamic link libraries (DLLs), and ActiveX controls, stay with a graphic or menu-based package. The majority of machine-vision applications work well using either the graphical or menu-based programs. So, unless you can see a pressing need for the speed, flexibility, and low-level I/O control provided by C++, leave it to system integrators and machine-vision experts.

Take Advantage of Prior Work
If you’re like most engineers, you’ll need to know more before you can decide. I recommend starting with one of the commercial ready-to-run packages to make sure you can set up your prototype system and get meaningful results. Then, if the application demands it, move to C++.

How would you make an easy jump from using a commercial package to C++, in which you’re responsible for almost everything? You’ll want to take advantage of the work put into the prototype. So if you’re even slightly serious about using C++, before you buy a graphical or menu-based package for prototyping, see if the supplier either makes available its underlying APIs, DLLs, ActiveX controls, and drivers or if it provides a set of equivalent functions. Data Translation takes the former approach in its DT Vision Foundry package. Imaging Technology offers Sherlock for rapid prototype development and offers MVTools as a package of library functions and DLLs for C and C++. About 90% of the tools in National Instrument’s IMAQ Vision Builder are available as equivalent APIs.

The availability of these software tools improves your chance of success when moving to C++. Say your prototype software, developed using a commercial package, includes an edge-detection task, and the package provides the equivalent algorithm written in C++. You can “move” the edge-detection task from the prototype code to C++ code and be sure the algorithms work the same way. You won’t waste time trying to locate a C++ algorithm or trying to figure out how to code an edge-detection routine.

Product Information
For information about products mentioned in this story, contact these companies:

DT Vision Foundry
Data Translation
Marlborough, MA
508-481-3700
www.datx.com

Halcon
MVTec Software
Munich, Germany
+49-89-457-695-0
www.mvtec.com

LabView, IMAQ
Vision Builder
National Instruments
Austin, TX
512-794-0100
www.ni.com

Sherlock, MVTools
Imaging Technology
Bedford, MA
781-275-2700
www.imaging.com

VisionBlox
Integral Vision
Farmington Hills, MI
248-471-2660
www.iv-usa.com

Vision Program
Manager (VPM)

PPT Vision
Eden Prairie, MN
612-996-9500
www.pptvision.com

WiT
Coreco
St. Laurent, QC, Canada
514-333-1301
www.coreco.com

Manufacturers offer a variety of software you can use with C++, and libraries of functions and procedures give the most control over a PC. Examples of such C++ add-in products include MVTec Software’s Halcon library of ActiveX controls, the ActiveX controls in the VisionBlox package from Integral Vision, and the Fast series of C libraries from Coreco. Data Translation supplies a frame-grabber software-design kit (SDK) that includes basic functions that control frame-grabber operations. (You’ll find other image-analysis software vendors in the Buyer’s Guide section of our Web site.)

Don’t rush out and buy a C++ library of functions or ActiveX controls to tackle machine-vision tasks unless you’re an intermediate or advanced C++ programmer. You won’t be able to take on a complex project after only a semester class in C++. Just getting used to working with the APIs, drivers, and DLLs will take time. You may decide the best way to approach C++ code is through the efforts of a system integrator.

C++ Needs Drivers, Too
Even if you engage an integrator to help you with an application, you need to understand what’s involved in a C++ project. The project doesn’t end with packaged libraries. Machine-vision software needs information to process, so your software must work properly with hardware such as frame grabbers, digital I/O boards, and any other special-purpose hardware your system requires. To work with this hardware, the software needs device drivers you can access from C++.

It’s unlikely you’ll have to write your own drivers, because hardware suppliers provide them with their products. Be sure you ask suppliers what drivers they provide, and read the documentation to ensure you’ll have easy access to driver routines for C++ programs. Documentation should include a list of compatible hardware. Because your prototype included some hardware—a camera, a frame-grabber board, and lights at a minimum—you probably have most of the drivers you need.

Keep in mind, before you can use these hardware devices, you must configure them; that is, set them up to operate properly by loading registers with starting values, setting timers, activating interrupts, and so on. Different manufacturers perform their setup procedures in different ways, so you may have to master several setup techniques just to get started. A manufacturer offering a broad range of products may offer a single configuration tool that will handle all its hardware in a consistent manner.

Is C++ Worth the Effort?
C++ offers flexibility because it lets you accomplish a test in a variety of ways. It also lets you “extend” the language by developing functions and procedures you can place in libraries for later use. So, if you’ve combined several C++ functions from a commercial library package into a useful piece of your application that you plan to use again, place it in your library. C++ also offers the capability to develop DLLs and ActiveX that you can save for later use in other programs. In this way, you develop a set of machine-vision tools for use in related applications. There’s no sense in reinventing software if you don’t have to.

Unfortunately, C++ doesn’t offer the nice user interfaces provided by commercial software. You’ll need to design and program display screens, controls, and the like using C++ along with Microsoft Foundation Class libraries and third-party ActiveX controls.3

Another drawback to using C++ is that you’ll spend considerable time testing and debugging your code. If you’re a system integrator, you can amortize the cost of debugging over many systems, and you can use “canned,” or reusable, software developed for other projects. But if you’re developing only a few systems, you may not have the luxury of the steep learning curve—debug, reprogram, and test—required to master C++. A graphical program may be a better bet. You’ll still do some debugging, but you’ll spend time determining what algorithms to use instead of figuring out how to pass pointers to a C++ matrix-math library.

Each path has its own benefits and liabilities. C++ requires a great deal of programming knowledge and familiarity with many program-development tools and techniques. But it can yield tight, fast code that exactly meets system needs. Graphical and menu-based programs get you running quickly so you can prove a concept. In many cases, they run real applications, too. But they don’t answer every need and sometimes may not offer all the functions you want. Even if you’re fairly sure which path you want to follow, take a careful look down the other one, too, just to see what it offers. T&MW

FOOTNOTES
1. Titus, Jon, “Machine-Vision Software: It’s Not Just for Experts,” Test & Measurement World, April 15, 1999, p 20.

2. Hanks, John, “Basic Functions Ease Entry into Machine Vision,” Test & Measurement World, March 2000, p. 69.

3. Rothe, Darrin, “Foundation Classes Simplify C/C++ Programming,” Test & Measurement World, February 2000, p. 65.

All of these articles are available at www.tmworld.com/archives.

Contact Jon Titus at jontitus@cahners.com

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Martin Rowe
    Rowe's and Columns

    August 29, 2008
    LEDs, Tubes, and Clay
    The Champlain Valley (Vermont) Exhibition, which runs until August 31, has many of the usual things ...
    More
  • Martin Rowe
    Rowe's and Columns

    August 11, 2008
    Grachanen wins NCSLI award
    At last week's NCSL International Workshop and Symposium, Chris Grachanen was awarded the NCSLI Educ...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS

Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites