Solving a Machine Vision Application with NI Vision Builder for Automated Inspection

Publish Date: Jan 22, 2010 | 42 Ratings | 3.33 out of 5 |  PDF

Overview

Machine vision applications require a combination of hardware and software to ensure success. While choosing the right hardware is important, the actual visual inspection software forms the core of any machine vision system. National Instruments introduces configurable machine vision software with NI Vision Builder for Automated Inspection (VBAI).

VBAI allows you to easily configure and benchmark a sequence of visual inspection steps as well as deploy the visual inspection system for automated inspection. With VBAI, you can not only perform powerful visual inspection tasks but also make decisions based on the results of individual tasks. In addition, you can communicate with external devices using serial lines and discrete I/Os. VBAI also allows you to migrate your configured inspection to LabVIEW so that you can extend the capabilities of your application by integrating motion control and data acquisition.

Table of Contents

  1. Inspection Challenge
  2. VBAI Interface
  3. Locating the Part under Inspection
  4. Detecting Filtration Holes
  5. Calibrating the Image
  6. Measuring the Gasket
  7. Benchmarking the Application
  8. Deploying the Application
  9. Conclusion

1. Inspection Challenge

This document introduces the software components of a complete visual inspection system and demonstrates how you can quickly and easily configure a real-world machine vision application with VBAI.

Visual inspection applications involve simple measurements, such as edge detection, gauging, counting, pattern matching, and part identification. The goal of the application described in this document is to verify the manufacturing quality of oil filter production, ensuring that the correct number of filtration holes are present and the diameter of the rubber gasket is correct. The diameter of the gasket needs to be expressed in millimeters rather than pixels so that the measurement can be compared to design specifications easily.

Back to Top

2. VBAI Interface


The VBAI interface contains the following four areas:
1. Main window—Displays the image being processed, the Decision Making property page, the Serial I/O property page, and the Configure Inputs/Outputs property page.
2. Inspection diagram window—Displays the sequence of VBAI steps that comprise the inspection.
3. Embedded help window—Contains context-sensitive help about when to use a step, how to configure a step, the function of the user-interface controls, and frequently asked questions.
4. Inspection Steps palette—Lists and describes the steps you use to create your inspection. When you click most steps, this palette transforms into the property page for the step.


Figure 1: Four Areas of the VBAI Interface

Back to Top

3. Locating the Part under Inspection


If the oil filter is fixtured, it always appears at the same location and orientation in the images you need to inspect, so defining regions of inspection is straightforward. However, if the oil filter appears shifted or rotated within the images, the regions of inspection need to shift and rotate with the filter.

For the regions of inspection to move in relation to the oil filter, you need to set a coordinate system relative to a significant and original feature of the oil filter. You should choose a feature that is always in the camera field of view despite the different locations in which the filter may appear from image to image. Also, you should make sure the feature is not affected by major defects that could drastically modify the visual appearance of the feature. The center hole of the oil filter will be the unique feature from which to base the coordinate system.

To find this hole, you can use the Match Pattern step of VBAI.



Figure 2: In the Locate Features palette you can find pattern matching, coordinate system and object detection functionality.

To configure the Match Pattern step, draw a region of interest around the area of the image containing the middle hole. This region becomes the pattern matching template. VBAI looks for and locates the specified template inside the green region of interest in the image, as shown in Figure 3. The location of the match is overlaid on the inspection image with a red rectangle.



Figure 3: Match Pattern finds the center of the hole.

You can set up the coordinate system so that it is based on the hole location you found with the Match Pattern step. In later steps you can account for motion in all directions and for rotation using this coordinate system. In this application, horizontal and vertical motion are the only directions to consider because the oil filter appears shifted in only the x (horizontal) and y (vertical) directions.

Back to Top

4. Detecting Filtration Holes


You can use the Detect Objects step to count the eight holes. Using the annulus (circle) region of interest tool, you can draw a region of interest that encircles the ring of smaller holes.

You can adjust the Threshold tab and select the Dark Objects radio button to see all the pixels that fall within the Threshold Range. These selected pixels are highlighted with blue. VBAI groups contiguous highlighted pixels into objects, which are depicted by red bounding rectangles, as shown in Figure 4. You can adjust many other parameters to fine tune the object detection by filtering on object size and objects that touch the border of the region of inspection. You can also specify how many objects should be found for the oil filter to meet specifications.



Figure 4: Detect Objects Detects Eight small holes in the filter.

Back to Top

5. Calibrating the Image


By default, VBAI returns measurements in pixels. If you want the inspection to return measurements in real-world units, you need to map pixels to the unit of your choice through a process called spatial calibration. A calibration wizard is included with VBAI. Vision Builder AI can account for linear, perspective, and nonlinear distortion. For this example, you can assume the camera that acquired the inspection images is perpendicular to the image plane and that lens distortion is negligible. Based on these assumptions, you can use simple calibration to create the pixel to real-world mapping. Simple calibration transforms a pixel coordinate to a real-world coordinate through scaling in the x (horizontal) and y (vertical) directions.



Figure 5: First Screen of the Calibration Wizard

Back to Top

6. Measuring the Gasket


One of the last steps for this inspection is measuring the diameter of the gasket using the Caliper step. You can draw a region of interest across the width of the filter, as shown in Figure 6.



Figure 6: The Caliper Step Finds the Width of the Gasket

In the Settings tab, you can specify the direction and orientation of the search lines as well as the edge detection settings.

Back to Top

7. Benchmarking the Application


The speed of an inspection system is critical, particularly so that it does not become the bottleneck of a system. Because the vision inspection performances are dependant on the machine they are performed on, VBAI provides a performance meter that allows you to benchmark the visual inspection steps on a specific configuration.

The detailed view of the Performance Meter, shown in Figure 7, helps to identify individual steps that take the most amount of time. With this knowledge, you can modify the inspection strategy to optimize the inspection time.



Figure 7: Detailed View of the Performance Meter

Back to Top

8. Deploying the Application


It takes just a few minutes to create an oil filter inspection application. The last step is to actually deploy the application. VBAI includes a built-in Inspection interface for deployment purposes. As shown in Figure 8, the Inspection interface includes everything you need to effectively run the application long term. The Display window previews the part being inspected complete with overlays and accompanying text. At the bottom of the screen, the Results panel lists all of the inspection steps, their measurements, and pass/fail information. The right portion of the screen contains the Inspection Statistics panel, which provides information that can help with quality assurance.


Figure 8: Built-In Deployable Inspection Interface

Back to Top

9. Conclusion


Using VBAI, you can create a complex inspection application in a short amount of time. Combined with the right hardware, VBAI can help you create low-cost, powerful inspection solutions.

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit