Etiquetas

martes, 28 de abril de 2015

Artificial Vision 2 Checking for the Presence of a Part

This example introduces the Match Pattern, Measure Intensity, and SetCoordinate System steps.The instructions in this example are to create an inspection that checks for the presence of a spray bottle cap regardless of the bottle position in the inspection images.
Creating a New Inspection

Select File»New. Vision Builder AI opens a new, blank inspection.

Acquiring Inspection Images

In the Inspection Steps palette, the Acquire Images tab contains several
acquisition steps you can use to acquire images from many different types
of cameras. The tab also contains a Simulate Acquisition step, which
simulates image acquisition by loading images from file. The Select Image
step enables you to switch to a previously acquired image that you need to
process later in the inspection.


Defining a Feature on which to Base aCoordinate System


In a machine vision inspection, you typically limit your inspection and processing to a region of interest (ROI) rather than the entire image for the following reasons:

• To improve your inspection results by avoiding extraneous objects
• To increase inspection speed

To limit the inspection area, the parts of the object you are interested in
must always be inside the ROI you define.
If the object under inspection is fixtured and always appears at the same
location and orientation in the images you need to process, defining an ROI
is straightforward. However, if the object under inspection appears shifted
or rotated within the images, the regions of interest need to shift and rotate
with the object under inspection.
For the regions of interest to move in relation to the object, you need to set
a coordinate system relative to a significant and original feature of the
object under inspection. Choose a feature that is always in the field of view
of the camera despite the different locations that the objects may appear in
from image to image. Also, make sure the feature is not affected by major
defects that could drastically modify the visual appearance of the feature.


Here we configure a Match Pattern step that
locates a bottle feature on which you can base a coordinate system.

1. In the Inspection Steps palette, select the Locate Features tab.
2. Click the Match Pattern step. The NI Vision Template Editor opens.
3. Draw a rectangle around the base of the sprayer, as shown in

The picture. This region becomes the pattern matching template.




4. Click Next.
5. Click Finish to accept the template.
6. On the Main tab, enter Locate Sprayer Base in the Step Name
control.
7. Redraw or decrease the default green ROI so that it surrounds only the
lower portion of the image, as shown in the picture.



8. On the Template tab, drag the red crosshair mark in the template
image to the left edge of the sprayer base, as shown in the picture. This
changes the focal point of the template.
9. The focal point indicates the part of the template that you want to
return as the match location. By default, the focal point is the center of
the template. You can modify the focal point by moving the red
crosshair or by specifying a Match Offset. Later in this inspection,
you use the match location as the origin of a coordinate system.


10. On the Settings tab, set Number of Matches to Find to 1.
11. On the Limits tab, enable the Minimum Number of Matches control,
and set the value to 1.
12. Click OK to add the step to the inspection.

Checking for the Cap Using Measure Intensity


The image of the spray bottle was acquired using a backlight. The cap
appears dark on the bright background. Complete the following
instructions to configure a Measure Intensity step to check for the
presence of a spray bottle cap.

1. In the Inspection Steps palette, select the Check for Presence tab.

2. Click the Measure Intensity step. The property page for the step
opens.

3. On the Main tab, enter Check Cap Presence in the Step Name
control.

4. Enable the Reposition Region of Interest control.
Enabling this control allows you to link the regions of interest specified
in this step to a previously defined coordinate system so that
Vision Builder AI can adjust the location and orientation of the ROI
from image to image relative to the specified coordinate system.

The Reference Coordinate System list shows all the previously
defined coordinate systems. Coordinate System is the default
reference coordinate system because it is the only Set Coordinate
System step in the current inspection.

Notice that the Measure Intensity step supports a variety of different tools
that enable you to draw different shaped regions of interest, such as a point,
line, broken line, freehand line, rectangle, ellipse, annulus, polygon, and
freehand region. These tools are available in the main menu bar.
5. Using the default Rectangle Tool, hold down the <Ctrl> key, and draw
three regions of interest that enclose edges of the cap, as shown in
the picture. Pressing the <Ctrl> key enables you to draw multiple
regions of interest for the step.


6. Click the Limits tab.
At the bottom of the tabbed page, Vision Builder AI returns the
intensity statistics of the pixels inside the regions of interest. Pixel
intensities can range from 0–255, where 0 equals black and 255 equals
white.
The Minimum Intensity value at the bottom of the page returns the
lowest pixel value inside the regions of interest. The backlit edges of
the plastic cap appear in silhouette as dark pixels (which have low pixel
intensities) on a bright background (which has high pixel intensities).

Therefore, when the cap is present, the minimum intensity for the
regions is low. When the cap is not present, the minimum intensity for
the regions is high because the regions contain only bright background
pixels.

7. Enable the Minimum Intensity control. Set the Maximum value
to 50.00.
8. Click OK to add the step to the inspection.
9. Click the Run State Once button located in the State Configuration
window.

No hay comentarios:

Publicar un comentario