You are on page 1of 23

Histogram, Fixtures & Coordinate Spaces

Session 5

Objectives:
• The student will correctly:
 Analyze an image for the presence/absence of a part using a
Histogram tool
 Choose the appropriate fixture tool as needed in a vision application
 Create and configure a Fixture Tool
 Use terminals to pass data between tools
 Identify the use of Coordinate Spaces in vision applications

1
Histogram Tool

Histogram
Histogram creates statistics and a plot of the grey values
found within a specified area of the image

A Histogram is a plot of the count of


image pixels (y axis) at each possible
pixel intensity (x axis) throughout the
image.
count
The height of the graph at each pixel
intensity position along the x axis
indicates the number of pixels in the
tool’s region that have that intensity.

X axis positions can represent intensity grey values


groups instead of individual intensities.

2
Histogram
• A histogram may be used to:
– Detect the presence or absence of something in the image
– Monitor the output from a light source
• A software light meter
– Measure the uniformity of the grey values within an image
– Determine the grey-value distribution in an image to set-up other
vision objects

Add Histogram & Link Images


• Drag and drop the Image
Source OutputImage to the
Histogram InputImage
– Now, any time you run the
tool group, the output image
becomes the image on which
Histogram will run

3
Histogram Images
• Histogram has three images
associated with it (tool
dialog)
• Current.InputImage is the
image Histogram will analyze
on the next run
– In this case, the image comes
from the Output image of the
Image Source

Histogram Images
• LastRun.InputImage is the
image on which the last
execution of Histogram took
place

4
Histogram Images
• LastRun.Histogram is a plot
of the grey-level distribution

Region of Interest
• By default, Histogram runs on the
entire image
• To analyze a single area of the
image, choose a region shape and
manipulate on the
Current.InputImage

10

5
Graphics
• Optionally, change which
graphics appear at run-
time

11

Results
• Results appear
in control and
floating results
grid
• May also be
accessed in VB
or C# code

12

6
Coordinate Spaces

What Are Coordinate Spaces?


• Coordinate spaces provide a numerical framework for
expressing the locations of points

14

7
Calibration and Fixturing
• Coordinate Spaces can be achieved through:
– Fixture Tool (this section)
– FixtureNPointToNPoint Tool (this section)
– CalibNPointToNPoint Tool (later section)
– Checkerboard Calibration Tool (later section)
– Manually configuring and passing a 2D Transform (later section)

15

Root Space
• The Root Space is a left-handed coordinate system perfectly
aligned with the pixels of an acquired image prior to any image
processing
– May be different for synthetic or linescan images

16

8
Root Space
Image now has
• VisionPro automatically re-adjusts the fewer pixels; note
that the root grid
root space as an image undergoes lines no longer
image processing or sub-sampling correspond to the
pixel boundaries.

Image has been


subsampled;
automatically
adjusted the root
so that image
features (such as
the "C" in
"COGNEX")
retained the same
locations

17

User Space
• VisionPro lets you define any number of additional coordinate
systems

• Typically, user spaces are used to create and manipulate


calibrated spaces and fixtures

18

9
User Space
• You determine:
– Units
– Handedness
– How it relates to the image’s root space

2.3, 8.5

19

Pixel Space
• A pixel space is like the root space in that
– Its origin is always in the upper-left corner
– Its space corresponds to the image pixels

• However, the pixel space does not adjust to reflect the effects
of image processing

• Rarely used in applications

20

10
Coordinate Space Trees
• Coordinate space trees contain
– An image’s root space
– All user spaces you created
– How all the spaces are related to each other
• a.k.a. Transformation

21

Coordinate Space Trees

22

11
Selected Space
• At all times, one space within the tree is the Selected Space for
the image

• The coordinate system in which all VisionPro tools that operate


on an image
– Return results
– Interpret input data
• i.e. regions of interest

23

Selected Space
• Creating a new image through some transformation adds a new
coordinate space to the coordinate space tree
– And automatically selects the space as the new image's selected
space name

• Allows you to automatically map coordinates from a processed


image back to the original image or vice-versa

24

12
Fixture Tool

Fixture Tool
• The Fixture Tool is used to create a
fixture coordinate system when you
already have a coordinate transform
calculated
– In our example, we’ll find our part using
PMAlign; it produces a transform in its
results

26

13
Our Problem:
• Then we’ll create a Caliper to measure
the width of the center “tab”

• The Caliper’s region of interest should


move in relation to where the “ear” is
found in the image

27

Getting Started
• Create and configure an
Image Source and a
PMAlign Tool trained to
find the right “ear” of the
bracket

28

14
Add Fixture Tool
• Then add a
CogFixtureTool and
connect its InputImage
to the Image Source’s
OutputImage

29

Connect Transforms
• Take the transform determined by
PMAlign and use it as our Fixture
• Connect the Pose Result of
PMAlign to the Transform of the
Fixture
– If you individually wanted to
supply X, Y, and rotation, you
could connect to those
terminals individually

30

15
Run the ToolGroup
• Run the ToolGroup to pass the image and transform to the
Fixture Tool

31

Settings
• In most applications,
that’s it
• In some cases, you may
want to manipulate the
transformation before
running the subsequent
vision tools

32

16
Add a Caliper
• Now add the Caliper and
connect its InputImage to
the OutputImage of the
Fixture

• Configure the Caliper

33

Running with a Fixture


• Why is it important to create and
configure the Fixture before creating
and configuring the Caliper?

34

17
FixtureNPointToNPoint
Reference Fixturing Method

Reference Fixturing Method


• Use reference fixturing if you do not know the geometric
dimensions of your object or the real-world coordinates of
points to find within the object before performing fixturing
– In this method, you supply a reference image that shows the physical
object to be fixtured
– You specify the desired location and orientation of the fixtured
coordinate space on the reference image and designate the reference-
image coordinates of important object features as raw fixtured points

36

18
Our Problem
• Measure the width of the tab on the bracket, using the centers
of the holes to indicate where the part is in the FOV

37

Add Tools
• Create and configure an
Image Source and a Blob Tool

38

19
Add FixtureNPointToNPoint Tool
• Now add a
FixtureNPointToNPoint Tool

• We need the X and Y centers of


mass of our blobs to connect to
the Fixture Points

39

Adding Terminals
• Right Click on Blob
Tool and Add
Terminals

40

20
Link Terminals
• Connect the newly
exposed terminals to the
Fixture input points

• You may add additional


points and expose
additional terminals as
needed

41

Degrees of Freedom
• In the FixtureNPoint control,
choose the degrees of freedom
used when determining the best-
fit transformation between
fixtured and unfixtured points
– In other words, how do you
expect your part to change
from image to image?
– Then be sure you have
enough points to perform the Type # of Points
appropriate transformation
Translation 1

Rotation and Translation 2

Scaling, Aspect, Rotation, and 3


Translation
Scaling, Aspect, Rotation, Skew, and 4 (or 3 if they are
Translation not collinear)

42

21
Grab Reference Image
• Press the Grab Reference Image and Points button

43

Fixture Coordinate Axes


• By default, the fixture origin is in the
upper-left corner of the image
• You may choose to move it
anywhere by dragging to the new
location or entering values in the
control
• May also rotate axes, change aspect
ratio, skew, etc.

44

22
Using FixtureNPoint
• Now add a Caliper and
connect its InputImage to
the OutputImage of the
FixtureNPoint Tool

45

23

You might also like