Using software visualization to design visual inspection machine control apps - Embedded.com

Using software visualization to design visual inspection machine control apps

This “Product How-To” article focuses how to use a certain product in an embedded system and is written by a company representative.

In the past, machine vision solutions have always been relegated to a niche group of vision experts who were tasked to create solutions specific to customers' needs. These solutions are invariably difficult to maintain, and most of the time, rigidly un-modifiable.

Today, customers' requirements on machine vision and image processing technology have changed. A growing number of customers, end users and machine vision system integrators alike are all looking for flexible, powerful and easy-to-maintain vision software that can be easily integrated with existing vision hardware. Improvements in vision technology have made vision hardware selection an easy process.

A wide selection of camera and efficient drivers has allowed image acquisitions to be simplified. Now, vision engineers face the challenges of creating customizable yet powerful software applications in less time.

This article aims to teach engineers how to harness the power of today's advance computing technologies (i.e. multi-core CPUs and high-bandwidth memory) for vision analysis and processing using LabVIEW; architect vision inspection programs that powerful yet easy to understand; and use interactive tools to create versatile machine vision inspection programs that are easily maintainable and upgradeable.

Scientific imaging vs.industrial machine
The arraying functions of vision inspection technology lie on opposing sides of the spectrum. The scientific imaging side typically consists of a frame grabber plugged into a PC or PXI chassis, and the images are processed using a programmable language like LabVIEW, C or VB.

On the other hand, industrial machine vision is done mostly with smart cameras or real-time industrial vision systems. Fussfree software configuration is one major prerequisite in industrial machine vision as these applications are typically handled by non-engineers. Industrial machine vision is usually developed using an interactively configurable ADE like NI Vision Builder Automated Inspection (VBAI).

Both groups of users have different sets of requirements when it comes to selecting vision inspection systems. Ruggedness is a key factor for many industrial users as their vision systems will be built either on or extremely close to the production line.

More often than not, the crew manning the production line will also be the ones operating the software program of the vision system. For scientific imaging, the set-up is similar to a data acquisition system. A high-resolution camera is used rather than the sensor, and the signal conditioning is replaced by light sources and optics for the camera.

Both systems rely on an acquisition device to capture and transmit the images to the system. These images are then analyzed using an image processing software.

The processed results are thereafter stored in a database for use at a later time. Researchers and developers usually apply their domain expertise in analysing these images through various software algorithms and have to constantly modify their software program to suit different application requirements.

It seems like software program development for vision applications is unavoidable, regardless of what type of vision inspection systems you adopt. Now, let us take a closer look at how you can to use some intuitive tools and techniques to create a powerful and efficient vision application.

Vision software basics
Industrial machine vision inspections usually involve measurements such as edge detection gauging, counting, pattern matching and part identification.

The software program acts as artificial intelligence to ascertain whether the product under inspection can pass the pre-determined set of requirements. In the old technological era, vision domain experts were always called upon to create vision-inspection software programs, and the programs they design were impossibly rigid. In most cases, the software program can only work for the specific product it is designed for.

Modifying the existing software program to suit another product can prove to be more challenging than creating a new one. It is sometimes much easier to commission separate software programs for different products. It is a totally different scene today.

The introduction of new products to market is faster than you can say “machine vision.” Coupled with their shortened product lifecycles, industrial machine vision customers are increasingly calling for a more powerful, flexible and customizable vision inspection software program to inspect and measure their assorted range of products.

The omnipotent vision inspection software has to be both interactive and configurable, and capable of handling the visual inspection tasks outlined earlier. Moreover, the flexibility of allowing the configuration of decisions based on the results of the individual tasks is also crucial.

The communication abilities with external devices – thus expanding the vision system's capabilities by integrating motion control and data acquisition – are also important to handle wide array and high volume of inspection and measurement processes. Illustrative of this is the user interface in Figure 1 below , where the machine vision system builder can interactively set up his visual inspection process.

Figure 1: Interactive and configurable user-interface of the NI Vision Builder for automated inspection vision software.

This is done by firstly acquiring an image, configuring a pattern-match to search know parts of the product, and finally displaying a PASS or FAIL based on the results of the pattern-match process. The developer can further implement decision-making features for the vision system, with this vision software using statediagram (Figure 2 below ) to create scenarios that may be required with various visual inspection processes.

Figure 2: Configurable state-diagram architecture for flexible decision-making for visual inspection process results.

A powerful vision software covers the low-level aspects of software programming and let the industrial machine vision developers concentrate on optimizing the features of the vision inspection program. The interactive and configurable nature of such vision software also allows developers to focus on what is important for users—the visual inspection process and a user-friendly GUI for operators.

Parallel programming techniques
Engineering innovation in computing has brought several key technologies that you can use to create a more efficient parallel system: multicore processors, high-bandwidth memory and FPGAs.

Sad to say, taking advantage of these key technologies using conventional tools is not easy. However, if you can merge the key technologies into your application, the results are definitely astounding. Higher-performance systems that can increase throughput, and reduce cost of measurement and automation systems can be achieved with little effort.

Multicore processors are now providing high unprecedented levels of computing power to our computers than ever before. Unleashing the full potential of these multi-core processors requires highly specialized software and creating such an optimized vision software application is even more difficult.

Fortunately, LabVIEW was designed with parallel processing in mind and has anticipated the wave of multi-core processors. Hence, it's been supporting multicore processing for more than 10 years.

Picking the right strategy
There are several strategies toward optimizing your scientific imaging and analysis application. We will talk about three techniques: task parallelism, data parallelism and pipelining.

Task parallelism . It is simply the concurrent execution of independent tasks in software. It is the simplest form of parallel programming, where the application is divided into unique tasks that are independent of each other and can execute on separate processors on a multicore CPU.

Consider a program with two loops (Loop A and Loop B), where Loop A performs a signal processing routine and Loop B performs updates to the user interface. This represents task parallelism, whereby a multithreaded application can run the two loops in separate threads to use multiple CPUs.

Figure 3 below shows an example of how an individually tasked multithreaded program looks like in LabVIEW.

Figure 3: How an individually-tasked multithreaded program looks like in LabVIEW.

Data parallelism . It is a programming technique for splitting a large data set into smaller chunks that can be operated on in parallel. After the data has been processed, it is combined back into a single data set.

This is particularly important for scientific imaging and analysis, as the data size of the image is usually very large and the imaging projection on screen or visual analysis algorithms will perform very slowly if the software program is not designed to use multicore processors.

Using a vision imaging and analysis toolkit optimized with data parallelism (Figure 4 below ), you would be able harness the power of multicore processor to make vision software program more efficient.

Figure 4: Using a vision imaging and analysis toolkit optimized with data parallelism, you would be able harness the power of multicore processor to make vision software program more efficient.

Pipelining . Most software applications are created using a sequential programming methodology, which is not optimum especially for programs that run a number of CPU-intensive algorithms on a multi-core processor.

Pipelining is the process of dividing a serial task into concrete stages that can be executed in an “assembly-line” fashion. Consider this approach in streaming applications and any time you must modify a CPU-intensive algorithm in sequence, where each step takes considerable time.

Like an assembly line, each stage focuses on one unit of work. Each result passes to the next stage until the final stage.

To apply a pipelining strategy to an application that will run on a multicore CPU, break the algorithm into steps that roughly have the same unit of work and run each step of on a separate core. The algorithm can repeat on multiple sets of data or on data that streams continuously.

To gain the most performance increase possible from pipelining, individual stages must be carefully balanced so that no single stage takes a much longer time to complete than other stages.

For example, if step 1 takes 1min. to complete, but steps 1, 3 and 4 take 10sec., the entire iteration takes 1min. to complete.

Figure 5: How the pipelining technique is implemented on a piece of code previously using sequential methodology.

Figure 5 above shows how the pipelining technique is implemented on a piece of code previously using sequential methodology.

To fully optimize your imaging and analysis software program, programmers should use the techniques discussed that will best suit their given application.

Summary
From an imaging laboratory to a production line, the software-defined approach can be easily adopted to either enhance existing vision system or create a powerful and flexible one.

Using the programming techniques discussed earlier, and coupled with the easy availability of the software tools in the market, your final step towards an immaculate vision system is to select an appropriate software development tool that will suit your vision system applications.

Ken Ng is a Marketing Engineer at National Instruments ASEAN .

Leave a Reply

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