You are on page 1of 19

Error Handling, Cell State & Calibration

Session 6

Objectives
The student will correctly list:
Purpose of a calibration
Uses of cell state
Uses of error handling

The student will correctly identify:


the two steps in Calibration

The student will correctly implement in a job


a non-linear Calibration using the calibration wizard
Cell State Dependencies
Error handling functions
6-2

Cell State
Using Cell State is a way to disable execution of one or more
cells in the spreadsheet
While disabled:
Cell is not executed
Cells contents remain as they were before disabling

6-3

Cell State
First, highlight cell(s) which are to be disabled. Then choose Cell
State in Edit Menu
Example: Histogram Average

6-4

Cell State
You can disable
unconditionally or
conditionally
To disable unconditionally,
check Disabled

6-5

Cell State
To disable conditionally, make
a reference to another cell
If referenced cell is 0, original
cell(s) are disabled
If referenced cell is non-zero,
original cell(s) are enabled

6-6

Cell State

For example: ExtractHistogram should only update if a


valid model is found

Use the logical result of 1 or 0 (the IF statement) from the


FindPatterns referenced cell to enable or disable the
ExtractHistograms cell state

6-7

How to Control Cell State (Part 1)


1) Highlight cells to be
enabled/disabled
2) Right-click and select Cell
State

3) Choose Conditionally
Enabled and click the
Select Cell button

6-8

How to Control Cell State (Part 2)


4)
5)
6)

Select reference cell that will


control cell states
Cell State dialog should reflect
selection. Click OK.
ExtractHistogram cells should
only update when a valid
FindPatterns model is found.
Notice they are grayed out when
disabled.

6-9

Calibration What is it?


All vision tools operate in the pixel world
What does it mean to be 108 pixels long?
This changes with each camera environment based on:
1.
2.
3.

Working distance (part to camera)


Mounting of the camera (directly over or at an angle)
Optics used (lens)

To get real-world, meaningful coordinates, it is necessary to


Calibrate. This relates the real-world to the pixel world.
6-10

In-Sight Error Handling (#ERR)


Two ways to obtain #ERR:
1. A function fails
Example:FindPatterns search fails to find a match

2. Input parameter is invalid


Example: Fixture parameter points to a Structure instead of row

6-11

In-Sight Error Handling (#ERR)


A function that inputs #ERR also outputs #ERR, therefore
errors are easily propagated through the spreadsheet

FindPatterns

ExtractHistogram
Structure

6-12

In-Sight Error Handling (#ERR)


In-Sight provides CountError and ErrFree to handle #ERR

6-13

CountError: How It Works


CountError returns the number of #ERRs occurring in a
specified range of cells

CountError(B7) returns ?
CountError(C7) returns ?
CountError(B7, C7, D7) returns ?
6-14

CountError: How to Use


Use CountError & conditional Cell State to enable or disable other
tools
A8 = Not ( CountError(C7) )
A10 = ExtractHistogram () if A8

Disabled ExtractHistogram

Enabled ExtractHistogram

6-15

ErrFree
ErrFree replaces #ERR with a zero
Helps to avoid propagating errors in logic statements

ErrFree
keeps proper
logical
values

6-16

ErrFree

Substituting zeros for #ERRs will help continue logical analysis


even when there are errors in the spreadsheet:

IF statement checking
contrast turns to #ERR; it
cannot be use to make a
decision
Using ErrFree you can turn
#ERR into a zero which can still
be used to make logical
decisions

6-17

Non-Linear Calibration: Why is it needed?


1. Lenses have distortion effects on the image (called barrel or
radial distortion)

Distorted

Undistorted

6-18

Non-Linear Calibration: Why is it needed?


2. Cameras that are not mounted (perpendicular) to the
surface exhibit perspective distortion

6-19

Non-Linear Calibration: Benefits


Accurately Locate Objects at Edges of the Image
Vision Sensor Mounting Flexibility
Still maintain accuracy even when perpendicular mount is physically
impossible

Application Example:
Use Non-linear calibration so
bottles in the red region will be
located as accurately as the
bottle in the green region

6-20

10

Calibration Wizard

Accessing CalibrateGrid in Tool Palette


opens Calibrate Wizard Dialogue Box
2 steps to calibrate the vision system
Calibration Dialogue Box

6-21

Step 1 Setup Parameters


Specify Grid Type
Grid of Dots w/ fiducial
Grid of Dots
Checkerboard w/ fiducial
Checkerboard

OR

6-22

11

Step 1 Setup Parameters


Specify Grid Type

Grid of Dots w/ fiducial

Grid of Dots

Checkerboard w/ fiducial

Checkerboard

Specify Grid spacing


and units

6-23

Step 1 Setup Parameters


Specify Grid Type

Grid of Dots w/ fiducial

Grid of Dots

Checkerboard w/ fiducial

Checkerboard

Specify Grid spacing


and units

Ability to print Grid


directly from
Calibration Wizard!

6-24

12

Step 2 Pose Parameters


Place grid under camera
and Acquire image
Manual Trigger - Single
one shot acq
Live Mode Center the
grid
From File image saved
on PC (do not use when
calibrating actual
environment)
Adjust Region allows
smaller region of interest
besides field of view
6-25

Step 2 Pose Parameters


Acquire Image

Grid features are


automatically located
Indicated by green
crosshairs on dots or at
checkerboard
intersections

6-26

13

Step 2 Pose Parameters


Acquire image
Grid features

Calibration wizard will


automatically locate grid
features (points) - to display
them in a table use the
Toggle button

6-27

Step 2 Pose Parameters


Acquire image
Grid features are automatically located
Locate grid features

Enter any robot offset


and angle coordinates

6-28

14

Step 2 Pose Parameters


Acquire image
Grid features are automatically located
Locate grid features
Enter robot offset

Press Calibrate button

6-29

Calibration Results
Average & Maximum
Pixel Error Displayed
Calibration Result Scale

Shows feedback on the


accuracy of the calibration
Click OK

6-30

15

Multi-Pose Calibration Benefits


For Large Fields of View
Use a smaller, less cumbersome
calibration plate
Take multiple poses throughout
the field of view to calibrate the
entire image

For Highly Distorted Images


Pose multiple times to bring in a
large number of calibration points
Benefit: More accurate calibration

6-31

Calibrate Image
A method to Convert Pixel Data to Real World (mm)

An Edges Structure references a Calibrate Image which in turn uses the A0


Image and a Calibration to output a distance in real word measurements
6-32

16

Calibrate Image
Step 1 Reference image to be used (default is A0) for
Image
Step 2 For Calib, reference calibration structure created
such as the previous CalibrateGrid function

6-33

Calibrate Image
Step 3 Open FindSegment tool and reference the
CalibrateImage cell for Image
Now the vision tool (FindSegment) will out the distance in real
world values as defined by the calibration

6-34

17

How accurate is the vision system?


What part are you inspecting?

Smooth edges are optimal; burrs/ rough edges will reduce accuracy

How accurately is the calibration grid printed/manufactured?

A grid printed on a standard ink jet or laser jet printer will limit accuracy

How good is your lens?

High quality lenses with telecentric properties will provide best results

How well is the camera mounted?

Vibrations can cause camera movement over time

What is the image quality?

High gain increases pixel jitter; Pixel saturation reduces accuracy

How accurate are the vision tools?

Edge tools are accurate to .25 (1/4) pixel, PatFind to .1 (1/10) pixel, PatMax to .025 (1/40) pixel

Overall Worst case is the sum of these errors.

These tend to be additive, and seldom cancel each other out

1/10th pixel accuracy is attainable if the parts are flat and have well defined edges

Bottom Line: To determine the accuracy of your vision system,


you need to TEST IT!!!
6-35

Calibration Guidelines
Keep calibration setup identical to production setup
Keep calibration object & part in same plane
Limit calibration to region of image containing features of interest

Calibrate periodically whenever you think setup may change


(each shift, daily, etc.)

6-36

18

Summary
Cell State allows users to enable/disable cells on the fly
Error handling functions allows an application to detect error and do something
smart about them
The In-Sight system works in the pixel world. To get meaningful, real-world
units reported, you must use calibration
Calibration can account for barrel, radial, and perspective distortion
CalibrateGrid can also account for non-orthogonal mounting and uses special
calibration plates
Calibration should be done at least when there is any physical change in the
environment

6-37

19

You might also like