0% found this document useful (0 votes)
56 views

In-Sight Advanced Manual

The document describes an advanced training course on using spreadsheets in Cognex's In-Sight machine vision software, which focuses on hands-on labs to build scenarios using tools like PatMax for pattern matching. The 2-day course costs $395 and is held in various locations, and teaches students how to implement tools in real-world applications and design operator interfaces. Prerequisites include completing an introductory In-Sight training course and experience using In-Sight spreadsheets.

Uploaded by

Isabel Cheong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

In-Sight Advanced Manual

The document describes an advanced training course on using spreadsheets in Cognex's In-Sight machine vision software, which focuses on hands-on labs to build scenarios using tools like PatMax for pattern matching. The 2-day course costs $395 and is held in various locations, and teaches students how to implement tools in real-world applications and design operator interfaces. Prerequisites include completing an introductory In-Sight training course and experience using In-Sight spreadsheets.

Uploaded by

Isabel Cheong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 123

TRN‐IS‐310‐C‐02‐AM: Advanced Spreadsheets

Course Description:
Class focuses on advanced In‐Sight spreadsheet use. Spreadsheet users will learn how
spreadsheet functions work and apply their knowledge to complete the class lab exercises. The class
focuses on hands‐on labs to build advanced tool usage scenarios within real‐world applications.

Length: 2 days
Locations: Novi, MI; Natick, MA; Regional Site; Customer Site
Price: $395 (at Cognex facility)
Onsite Available – Call 508 ‐ 650 ‐ 3715 for Details
Registration: Online at http://www.cognex.com/training

Expected Outcomes:
You will benefit from this course by learning to:
‰ Describe and implement advanced vision tools in real world settings
‰ Solve intermediate level application using an In‐Sight spreadsheet
‰ Implement GUI driven calibration for operator access
‰ Track running totals and statistical information related to time
‰ Design and implement an operator interface using GUI best practices
‰ Communicate with external devices using spreadsheet FTP functions

Topic List
1. PatMax
2. Blobs
3. Edges
4. Calibration
5. GUI Design
6. Communication

Recommended Reading at http://www.cognex.com/support:


• TRN‐IS‐250‐M‐00‐AM In‐Sight Spreadsheets Manual

Prerequisites:
• Completing an In‐Sight training course and experience with In‐Sight spreadsheets.

Cognex Corporation One Vision Drive Natick, MA 01760-2059 (508) 650-3000 fax (508) 650-3333 www.cognex.com
10/28/2009

PatMax
Session 1

Introductions
• Name?
• Where from?
• Company?
• Role?
• Vision Experience?
• Hobbies, family, pets?

1
10/28/2009

Objectives

The student will correctly:


• Identify uses for PatMax technology
• Configure TrainPatMaxPattern and
FindPatMaxPatters tools
• Execute PatMax to solve challenging applications
• Import and export PatMax patterns

What is PatMax?
• PatMax is a pattern-based search
technology.
technology
• PatMax differs from other pattern-
location technologies in that it is not
based on pixel grid representations
that cannot be efficiently and
accurately rotated or scaled.
• Instead,, PatMax uses a feature-based
representation that can be transformed
quickly and accurately for pattern
matching.

2
10/28/2009

Why Does It Work?


• PatMax more closely
resembles the way humans
di
discern b
between
t similar
i il thi
things
and recognize familiar ones.

• Consider the examples of


remembering the faces of
people close to you.

• Even if the faces change due


to lighting, extra features, and
less features, you will still likely
recognize them if there is
enough of the original detail
intact. 5

How Does It Work?


• PatMax requires the use
of two tools:
• TrainPatMaxPattern
• Extracts and trains a
pattern: a trained
geometric description
of an object you wish
to find

• FindPatMaxPatterns
• Finds objects in an
image based on a
trained pattern

3
10/28/2009

TrainPatMaxPattern Parameters
Reference to target image cell
Where tool should fixture itself
R i specifying
Region if i ffeatures
t tto train
t i
Allows use of custom region
Location within pattern to report
Specialized settings
Choose from PatQuick or PatMax
Specifies allowed perimeter deviation
Toggles to check for opposite polarity
DISABLED
Granularity used to find large features
Granularity used to find small features
Milliseconds before tool gives up
Graphic options to display

Algorithm
• You’ll choose from two
algorithms:
g
• PatQuick: Optimized for
speed; disables
FindPatMaxPatterns
model graphics; uses
coarse granularity (more
later)

• PatMax: Optimized for


accuracy; enables
FindPatMaxPatterns
model graphics; uses fine
granularity (more alter)
8

4
10/28/2009

Elasticity
• Degree to which you
allow PatMax to tolerate
nonlinear geometric
changes (changes to the
perimeter outlined by the Image
Pattern
boundary features)

• Range: 0-10
0 10

Ignore Polarity
• The ignore polarity setting instructs PatMax to check
for original
g p
polarity
y identified at training
g and opposite
pp
polarity as well. This may increase execution time for
PatMax.

10

5
10/28/2009

Granularity
Granularity = 6
• Coarse granularity controls the
level of detail used by the
P tQ i k algorithm.
PatQuick l ith
• Fine granularity controls the
level of detail used by the
PatMax algorithm.
• By default, both are set to 0
allowing PatMax to
automatically determine good
values.
l

Granularity = 1 11

How Granularity Works


32 Boundary Points
• Granularity works to limit the
number of boundary points
extracted
t t d from
f features
f t in
i an
image.
• A granularity value of 6 means
that boundary points will have
a radius of 6 pixels where no
other boundary points can
exist.
• A granularity
l it value
l off 1 means
that boundary points will have
a radius of 1 pixel where no
other boundary points can
exist.

104 Boundary Points 12

6
10/28/2009

Coarse Granularity
32 Boundary Points
• Coarse granularity is used by
the PatQuick algorithm.
• Since PatQuick is optimized for
speed, coarse granularity
should never be set to 1.
• If set to 0, it is automatically set
to the best value for coarse
granularity. GetGrainCoarse returns 6.579
• If set to > 1, coarse granularity
is manually set to that number.
• GetGrainCoarse functions
returns coarse granularity
value.

13

Fine Granularity
104 Boundary Points
• Fine granularity is used by the
PatMax algorithm.
• Since PatMax is optimized for
accuracy, fine granularity
should always be set to 1.
• If set to 0, it is automatically set
to 1.
• If set to > 1, fine granularity is GetGrainFine returns 1
manually set to that number,
and is no longer using the best
accuracy setting.
• GetGrainFine function returns
fine granularity value.

14

7
10/28/2009

Relationship Between Boundary Points


• In the end PatMax creates an compilation of vectors
which include boundary point information, direction
(polarit ) and their relationship to one another
(polarity), another.
Note: Circles do not overlap for demonstration only

15

Proper Training GetTrained


Disabled Function
• The TrainPatMaxPattern tool is
automatically disabled to avoid
retraining
t i i with ith each
h iinspection.
ti
• There is no need to manually Training
enable it. Passed
• This tool holds the model for
use with the
FindPatMaxPatterns tool. GetTrained
• The tool auto-inserts a Disabled Function
GetTrained function.
• This function returns a 1 if
training passed.
Training
• This function returns a 0 if Failed
training failed.
16

8
10/28/2009

Avoid Retraining Accidentally


• Any time you make changes to the
TrainPatMaxPatterns tool ((directlyy or through g an
EditRegion), the model is retrained on whatever is
inside the training region at that time.
• Example: If you forget to set Ignore Polarity, and go
back into the tool to set it, it will retrain on whatever is
in the train region when you click the checkbox.

17

FindPatMaxPatterns Parameters
Reference to target image cell
Where tool should fixture itself
Region specifying searching area
Allows use of custom region
Reference to a TrainPatMaxPattern
Number of match to search for
Minimum score necessary
Specifies lowest contrast necessary
Toggles consideration of extra features
Percentage allowed out of region
Sets rotation, scale & aspect ratio range
Sets allowable overlapping
Milliseconds before tool gives up
Graphic options to display
18

9
10/28/2009

Accept Threshold

Accept Threshold = minimum score (between 0 and 100)


• PatMax uses to determine if match represents valid instance of the
model within the search region
• Increasing the Accept value reduces the time required for search

0 80 100

Not Valid Accept Valid


Matches Threshold Matches
19

Scoring Conflict
• Warning: It is possible to set a high accept threshold
((90 for example)
p ) and not g get any
y results,, then set the
accept threshold to something lower (80 for example)
and then have it find a match that scores above the
original high accept threshold.
• If during the first pass of the image (PatQuick), the
candidate does not score higher than the accept
threshold,, it will not be promoted
p to be inspected
p byy
the PatMax algorithm.
• Lowering the accept threshold is a good way to work
around this tool behavior.

20

10
10/28/2009

Contrast
• Contrast sets the
minimum contrast
required in order to
consider a change in 92 62
grayscale a potential
boundary point.

• For a boundary point to 31 16


be detected its feature
contrast must exceed this
value.
5
21

Clutter
• The model consists of inter-related boundary points.
• Clutter is a term used to describe extra features
present adjacent to the original boundary features of
the image that are not part of the original model.

22

11
10/28/2009

Clutter in Score
• The Clutter in Score
parameter allows yyou to
p
factor or ignore clutter
when the score is
calculated.
• If checked, score is
lowered based on the
amount of clutter.
• If unchecked, score is not Score: 68
affected by the presence
of clutter.
Score: 94
23

Outside Region
• Outside Region allows a percentage of the model to be outside
the search region and still be found.
• Those missing boundary points outside the field of view are not
counted against the score.

24

12
10/28/2009

Find Tolerances

Allowable rotation of
match relative to model

Allowable scaling range


relative to pattern
(100% means no scaling)

25

Find Overlapping
• XY Overlap

• Angle Overlap

p
• Scale Overlap

• Aspect Overlap

26

13
10/28/2009

Discarding Overlapped Results


3 Found

2 Found

27

Import & ExportData Functions


• The ImportData and ExportData function is used to save certain
individual cell contents to the camera’s flash memory.
• The cell is imported/exported as a .CXD file (a one cell snippet)
directly to/from the camera’s flash memory.
• Functions allowed:
• DelayLine
• CountPassFail
• Calibrate
• CalibrateAdvanced
• FindPatterns
• TrainPatMaxPatterns
• TrainFont
• Application: Saving changes performed since the last time job
was saved.
28

14
10/28/2009

ImportData
• ImportData is found under the Input/Output category
Event required to execute the import
Camera from where file will be imported
Valid username within camera
Valid password within camera
Name of file to be imported

• ImportData
p can also be used within emulators
• File being exported must be of supported type

29

ExportData
• ExportData is found under the Input/Output category
Event required to execute the export
Camera from where file will be exported
Valid username within camera
Valid password within camera
Name of file to be exported
Reference to function or tool to export

• ExportData
p can also be used within emulators
• File being exported must be of supported type

30

15
10/28/2009

Summary

The student will correctly:


• PatMax can be used to locate trained models when
appearance of the models is adversely affected.
• PatMax requires the use of two tools:
TrainPatMaxPattern and FindPatMaxPatterns.
• You can import and export PatMax models using
the ImportData and ExportData functions.

31

16
In‐Sight Advanced Spreadsheets

Session 1 ‐ PatMax Lab

Objectives

• Use TrainPatMaxPattern and FindPatMaxPatterns to train a model to be used in a


search / find area to fixture tools in an application.

Tasks

Drill Bits

1. Start a new job.


2. Leave the first 15 rows of the spreadsheet blank.
3. Use comments to document each function you put into the spreadsheet.
4. Browse to or Open the images file in the Drill Bits folder.
5. Use a TrainPatMaxPattern tool to train a PatMax model that will be used by the
FindPatMax tool to track the position of the product.

Model taught by TrainPatMaxPattern Tool

6. Verify the FindPatMaxPatterns tool finds the part in every image.


i.e. the Cross hairs should move as the product moves in the FOV.

The search area defined by the FindPatMaxPattern tool using the Model from the
TrainPatMaxtPattern tool to give location information (see cross at center of Trained Model)

See next page for the screenshot of the spread sheet


7. Save your job as MyDrillBits.job.

DIN Alignment

1. Start a new job.


2. Browse to or Open the images files in the DIN Alignment folder,
3. Use a TrainPatMaxPattern tool to train a PatMax model using the image Part00.bmp.
4. Verify the FindPatMaxPatterns tool finds the part in every image.
5. Save your job as MyDIN.job.

Model taught by TrainPatMaxPattern Tool Search (box) defined in the FindPatMaxPattern tool

Faces

1. Start a new job.


2. Browse to or Open the images file in the Faces folder.
3. Use a TrainPatMaxPattern tool to train a PatMax model using the image Image13.bmp.
10/28/2009

Blobs
Session 2

Objectives

• The student will correctly identify the


• P
Purpose off th
the Fi
FindBlobs
dBl b andd SortBlobs
S tBl b functions
f ti
from an ExtractBlobs tool
• The selection of parameters for use with the FindBlobs
and SortBlobs functions
• The student will correctly implement the:
• ExtractBlobs, FindBlobs, and SortBlobs function in an
application

1
10/28/2009

Blobs
• Blob tools play an important role in machine
vision.
• Blob analysis in In-Sight classifies pixels into
blob pixels or background pixels.
• All connected blob pixels are part of an
individual blob.
• The rest are considered the background.
• This strategy helps when you need to:
• Find features that cannot be
traditionally trained and found using
correlation or geometric model
search (parts that change
dramatically)y)
• Speed up identification, location, or
sorting features when model training
and finding take too long
• There are three Blob tools available in the
In-Sight product:
• ExtractBlobs
• SortBlobs
• FindBlobs 3

ExtractBlobs
• ExtractBlobs is the primary Blob vision tool in In-Sight.
• It has a dual role:
• It can count the number of blobs.

• It can itemize each blob by area and report details like:


• Index
• Row
• Col
• Angle
• Color
• Area
• Elongation
• Holes
• Perimeter
• Spread
4

2
10/28/2009

ExtractBlobs Property Sheet


Reference to target image cell
Where tool should fixture itself
Region specifying interest zone
Number of blobs to list info *
Value separating black/white**
Enable blob hole area in result
Consider blobs touching region limit
Are blobs dark, light, or either?
Is the background dark or light?
Minimum blob size to report
Maximum blob size to report
Graphic options to display

*Setting “Number to Sort” to 0 only counts the number of blobs in the region.
No other blob results are reported.
**Setting “Threshold” to -1 performs automatic threshold. 5

Color: Blob & Background


How many black blobs on
• Color allows the
white background? 1
extraction to focus on
white, black, or all blobs
• Background allows
opposite or same polarity
selection to control
connectivity
• When opposite
pp p
polarity
y is
selected, blobs can be 8
way connected
• When same polarity is
selected, blobs must be 4 How many black blobs on
way connected black background? 8
6

3
10/28/2009

SortBlobs
• SortBlobs allows the customized sorting of blobs
alreadyy extracted

Reference to existing blob structure


Number of blobs to sort
Sorting strategy
Reference fixture (optional)
Graphic options to display

X – Fixture X Coordinate Small to Large


• Sorts from top to bottom of images based on center of
mass of blobs Y

0 3 4 1 2
5

6 8 10 11 7 9

X 13 12 15
14 16 17

19 21 22 23 18 20

4
10/28/2009

Y – Fixture Y Coordinate Small to Large


• Sorts from left to right of images based on center of
mass of blobs Y

3 7 11 15 19 23

2 6 10 14 18 22

X 1 17 21
5 9 13

0 4 8 12 16 20

Angle – CCW Rotation from Fixture X Axis


• Sorts counter-clockwise based on angular distance
from default X axis Y

9 16 19 21 22 23

3 6 12 14 18 20

X 1 15 17
4 8 10

0 2 5 7 11 13

10

5
10/28/2009

Angular Distance – Absolute Value of Rotation from Fixture X Axis

• Sorts counter-clockwise based on the absolute value


of the angular
g distance from default X axis
Y

9 16 19 21 22 23

3 6 12 14 18 20

X 1 15 17
4 8 10

0 2 5 7 11 13

11

Distance – From the Fixture Origin


• Sorts based on distance from the origin of default
fixture Y

0 1 5 8 15 19

2 3 7 12 16 20

X 4 16 22
6 10 13

9 11 14 17 21 23

12

6
10/28/2009

Grid – X then Y from Fixture Origin


• Sorts across rows first, then columns
Y

0 1 2 3 4 5

6 7 8 9 10 11

X 12 16 17
13 14 15

18 19 20 21 22 23

13

Grid – Y then X from Fixture Origin


• Sorts down columns first, then rows
Y

0 4 8 12 16 20

1 5 9 13 17 21

X 2 18 22
6 10 14

3 7 11 15 19 23

14

7
10/28/2009

SortBlobs Results
• Sort Blobs referencing an ExtractBlob structure

15

FindBlobs Property Sheet


• FindBlobs allows the customized selection of blobs
alreadyy extracted or sorted based on blob results
Reference to target image cell
Number of blobs to analyse
Minimum score for valid blob
|
|
Nominal value, valid range & relative
weight for blob analysis
|
|
Graphic options to display

16

8
10/28/2009

FindBlobs: Setting It Up
1. Select a blob structure to analyze
2 Set number to find
2.
3. Set results nominal value
a) ideal value the blob must possess
4. Set value range
a) +/- range of the nominal value
5. Set the weight
a) how important this value is
6. Review results focusing on accuracy and score
7. Set “Accept Thresh” value appropriately

17

Setting Up Nominal Values & Range


• The easiest way to set up the nominal value and range
for each criterion is to double click and select one of
the blob results graphically

18

9
10/28/2009

FindBlobs: How Does It Work?


1. The closer the actual blob value is to the nominal value, the
higher the score.
2. The range is normalized to 100.
a) Example 1: with a nominal value of 161 and a range of 100, a
blob with an area of 158 will score 97.
b) Example 2: with a nominal value of 161 and a range of 50, a
blob with an area of 158 will score? 94
3. FindBlobs then weighs other criteria by normalizing their weight
to 100.
a)) Example
E l 33: area scored
d 96 with
i h a weight
i h off 50,
0 elongation
l i
scored 48 with a weight of 50.
score1((weight1+weight2)/(numweights*100)) +
score2 ((weight1+weight2)/(numweights*100)) =
(96((50+50)/(2*100))+(48((50+50)/(2*100)) = 72
4. What about for 3 weighted values? 19

FindBlobs Results

• What is the likely nominal value for Area based on its


influence on score?
• What range is likely set for Area based on its influence on
score?
• What score should be set in order to exclude anything
outside the range of 150 and 172? 20

10
10/28/2009

FindBlobs
Blobs are then found by
limiting search parameters
(Too Large)

“found” blobs are sorted


by criteria to determine
indexing - relative to X

21

Summary
• There are three blob vision tools:
• ExtractBlobs is used to ppull out all blobs p
present and sort
them from largest to smallest area
• SortBlobs is used to sort based on custom criteria
• FindBlobs is used to pick out blobs matching specific criteria
from a larger result set
• Nominal values, ranges, and weights are used to
score blobs based on how well they match desired
criteria
it i

22

11
4. Verify the FindPatMaxPatterns tool finds the part in every image.
5. Save your job as MyFaces.job.

Model taught by TrainPatMaxPattern Tool Search (box) defined in the FindPatMaxPattern tool

Vials

1. Start a new job.


2. Browse to or Open the images file in the Vials folder.
3. Use a TrainPatMaxPattern tool to train a PatMax model using the image pic6.bmp.
4. Verify the FindPatMaxPatterns tool finds the part in every image.
Hint: Be selective.
5. Save your job as MyVials.job.

If Time Permits

Keys

1. Start a new job.


2. Browse to or Open the images file in the Keys folder.
3. Use a TrainPatMaxPattern tool to train a PatMax model of each of the 4 key variations.
i.e.End with 4 TrainPatMax patterns that will be used by one FindPAtMax pattern tool
4. Use a FindPatMaxPatterns tool to identify each of the keys.
Hint: Open the property sheet of the FindPAtMax tool and use each of the trained
models being inspected.
5. Save your job as MyKeys.job.
In‐Sight Advanced Spreadsheets

Session 2 ‐ Blob Lab

Objectives

• Use ExtractBlobs, SortBlobs, and FindBlobs tools to solve different blob analysis
applications.

Note:
These exercises are to help you understand the tool parameters so you will be able to use
these tools in the Calibration section in building the DrillBits application.

Tasks

T Bar

1. Start a new job.


2. Browse to or Open the images file in the T Bar folder.

3. Use an ExtractBlobs tool to define the search area and number of holes
4. Use a FindBlobs tool that will only display results for blobs that match features of the
small holes while ignoring the large holes

5. Use A SortBlobs to order the Location of the small holes from top down, Left to right.
6. Save your job as MyTBar.job.

Tablets

1. Start a new job.


2. Browse to or Open the images file in the Tablets folder.
3. Use an ExtractBlobs tool to define the search area and number of tablets to be found.
Hint: use a Neighbor filter to help the extract tool to locate all the Tablets (24).
4. Use a SortBlobs tool that will order the tablets by X then Y.

5. Save your job as MyTablets.job.


Gasket

1. Start a new job.


2. Browse to or Open the images file in the Gasket folder.
3. Use an ExtractBlobs tool to define the search area and number of Holes to be found.

4. Use a FindBlobs tool that will only display results for blobs that match features of the 3
small holes while ignoring the large hole and any blobs resulting from the blemishes on
some gaskets.

5. Save your job as MyGasket.job


Optical Characters

1. Start a new job.


2. Browse to or Open the images file in the Characters folder.
3. Use an ExtractBlobs tool to dynamically set the number of characters.

4. Use a SortBlobs tool that will sort characters from left to right.

5. Save your job as MyCharacters.job.

If Time Permits

1. Load the job file in the Characters image Folder


Labeled ‐ Variable_OCR.job
2. Browse to or Open the images file in the Characters folder.
3. Determine how the Blob tools were used
10/28/2009

Edges
Session 3

Edges

The student will correctly identify:


Edgeg Tools and their functions
Purpose of a MultiLine Versus a Caliper tool

The student will correctly demonstrate:


The selection of parameters to enable the MultiLine
or Caliper tool to find the desired edges

The student will correctly implement the Edge tools -


Find Multiline and Paired Edges in an application

1
10/28/2009

Edges
• Edge – Tool Palette

Two Groups

1. Find straight
or curved edges

2. Reference
f
found
d edges
d

Edges
• Edge – FindCircle Structure
• XY center point of found edge
• Distance from XY point to found edge (radius)

2
10/28/2009

Edges
• Edge – FindCircle
• Property sheet

Center point of inner


circle

Distance from Center point to inner circle

Distance from Center point to outer circle

Specifies edge transition (black to white, etc.)


Outputs graphics of edge found and results
Minimum edge transition score
Used for finding low contrast edges (see slide x)
Number of pixels over which an edge transition
takes place
5

Edges
• Edge – FindCircle Parameter

Smallest to

Largest circle

3
10/28/2009

Edges
• Edge – FindCircle Parameter
• Dependent on Where the Annulus is drawn

Smallest to

Largest circle

Edges
• Edge – FindCircleMinMax
• Denotes the Minimum and Maximum radius of edge points
• Uses one circumference to reference for Min/Max

Min/ Max XY points


on circle
i l

4
10/28/2009

Edges
• Edge – FindCurve
• Outputs Center point of curved edge circle
• Starting and End coordinates (X,Y)
(X Y) of the Edge points

Center of Curve
(252,327)

Edges
• Edge – Find Line
• Spread sheet cell displays a Structure with end points
(Row Col) of each Line Edge found in the region of
(Row,Col)
interest

End pt.(row,col) 0
End pt.(row,col) 1
- Find First edge

10

5
10/28/2009

Edges
• Edge – Find Line
• Property sheet

Specifies edge transition (black to white, etc.)

Outputs graphics of edge found and results

Minimum edge transition score

Used for finding low contrast edges (more later)


Tolerance level of an edge not perpendicular to the
drawn tool’s axis
Number of pixels over which an edge transition
takes place

11

Edges
• Edge – FindMultiline
• Spread sheet cell displays a Structure with number of edges
found in the region of interest (Index Number)
• Endpoints (Row,Col) of each Line Edge found in the region
of interest are not displayed in the spread sheet, use the
Sort and/or the Get functions

12

6
10/28/2009

Edges
• Edge – FindMultiline
• Property sheet

Outputs only this quantity of edge graphics found and


display the results
Minimum score for Black to White edge transition
Minimum score for White to Black edge transition

Used for finding low contrast edges (next slide)


Outputs edge found and display graphics
Tolerance level of an edge not perpendicular to the
drawn tool’s axis
Number of pixels over which a transition takes
place

13

Edges - Normalize Score Parameter


• Specifies whether the edge scores will be affected by the
grayscale histogram (contrast value) of the image region.

• Normalize Score Checked = uses actual contrast value


Score = (Raw Edge Score) x (100/Max Contrast)

• Normalize Score Not Checked = uses theoretical contrast value


Score = (Raw Edge Score) x (100/255)
low contrast edges score lower than
high contrast edges when this formula is used:
14

7
10/28/2009

Edges
FindMultiline

• Ch
Change P
Parameters
t
• To find edges

• Note:
Edge width will
affect finding edges
at different Threshold
values

• If Ineffective
try the Caliper tool
(more on this later)
15

Edges
• Edge – Use FindMultiline with PairDistance tool
• Find Multiline – Edge tool
– 7 Drill bits b
butt 28 edges fo
found
nd

• PairDistance - Edge tool


• Reference FindMultiline tool, 28 found edges
g use edges
g 0 and 3

• PairDistance – Output of 1st drill bit edges,


output distance is in pixels 16

8
10/28/2009

Edges
• Edge – Use FindMultiline with PairEdges tool
• Find Multiline – Edge tool
– 7 Drill bits b
butt 28 edges fo
found
nd

• PairEdges - Edge tool


• Reference FindMultiline tool 28 edges, 14 “pairs”

17

Edges
• Edge – Use FindMultiline with PairToEdges tool
• Find Multiline – Edge tool
– 7 Drill bits b
butt 28 edges fo
found
nd

• PairsToEdges - Edge tool


• Reference FindMultiline tool 28 edges, 14 “pairs” to find
the Center line between paired edges

18

9
10/28/2009

Edges
• Edge – SortEdges
• References a cell with an Edge Structure
– Sort by: five different parameters
Note: B2W = Black to White pixel transition

Best Score is not always First edge

19

Edges
• Edge – SortEdges
• Displays the Get Row/Column for endpoints from the
Edge Structure for each edge found
found, Index # ( 0 - X )
• Number to Sort = 14 - default, lists 0-9

20

10
10/28/2009

Edges
• Edge – FindMultiline
• Best used for varying distance
edge pairs

• Edge - Caliper tool


• best used with similar distance
edge pairs or when an edge of
different intensity is needed to be
found in the group of edges

21

Edges

• Similarities between MultiLine and Caliper tool parameter :


Image,
g Fixture, Region,
g Number to Find ((Edge/Pair)
g ) and
Edge Width

22

11
10/28/2009

Edge Parameter Differences


• MultiLine • Caliper
one edge mode – two edge modes –
single edge single
g and p
pair edges
g

Contrast value – selected Contrast value – Selected


for each edge transition for both edge transitions
in ”Threshold: B2W” in “Minimum Contrast”
and “Threshold: W2B
Note: “Threshold Accept” –
Edge width will affect finding minimum score of “all” edges
edges at different contrast found (Scoring Methods )
values
“Edge Distance” –maximum distance
between “found” Edge Pairs
(Scoring Methods )
“Find By” - static selections Find by – dynamic
(Scoring Methods ) 23

Edges - Caliper
• Find by Dynamic Scoring Methods ( 4 total )
• When using Single Edge versus Edge Pair - in Edge mode
Contrast and Position Scoring are used
1. Contrast – (Default) uses highest contrast value to find edge

2. Position – user defines “where” the edgeg is found,,


in relation to the region drawn (center of region)

24

12
10/28/2009

Edges - Caliper
• Find by Dynamic Scoring Methods ( 4 total )
• When using Edge Pair versus Single Edge - in Edge mode
Size and Straddle Scoring methods are added
3. Size – user defines the number of pixels wide of each edge pair

Parameter “Number to find”


- 2- Edge Pairs

• 4. Straddle – used in combination with other scoring methods such


as “size” to find edges on each side of the center of the
search region
Change from 2 pair to 1 pair of
edges to find to output edges that
- Straddle’s the center region -
25

Edges - Caliper

Spread Sheet cells contain


a Structure number of
edges found
and reference data

26

13
10/28/2009

Edges - Caliper
• Once edges have been found, scores are used to
determine placement of “found” edges and order of labels
(0,1,2…etc:)
(Edge pair order derived from Score and “Y” position if all scores are equal)

This pair scored These two pairs


less than 100 scored 100

27

Edges - Caliper

• If correct edges Not found


• Under the General Tab
• Change Parameters

• Default Scoring Method is Edge Contrast


changing the Edge Distance parameter
will not affect the edges found within the region
• If Ineffective, Add different Scoring Methods
28

14
10/28/2009

Edges - Caliper

Add a different
Scoringg Function
- Size
Note:
From the General Tab –
Threshold Accept and
Edge (Pair) Distance
values apply to Scoring
Methods

29

Edges - Caliper
• Delete ineffective Scoring Functions
Note: Each Edge Mode is used (added) to derive a
“Geometric
Geometric mean
mean” score for the resultant edge pair(s) found

30

15
10/28/2009

Edges - Caliper

• Change Graph Parameters


((handles on g
graph)
p )
X axes Limit = length of tool (region)

X axes = tolerance
derived From ‘General” tab -
Edge Distance

Lines on graph represent what


score the Edges of the “Pair”
will receive, i.e.;
at distance 39, if an
edge pair is found, it will
receive a score of 20
31

Edges - Caliper

• Edge Pairs # of pixels


From ‘General” tab -
Edge Distance

• Verify results

32

16
In‐Sight Advanced Spreadsheets

Session 4 ‐ Calibration Lab

Objectives

• Use a CalibrateAdvance tool with the correct Calibration Image to convert pixels to real
world units and remove distortion.
• Use the Calibrate Image structure as the reference image for the Edge tool to output its
results in real world units.
• Use an ExtractBlobs and SortBlobs tool to find the dots used for calibration.

o Note: the calibration procedure will only be used randomly,


place the calibration procedure several rows (15‐20) below the Edge tools,
this will allow for additional tools to be used in those rows for session 5, the
User Interface Lab.

Tasks

Drill Bits

1. Open or continue to use the MyDrillBits_3.job you created in session three.


Note: For back up purposes, save this as MyDrillbits_4 for this lab.
2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the Images_Calibration folder.
Note: use the 0.5 inch Dot pattern (half inch scale)
4. Use an ExtractBlobs tool to define the search area and number of Dots to be found.
in this application we will use the 9 (nine) Dots in the center of the FOV
5. Use a SortBlobs tool that will order the Dots by X then Y.

6. Create a table to identify the correct dot pairs with their respective X and Y pixel
location. These will be used for the Calibrate Advance syntax
a. Copy and paste the Index, Row and Col of the sorted 9 dots

b. Insert Colum Headers X and Y next to the Row Col headers


c. Place in their respective cells the real world units :
Using Blob 0 (Index 0) as the origin for the real world origin 0,0

d. This completes the procedure to order the calibration dots to real world
coordinates.

7. Insert the Calibrate advance tool structure in the row above were you started the rows
for the calibration procedure. (see example ‐ last page of lab)

8. Click and drag from the table you created the XY to Real World unit cells into the
Calibrate Advance tool syntax.
Note: Do Not include the index numbers or the Header labels

See next page


9. Select Enter or the green check box and the calibration structure will be complete.

Another way to do this would be to put in the values in individually…. Your choice

Note: the structure is enabled so it will calibrate with each inspection.

10. Create an “Enable” check box for when there is a calibration image to calibrate with.
a. Use the cell state function to enable / disable the calibrate structure.

When not Enabled, the Calibrate structure is “Grayed out”

Make sure the calibrate structure is disabled before completing the next step

11. Save your job as MyDrillBits_4.job.


Procedure to use the calibration data in a Calibrate Image Structure to be used by the Edges tool
as its reference image instead of A0

12. Browse to or Open the images file in the Images_Drill_Bits folder.

Note: The 0.5 inch Dot pattern (half inch scale) should only be used when
the enable calibration check box is checked

13. Insert the CalibrateImage tool structure In the row above were you placed the
Calibration structure

Property sheet for the CalibrateImage Structure

14. Open the property sheet for the Find Multiline tool and instead of referencing AO
reference the Calibrated Image cell.

Note : the PairDistance cells converted from pixels to inches

15. Save your job as MyDrillBits_4a.job.


See next page for spreadsheet example of Calibration Procedure
Note: #ERR are due to the Image is the DrillBits instead of the Dots
CALIBRATE ADVANCE LAB

EXPECTED OUTCOMES:

You will convert pixel values to real world values by using a preprinted calibration
(Dots) grid and the Calibration Advance transform.

IN-SIGHT FUNCTIONS USED: Calibration Advance transform

PROCEDURE Calibration Lab:

1. Launch In-Sight Explorer (ISE) in Spreadsheet View


Open the previous lab, and save it as
CalibrateImage_Lab_01.job
2. Use the 0.50 inch Dots pattern Grid without the Fiducial, (XY locator bars).
The grid can be found in the 01 – Images Calibration folder ( CD )

In order to use these nine points for the calibration,


their center points (X,Y) need to be located.
This can be accomplished by several vision tools, for this lab, we will use an
Extract Blobs tool to locate the Blobs (Recommend you start in row 87 or higher)
3. Draw the “Region” around the 9 dots, Set the “Number to sort” to zero (0)

Adv_Edges_2 Lab 1
GB 07/24/08
4. Use the “Sort Blob” tool to maintain an order to the nine points

Reference the Extract Blob Structure


The nine Extracted Blobs

Orders the Blobs from Left Right - Top Down

5. From the Sort blobs cells, Copy- Paste the Index, Row and Col info to a new row:
add an X and Y column to put real world distance info:
Note: the dot pitch is 0.50 inch
A B C D E F G

Dot
pitch

Adv_Edges_2 Lab 2
GB 07/24/08
6. Select the CalibrateAdvance under the Functions Tab in the toolbox Palette

Double Click on the CalibrateAdvance, to open the cell for inputting cell referencing

a.
Input the references from the “Dot Order to Real World Distance” cells
(see step 5)
Calibrate Advance ( Index 0--{ Row, Col pixel reference},{ X,Y Origin distance -- 0,0},
Index 1--{Row,Col pixel reference},{ X,Y real word distance --0,0.5}, Index 2--etc;…)

7. Once the information has been added hit return / enter


and the Calibrate structure will contain the calculations to be used in the Trans Edges
to World function.
8. At this time add a Check box
To use as a Cell Sate function to Enable / Disable the Calibrate Advance structure.

Note: if the calibrate Advance is not disabled


it will continue to recalculate with each inspection

9. Create a cell with the CalibrateImage Structure to be used by the Edges Tool in the
Edges _2 lab.

10. Save the job as CalibrateImage_Lab_01 onto the In-Sight camera’s Flash ROM.

11. In addition, it may be advisable to save the job as CalibrateImage_Lab_01.job onto


the PC

Adv_Edges_2 Lab 3
GB 07/24/08
Edges_2_CalibrateImage Lab
Drill Bit Edges

EXPECTED OUTCOMES:

Obtain a live image or use the images provided.(Drill Bits and Dots)
Demonstrate the ability to place the appropriate tools to count the specific object (s) as
stated in the procedures.
Demonstrate the ability to use nine (9) points to convert pixels to real world values

IN-SIGHT FUNCTIONS USED: Vision Tools within a Spreadsheet


(Coordinate Transforms – CalibrateAdvance)

PROCEDURE Edges and Calibrate Image Lab:

1. Launch a New job or from the Previous CalibrateImage_Lab_01.job

2. Use PairDistance tool to match the drill bit “size” with the appropriate pair

3. Use another Pair Distance tool but reference an Edges tool that references the
Calibrate Image to output real world units.

B26 is the Edge Structure (Find Multiline) to be referenced by the Pair distance tool.

see next page for an example:

Adv_Edges_2 Lab 4
GB 07/24/08
4. Save the job as Edges_2.job onto the In-Sight camera’s Flash ROM.

5. In addition, it may be advisable to save the job as Edges_2.job onto the PC

Adv_Edges_2 Lab 5
GB 07/24/08
In‐Sight Advanced Spreadsheets

Session 3 ‐ Edges Lab

Objectives

• Use FindMultiLine and PaireDistance tools to determine drill bit widths in pixels to be
used later in the Calibration and User Interface Labs.

Tasks

Drill Bits

1. Open or continue to use the MyDrillBits.job you created in session one.


2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the Drill Bits folder.
4. Use a FindMultiLine tool to locate the drill bit edges.
Note: there are shadows so there will be 4 edges to each drill bit

5. Use the PairDistance tool to determine the drill bits widths (in pixels)
Note: place a Label with the “size” above the respective PairDistance cell

6. Save your job as MyDrillBits_3.job.


10/28/2009

Advanced In-Sight: Operator Interface Best Practices


Session 5

Objectives
• The student will correctly implement and describe what
features make for a successful operator interface

– The use of the EditCompositeRegion tool


– The use of individual Cell conditions:
• Using Input/Output function - Event, to update a cell
• Using Clocked Data Storage function - Latch and Sum to
hold data in a cell
– Operator Interface ease of use:
• How to create Dialog boxes
• How to create Wizards – two methods
• How to customize operator interface controls

1
qqqqq
10/28/2009

EditCompositeRegion

EditCompositeRegion is a Graphic Control tool that


allows the user to create region(s)
g ( ) that are non-
rectangular. There are a few “edit” region tools:

• EditRegion: creates a rectangular region

• EditPolygon: creates region from user


selected points

• EditComposite: creates region of varying


shapes. Allows for addition
3
and subtraction of areas

EditCompositeRegion - Graphics
• “Plain” space
is part of the
region

• “Hashed”
area is space
that is being
removed from
the
h region
i

¾ Great for
Masking
4

2
qqqqq
10/28/2009

EditCompositeRegion - General

The parameter box gives access to General and Regions

General allows for:

• Fixturing
• Adjustment abilities allowed
to user at runtime
• Title for the button
• Ability to show graphics

¾EditCompositeRegion is displayed as just


5
a button on spreadsheet

EditCompositeRegion - Regions

The Regions tab allows for inserting multiple regions –


either as an addition or subtraction

• Order counts
• Use Interactive Graphics
to set region
• Properties change
depending on region

3
qqqqq
10/28/2009

Using EditCompositeRegion

• Some tools in In-Sight have a parameter in their dialog


box that allows for use of the composite
p region.
g
• Called “External Region”
• Takes precedence over Region settings
• Reference cell that contains
EditCompositeRegion

• Supported tools:
– PatMax (train and find)
– PatFind
– Blobs
– Histogram 7

Editing Composite Region at Runtime

• If the adjustments are enabled in the General tab, the


composite
p region
g can be altered by
y the user on the fly
y
• Right-click on image to add, remove, or change
operations of a region

Adding Subregion

Subregion Operation

4
qqqqq
10/28/2009

Event Tool
• An Event function monitors conditions to create a software
trigger (1) from within the spreadsheet when OnLine
– This
Thi iis iindependent
d d t ffrom th
the cellll AO
AO-Image
I Acquisition
A i iti / IInspection
ti

– Found in Palette, Function Tab –


Vision tools – InPut / OutPut – Event

Event

• For Example:
– Operators
p Utilizing
g Up/Down
p buttons to adjust
j the tolerance for
part while online

10

5
qqqqq
10/28/2009

Event tool
• To update the Event cell, a Soft 0 (80) is needed
– The Software will register an 80 in the Event cell when:
• The Event cell is active from the trigger source (Button)
– This is used in the Event tools Trigger parameter

11

Event and a Button

• Create an Up and Down Button to update the value in a


cell independent
p of A0
– When a button is depressed, this sets Soft 0 to go high (1) and
outputs an 80
• This will be the trigger source for the Event tool

12

6
qqqqq
10/28/2009

Event and a Latch


• A Latched cell will only update it’s value when an event
occurs
• This Latch tool uses the Soft 0 Event (L25) rather than A0
– This action, depressing the up/down button, stores (latches) an
input value on the specified event (Soft 0))
• This will allow the Latch function to update and store
information in the cell only when the Button is active
Found in Palette, Function Tab –
Clocked Data Storage – Latch ( more on this later)

13

Events Summary

• Building an adjustable floating point tolerance parameter

• A Button outputs a Soft 0 (80) when active (depressed)


• An Event tool is looking for a Soft 0 (80) to be active
• A Latch tool is looking for an Event to be active to update
its cell contents
• This same Latch tool is inputting a value from a cell with
Logic to determine its value (0
(0.002)
002)

for Logic
see next slide
14

7
qqqqq
10/28/2009

Events Summary

• M25 = 0.002
• E16 = Up button
• E17 = Latch tool referencing the Event Structure (L25)
and the cell with the logic M25 (tolerance value)
• M26 = Increment Value ( 0.001, or your choice)
• E18 = Down button
E16 L M
E17 25
E18 26
15

Clocked Data Storage


Using the tolerance example from the previous slides,

“ClockedSum”
ClockedSum a Clocked Data Storage function, is used
to perform as if using an Event and a Latched cell to
increment a tolerance setting
Found in Palette, Function Tab,
Clocked Data Storage – ClockedSum

• This tool mayy reference an event cell and update


p
independently of the event - A0
– This action, depressing the up/down Button, creates an event to
update the cell’s contents
• This will allow the ClockedSum function to update and store
information in the cell only when the Button is active
16

8
qqqqq
10/28/2009

Clocked Data Storage


• Property sheet summary

– Event - references a Button


Decrease / Increase tolerance
– Value - references the Edit Float
function
– Reset - reference a Button
which in turn references the
preset value
– Preset - reference the actual width

Note: To Decrease the tolerance


place a minus sign in front of the
“Value” reference

17

Clocked Data Storage


Note:

• Past Method: • Current Method:

These functions were always “Clocked” version of each function


“one behind” in tracking data: that maintains a current update :

Accumulate ClockedSum

Minimum ClockedMin

Maximum ClockedMax

Delay line ShiftRegister


18
18

9
qqqqq
10/28/2009

Dialog Boxes
• A Dialog Box is a pop-up window that overlays the spreadsheet
• Consists of cells above row 399 in the spreadsheet (A400 & higher)

19

Dialog Boxes
• Able to use several tool functions
in rows 400 and above, but not
Vision functions

• Ability to references between


Dialog Box and main spreadsheet

• Select to turn gridlines on or off:

20

10
qqqqq
10/28/2009

Wizards: Menu Mode


Wizard connects 2 or more dialog boxes
Mode is 0 for menu, 1 for sequential

Dialog
boxes

Wizard

21

Wizards: Sequential Mode

Returns to spreadsheet

Dialog Boxes & Wizards provide easy-to-use Graphical User Interface (GUI)
22

11
qqqqq
10/28/2009

Best Practices

• Customize controls to keep them:

EIO – easy, identifiable, out of the way and organized


– Easy to find
– Identify what the control will do
– Out of the way when not needed
– Organized within the application

23

Easy to Find
• When viewing an operator interface, the user should
know where to press just by looking at the interface
– A control
t l should
h ld exude
d click
li k ability
bilit ((stand
t d out,
t be
b noticed)
ti d)

24

12
qqqqq
10/28/2009

Identify What the Control Will Do

• The user should know right way what the control will do
jjust by
y looking
g at it
– A control should communicate functionality

25

Out of the Way When Not Needed


• A good user interface does not get in the way of a user
– Remove access to the Programming Interface

26

13
qqqqq
10/28/2009

Organized within the Application


• A good user interface does not get in the way of a user
– Use of Dialog and Wizards to perform tasks when needed

27

Organized within the Application

• A good user interface does not get in the way of a user


– The user interface should onlyy show what needs to be seen

28

14
qqqqq
10/28/2009

How - Controls

• Customize - Operator Interface controls:

• Change Cell Font size

• Bold Font in Cells

• Change
g Cell Color

--- Formatting done from the Active toolbar View

29

How - Controls
• Customize - Operator Interface controls:
• Add Picture/Graphics
Right Click on “Button”
Button
– Format - Format Cell

• Picture tab
(Open/Browse for graphic)
– User designed / copied graphics
» Scale will affect cell graphic

• Original “Button” Property Sheet


– Remove any text in Name box

30

15
qqqqq
10/28/2009

How - Controls

• Out of the way - Operator Interface controls:

• Create Dialog boxes to be used by a Wizard


– Dialog boxes are accessed directly from the
spreadsheet button

31

How - Controls

• Out of the way - Operator Interface controls:


– Wizard button reference dialog
g boxes that have been created
within the spreadsheet

Tool Palette – Functions – Graphics – Controls – Wizard

Syntax to enable Button graphics - Double quote 32

16
qqqqq
10/28/2009

How - Display

• Remove Panes
View – In-Sight
g – ((Network, Files and Palette)) Unselect

33

How - Display

• Remove toolbars
View – Toolbars ---Uncheck toolbars

Note: removing the Menu bar from a Custom View is done


within an editor such as Visual Basic 34

17
qqqqq
10/28/2009

How - Display

• Position “Controls” out of the way and select graphics to


display
p y

Note: Un - checking Display Elements will enable faster


refresh rates of the Display and cycle time of Inspections 35

18
qqqqq
In‐Sight Advanced Spreadsheets & Intro to ToolBuilder Class

Session 5 – User Interface lab

Objectives

• Implement in a Job File / Spreadsheet the Edit region, Color Labels, Input/output
functions using the Event tool and the Clocked Data Storage Latch function to develop a
User Interface

• From the presentation, utilize the techniques learned for an easy to use Interface with
the use of Buttons, Dialog boxes / Wizards and customized interface controls.

Tasks

Edit Region

1. Open or continue to use the MyDrillBits_4a.job you created in session four.


2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the CustomView_Drill Bits folder.
4. Use the rows above the Trained PatMax tool structure to place the next tool

5. Use an EditRegion tool to resize and move the Find region parameter of the Find PatMax
tool used to locate the Trained Model of the drill bit sizes.

Note: The Edit Region box will be used in a dialog box/ Wizard in the Operator Interface

6. Save your job as MyDrillbits_5a.job.


Calibration Check box

1. Open or continue to use the MyDrillBits_5a.job you created in session five.


2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the CustomView_Drill Bits folder.
4. Verify that you have a “Calibrate Enable” check box controlling the cell state of the
Calibration Structure,

a. if not, then:
‐ Select the Calibration structure and use the “Cell State” parameter to
conditionally enable it from the check box you create in the spread sheet

Note: This check box will be used in a dialog box/ Wizard in the Operator Interface

5. Save your job as MyDrillBits_5a.job

Drill Bit Tolerance adjustment

1. Open or continue to use the MyDrillBits_5a.job you created in session five.


2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the CustomView_Drill Bits folder.
4. Using the rows left open between the Edges and calibration tool:

5. Create a block of cells underneath the PairedDistance structure for each drill bit :

a. Use a Mathematically determined size in the cell directly beneath the


corresponding PairedDistance structure with the “actual” measurement.
For example: 1 divided by 16 = 0.063 etc:
Note: sizes 3/32 and 7/64 measured size is different than the calculated.

For simplicity I am changing a Label from Determine to Measure for the rest of the labs
b. Use the ClockedDataSum function to output a Maximum and Minimum sum for
each of the Drill Bit sizes.

i. Change the Value parameter for the maximum to a (plus) +0.001 and
for the minimum value to (minus) ‐ 0.001

ii. Reference the Preset parameter to the cell containing the mathematical
or calculated drill bit size for each of the Drill bits.

Note: The output of the cell will add or subtract the preset number only after it has
been Reset, otherwise it will increment by + or ‐ 0.001 with each Inspection.

Select the Reset check box then Ok to set the value in the cell to the drill bit size.

Remember to go back and unselect the Reset check box to have it increment by the plus
or minus 0.001 values
6. Create an InRange function to form the Pass/Fail Logic for each Drill bit size underneath
the ClockedSum structures for each drill bit

7. This group of cells will be used as references for a group of cells (Results Table) that will
be used in a dialog/Wizard for the Operator interface

Note: Clocked Data Storage (ClockedSum) and Edges (PairDistance) functions will not
work in a dialog box (rows 400 and above).

8. For error checking, create an ErrFree cell for each of the InRange Logic cells

9. Save your job as MyDrillBits_5b.job.

Color Labels

1. Open or continue to use the MyDrillBits_5b.job you created in session five.


2. Use comments to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the CustomView_Drill Bits folder.
4. Using the rows left open between the Edges and calibration tool:

5. Create a Logic function to output a value underneath the ErrFree function to be used by
the Color Label for each Drill bit size. This will be used in the next exercise (step 5).

6. Save your job as MyDrillBits_5b.job.


Operator Interface (User Interface)

1. Open or continue to use the MyDrillBits_5b.job you created in session five.


2. Use comments, if applicable, to document each function you put into the spreadsheet.
3. Browse to or Open the images file in the CustomView_Drill Bits folder.
4. Create a group of cells of the Drill Bits Results with a Maximum / Minimum and a reset
button for each Drill bit size. Call it Results table.

This will be built in the top 10 rows of the spread sheet.

The Minimum/Maximum and reset buttons will reference the ClockedSum function
built in the previous exercise.

Remember to reference all values from the functions you built in the spread sheet,

This group of cells will be used in a dialog box later in the exercise.

The Event references the Maximum button or for minus 0.001 the Minimum button

The reset references the Reset button created in the group of cells (Result Table)

See next page


Col,Row D3 references’ the PairDistance function in D32

5. Create a Color Label at the bottom of each Drill Bit size, in‐between the minimum
button and the reset button

7. If Time permits
Select the Foreground color to White and have the text written in the cell change
dynamically to PASS / FAIL respectively.

See next page


8. Save your job as MyDrillBits_5c.job

Dialog Boxes

1. Create a Dialog box with the Results table

a. In the upper section of the spread sheet, below the Results Table you just
created place a comment for future reference in column A
Results Table
Search Box
Enable Calibration

b. Place the Dialog box in column B next to its comment

c. Make it big enough to fit the results table

Click ok

See next page


d. Click and drag over the entire Results table you just created

e. Right click to Cut the selected cells

f. Open the dialog “Results Table” you just created and Paste it into the Dialog
box.

g. Test to make sure the references work

2. Create a Dialog box with instructions on how to use the Edit Region button.

a. In the upper section of the spread sheet next to its reference in column A

b. Place a Dialog Button in column B next to its comment.


Results Table
Search Box
Enable Calibration

c. Make it big enough to fit the Edit Region cells


d. Click and drag over the entire Edit Region you created earlier

e. Right click to Cut the selected cells

f. Open the Dialog “Search box” you just created and Paste it into the Dialog box.
Add instructions as needed.

g. Test to make sure the references work

3. Create a Dialog box with instructions on how to use the Enable Calibrate check box.

a. In the upper section of the spread sheet next to its reference in column A

b. Place a Dialog Button in column B next to its comment.


Results Table
Search Box
Enable Calibration

c. Make it big enough to fit the “Enable Calibration” Button cell


d. WARNING—Do Not click on the “Enable Calibration” button unless you have a
dot grid in the field of view

Click one cell above/below or next to it and drag OVER the button, Donot
includes the Calibration structure.

e. Right click to Cut the selected cells

f. Open the Dialog “Calibration” you just created and Paste it into the Dialog box.
Add instructions as needed.

g. Only Test if you have a calibrated Dot grid in the FOV to make sure the
references work

4. Save your job as MyDrillBits_5d.job

Wizard Creation

1. Create a Wizard with the 3 Dialog boxes you just created

a. In the upper section of the spread sheet, below the Dialog boxes
Place the Wizard Function in column B next to its comment
2. Use the Menu mode (0) for the Wizard and have three (3) choices
A. Drill Bit Results and buttons
B. Adjust Search Region (Edit Region)
C. Calibration (Enable)

See next page

Type in the word Setup between the quotes the 0 mode and references

3. Set the single wizard cell as the entire custom view

a. Top Menu bar , Edit – Custom View

b. Select Enter or the green check box, then OK

c. Select F6 to toggle/ switch between the custom view and the spread sheet

4. Save your job as MyDrillBits_5e.job.


Graphics to buttons

1. Use the custom graphics in the Custom_View_Drills folder to add graphics to the ‘Set
up” button to the Wizard

a. Right Click on the “Set Up” button to open the Format – Format Cells property

b. Select the Picture tab

c. Select open – “Browse” to the CustomView_Drills folder in the User Interface


Design Section

d. Click on btnSetup.jpg, select open

e. Increase the scale (upper right corner) to an appropriate size, click on OK

Note: the original button word “setup will bleed through, open the wizard cell
and remove the word setup between the quotes and increase the height of the
row.

2. Use the same folder to add graphics to the Search Area button and the Calibrate check
box.

3. Save your job as MyDrillBits_Final.job.


10/28/2009

Communications FTP
Session 6

Objectives
•The student will correctly identify and implement the
client/server protocol of TCP/IP using the TCPDevice
structure as well as auto-inserted structures

•The student will correctly identify and implement the


master/slave protocol of synchronous acquisition using
the Network trigger and Read/WriteResult structure as
well as auto-inserted functions

• The student will implement a NOW() function and utilize


two methods to adjust the resultant string

1
10/28/2009

For What is Networking Used?


• Data
• Transfer cell values between In-Sight
g sensors,, PCs,, or
factory floor devices
• Control
• Control of Events, Triggers, Jobs, Online/Offline Status
• Image
• For display purposes in third party applications
• For image
g archival

Who can Communicate?


• In-Sight <-> In-Sight

• In-Sight <-> Computer

• In-Sight <-> PLC/Controller

2
10/28/2009

Device Functions
• WriteDevice – Sends one or more cell values to another
device over the network using TCP/IP

• ReadDevice – Receives data from another device on the


network

• TCPDevice
- Used with both WriteDevice and ReadDevice
- Establishes
E t bli h TCP/IP connection
ti

Client/Server
Client Server
(sender) (receiver)

Event

TCPDevice TCPDevice

WriteDevice ReadDevice

Data

3
10/28/2009

TCPDevice
TCPDevice – Establishes TCP/IP connection

• O
One host
h t actst as Client
Cli t (initiates
(i iti t transfer),
t f ) the
th other
th as
Server (waits for request)

• Client specifies host name in its TCPDevice


parameters (e.g., “BobF”)

• Server does NOT specify


p y host name in its TCPDevice
parameters (“”)

Client/Server
Client Server
(sender) (receiver)

Event
TCPDevice
(“is5400_00731e”, TCPDevice(“”,3000,0,0,1000)
3000,0,0,1000)
WriteDevice ReadDevice

Data
TCPDevice TCPDevice

Timeout ignored in server mode


8

4
10/28/2009

WriteDevice
WriteDevice (Event, TCPDevice, Data1, [Data2, …])

Exports data from one host to another over the network


using TCP/IP
• If Data is number, it is sent as a string
• If multiple Data parameters, they are concatenated into a
single string
• If any Data item is #ERR, nothing is sent

Example: WriteDevice($A$0, A2, A6)

A2=TCPDevice …. A6=“Accepted”
9

ReadDevice
• Imports data from another host using TCP/IP

• Always returns a string

Reference to cell
containing TCPDevice

Is activated by receipt of data: no event needed

• If data arrives when job is not running, cell is immediately


updated
• If data arrives when job is running, cell is updated as soon
as job completes
10

5
10/28/2009

Client/Server
Client Server
(sender) (receiver)

Event

TCPDevice TCPDevice

WriteDevice ReadDevice

Data

Acquire an
Image

11

TCPDevice: Auto-Inserted Functions


Inserts WriteDevice & “Test String” Inserts ReadDevice on
on Client Server

Change C2 reference to
cell containing number or string

12

6
10/28/2009

Client / Server
• For In-Sight to In-Sight, both sender and receiver must
go Online before doing a WriteDevice or ReadDevice

• Can have multiple connections between 2 devices, so


long as each connection uses a different port number

• If more than one piece of information is sent, use Text ->


String -> Token to separate the data into individual cells

Token(String,delimiter,index)

13

Master / Slave with Network Trigger


• Only applies to In-Sights

• One In-Sight is designated Master & other In-Sights are


Slaves (In cell A0)

• Master can trigger Slaves over network (Network


Triggering)

• Slaves can send back data to Master using WriteResult &


ReadResult

14

7
10/28/2009

Master/Slave with Network Trigger


Acquisition trigger on one system (Master) initiates
triggering of other systems (Slaves)
Slaves

Master
trigger network
trigger

15

Master / Slave with Network Trigger

• All Master or
Network
triggering is
configured in the
Acquire Image
P
Propertyt sheet
h t

16

8
10/28/2009

Master/Slave Configuration
Master Slaves

Any trigger EXCEPT Network MUST set trigger to be Network

To set up a group of cameras for network triggering,


their master name parameter must match exactly
(case sensitive)

17

Result Functions: Peer-to-Peer


• Only In-Sight Æ In-Sight
• WriteResult sends one or more cell values over network
• ReadResult receives those cell values
• Normally used for synchronous communications:
2 or more In-Sights triggered at the same time in
Master/Slave Configuration with Network Trigger

18

9
10/28/2009

Master/Slave: Data Flow


Slaves

Master
network trigger
trigger
ReadResult WriteResult

ReadResult

WriteResult

19

Result Functions: Peer-to-Peer

• WriteResult broadcasts one or


more cellll values
l over network
t k

• ReadResult receives one or


more cell values from specified
camera broadcasting with a
WriteResult

• GetResult functions pull out


individual values from
ReadResult structure

20

10
10/28/2009

WriteResult & ReadResult


WriteResult
Event controls
when the
WriteResult is
executed

ReadResult

C ll mustt d
Cell depend
d on AcquireImage
A i I
Choose the Host Name of broadcaster
Timeout of -1 means wait until data arrives

ReadResult receives whatever WriteResult


broadcasted (string, number, or #ERR)
21

GetResult
GetResult extracts the transmitted data from the
ReadResult structure

Receiver

Four GetResult functions are auto-inserted

22

11
10/28/2009

Result Functions: Overview


cells

Broadcasting HostA WriteResult(Cell1, Cell2, Cell3, Cell4, Cell5)


In-Sight
Network

Receiving HostB ReadResult(A0, HostA, Timeout)


In Sight
In-Sight

GetResult(ReadResult, Index)

cells Index = 0Æ4


23

Multiple Receivers
Only one ReadResult may connect to a given WriteResult
• First ReadResult which goes online and matches a WriteResult
establishes a connection bet
between
een those 2 hosts
• If another host subsequently tries a ReadResult from the same
broadcaster, the ReadResult cell will show #ERR

ReadResult

WriteResult
X
ReadResult
#ERR

24

12
10/28/2009

Result Functions
• Only one WriteResult can be used in a given job
• Receiver may have more than one ReadResult (one per broadcaster)
B
Broadcasters
d t

WriteResult
Receiver

ReadResult

R dR
ReadResult
lt

WriteResult

25

Result Functions: Synchronization


• Both broadcaster & receiver must go Online before doing a
WriteResult or ReadResult

• If more Writes than Reads, the extra values are stored in a buffer
on receiving end

• If fewer Writes than Reads, #ERR appears in ReadResult cell (as


well as in GetResult cells), unless Timeout = -1

• ReadResult & WriteResult are executed toward end of job


job,
regardless of where they are located in spreadsheet

Refer to In-Sight Guide and Reference, section on “Determination of


Cell Execution Order” for details

26

13
10/28/2009

Number of Connections
General guidelines
12 connections available per job MAXIMUM

Each TCPDevice uses 1 connection

Each ReadResult uses 1 connection

Examples:
- 12 TCPDevice functions in a job

- 12 ReadResult
R dR lt functions
f ti iin a jjob
b

- 6 TCPDevice functions + 6 ReadResult functions in a job

27

Additional Info
• Date and Time
• Resource for Date and
Time to add to
files/Images :
1. Time server
(SNTP) on the
network

2. Internal clock of
the sensor

List of Time Server Names and I.P. addresses


http://tf.nist.gov/service/time-servers.html
28

14
10/28/2009

Additional Info
• You’ve got Mail
• “SMTP” function
• Spread Sheet cell
contains a Structure

• Timer Function
• At 6PM sends a “1” (soft 2) to
the Event cell ($D$53)
referenced in the Write SMPT
property sheet to send an email

29

Additional Info
• Date and Time
• Accessing Date and Time in the
Spread Sheet
• “Now” function
Spread Sheet cell contains a
Structure and reference cell

• Date and Time formatted to add


to a file name –

illegal file characters replaced


with legal characters
(Find / Replace functions) or
modify directly in the auto-
inserted cell 30

15
10/28/2009

Flashback to Import/Export Data


• Ability to have a continuous
counter regardless of power
loss
• Create a perpetual counter using
Export / Import Data functions

• Count can be used with


WriteImageFTP filename or any other
data that uses the current cycle count

1. Export zero to zero (-0-) counters


Event = $F$7 (reset button)

2. Import current counter values


Event = #1 (above) or
$F$11= current count from last job load
31

Import/Export Data (cont.)


• Counter

Apply current count from the


perpetual counter

3. Add an Export Data


to update counts

B16 holds the continuous count and can


be concatenated with other data

32

16
10/28/2009

Summary
Peer-to-Peer Client/Server
¾In-Sight to In-Sight ¾In-Sight to any TCP/IP device

¾Master/Slave Network Trigger ¾ Asynchronous communication

• Synchronous • Communication with non-


communication In-Sights

• Common trigger
• Data sent every cycle

¾WriteResult: ¾WriteDevice:
- One per job - Can have multiple per job
- Depends on AcquireImage - Depends on event
33

Summary
Peer-to-Peer Client/Server
¾ReadResult: ¾ReadDevice:
- Returns same info as - Returns
R t last
l t string
t i received
i d
broadcast (number, string,#ERR)
- Will timeout with #ERR - No timeout
unless timeout = –1
- Depends on event - Activated by receipt of data
- Use multiple GetResults for - Must
M t parse multiple
lti l values
l
multiple values
¾No other functions needed ¾TCPDevice needed at both ends
¾No port specified by user (uses ¾User specifies port in TCPDevice
34
1069)

17
10/28/2009

Summary
• Time and Date information can be accessed as well as
formatted in order to use the string in something such
as a file name

• Import/Export data can be used as a method to create


a perpetual counter

35

18
NETWORK COMMUNICATION LAB

EXPECTED OUTCOMES:
If there is more than one setup, you will send data from one In-Sight to another In-Sight.
First, you will do this using WriteDevice and ReadDevice. Then, you will use Network
triggering to enable a master camera to trigger slave cameras over the network. Finally,
you will send the similar data using WriteResult and ReadResult.
If there are only Emulators in the network, you will be able to send results
using a Master / Slave configuration

Emulator to Emulator
-----------------------------------------------------------------------------------------------------

PROCEDURE FOR MASTER/SLAVE WITH NETWORK TRIGGERING and


RESULT FUNCTIONS: Using only Emulators

EXPECTED OUTCOMES:
This lab will be done as a group exercise. Partner up with the table closest to you. You
will take turns being the Master and the Slave. Each slave should use WriteResult to
send the results. Each master should receive that value using ReadResult.

IN-SIGHT FUNCTIONS USED: A0, Button and Count structure, WriteResult,


ReadResult, GetResult, and Master/Slave triggering

PROCEDURE – for Emulator

Master camera setup: Slave camera setup:

Start a New Job Start a New Job


Set trigger to Manual Set trigger to Network
Enable Master camera mode DO NOT enable Master camera mode
Designate a Master trigger name Use the Master trigger name in the
Networked cameras
BOTH MASTER NAMES MUST MATCH EXACTLY
Type M_Data in Master Data (A0) DO NOT designate a Master Data string
Insert a GetString function referencing $A$0
Insert ReadResult Insert a Count function to monitor A0
Insert a WriteResult
Specify a Host name Set WriteResult to send Count of A0

Save the job Save the job


Go online Go online
Manually trigger the camera
i.e.: Button you created (Acquire A0) Wait for Network trigger
Monitor Count and data from slave Check for Master Data from Master Camera
Swap Roles to appear at GetString function location
Emulator to Emulator Example

In-Sight To InSight
-----------------------------------------------------------------------------------------------------

IN-SIGHT FUNCTIONS USED: WriteDevice, ReadDevice, TCPDevice, and Token

PROCEDURE FOR DEVICE FUNCTIONS:

This lab will be done as a group exercise. Partner up with the table closest to you. You
will take turns being the send and the receiver. Each Sender should use TCPDevice and
WriteDevice to send the results for the measurement from the drill bits. Each Receiver
should receive those values using TCPDevice and ReadDevice Details follow.

Sender setup (on In-Sight system): Receiver setup (on In-Sight system):

Use existing drill bit job Use existing drill bit job
Set Trigger to Manual (cell A0) Set Trigger to Manual (cell A0)
Insert TCPDevice setup for Insert TCPDevice setup for
Client (I.P. address to send to) Server (No I.P address)
Trigger camera to send each of the Use Token statements to parse data
results from the drill bit
measurements through a
WriteDevice function
Remember to go OnLine

Save the job as MyTCPDevice.job Save the job as MyTCPDevice.job


Go online Go online
Manually trigger the camera (F5) Monitor incoming data

Swap roles.
In-Sight To In-Sight

PROCEDURE FOR MASTER/SLAVE WITH NETWORK TRIGGERING and


RESULT FUNCTIONS:

EXPECTED OUTCOMES:
This lab will be done as a group exercise. Partner up with the table closest to you. You
will take turns being the Master and the Slave. Each slave should use WriteResult to
send the results from the drill bit. Each master should receive those values using
ReadResult.

IN-SIGHT FUNCTIONS USED: AcquireImage, WriteResult, WriteResult, GetResult,


and Master/Slave triggering

PROCEDURE

Master camera setup: Slave camera setup:

Use existing drill bit job Use existing drill bit job
Set trigger to Manual Set trigger to Network
Enable Master camera mode DO NOT enable Master camera mode
Designate a Master trigger name Use the Master trigger name in the
Networked cameras

BOTH MASTER NAMES MUST MATCH EXACTLY

Designate a Master Data string DO NOT designate a Master Data string


Insert a GetString function referencing $A$0
Insert ReadResult Insert WriteResult
specify a Host name Set WriteResult to send measurement data
for the drill bits
Save the job Save the job
Go online Go online
Manually trigger the camera (F5) Wait for Network trigger
Monitor data from slave
Check for Master Data from Master camera
to appear at GetString function location

Swap roles
IF TIME PERMITS:
• Add a time stamp to the Image file
Note: Ensure time is current with Sensor or Time Server

1. Use the Now function to get time

2. Find the length of the date time stamp - use the Len function

3. Find and replace illegal characters from the time stamp - use the Find and Replace
functions

4. Repeat until all illegal characters are replaced

5. Add the reformatted Time Stamp to the WriteImageFTP File name


Cognex Course Evaluation Form
General
Name (optional) _______________________________ Company _______________________________
Date attended ____________________________
Course attended
‰ In-Sight® ‰ VisionPro® ‰ DataMan®
‰ Intellect® ‰ SmartView® ‰ Other ____________________
Location
‰ Cognex facility ‰ Customer site ‰ Regional site

Course
Did the course fulfill the learning outcomes and objectives listed at the beginning of the course notes?
‰ Completely ‰ Partially ‰ Not at all
If not, please explain:_______________________________________________________________________
Were the learning outcomes and objectives appropriate?
‰ Completely ‰ Partially ‰ Not at all
If not, please explain:_______________________________________________________________________
Which topics were most relevant to your job?_________________________________________________
________________________________________________________________________________________

Which topics were least relevant to your job?_________________________________________________


________________________________________________________________________________________

Which topics were the most difficult to understand?____________________________________________


________________________________________________________________________________________

Were there any topics which needed to be covered more in-depth?


‰ Yes ‰ No
If yes, please list: __________________________________________________________________________

Any topics which should have been covered in less detail?


‰ Yes ‰ No
If yes, please list: __________________________________________________________________________

Are there other topics not covered you would like to see included in the course?
‰ Yes ‰ No
If yes, please list: _____________________________________________________________________

Instructor Name: ________________________________________________


Clarity of presentation
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Speed of presentation
‰ Much too fast ‰ Too fast ‰ Just right ‰ Too slow ‰ Much too slow

Ability to answer questions


‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Consistency between lecture and slides and handouts


‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Knowledge of material
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Degree of preparation and organization


‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

-over-
Cognex Course Evaluation Form
Materials
Slides
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor ‰ N/A

Handouts
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor ‰ N/A

Technical documentation
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor ‰ N/A

Videos
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor ‰ N/A

Please list other materials which you would consider helpful:____________________________________


________________________________________________________________________________________

Lab Exercises
Quality and availability of assistance during lab sessions
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Level of difficulty of lab exercises


‰ Much too difficult ‰ Too difficult ‰ Just right ‰ Too easy ‰ Much too easy

Time devoted to lab sessions


‰ Far too much ‰ Too much ‰ Just right ‰ Too little ‰ Far too little

Were the lab exercises helpful in reinforcing your understanding of the course material?
‰ Yes ‰ No
If not, please explain:_______________________________________________________________________
________________________________________________________________________________________

Overall Rating
Overall rating of the course
‰ Excellent ‰ Very good ‰ Good ‰ Fair ‰ Poor

Would you recommend the course to others?


‰ Yes ‰ No
If not, please explain:_______________________________________________________________________
________________________________________________________________________________________

What other Cognex courses are you interested in attending?


‰ CVL® (MVS-8000) ‰ Introduction to Machine Vision ‰ Online Courses
‰ In-Sight® ‰ VisionPro® (8000) ‰ Other____________________
‰ Intellect ‰ SmartView®

How did you hear about our courses? _______________________________________________________


Additional Comments:_____________________________________________________________________
________________________________________________________________________________________
________________________________________________________________________________________
________________________________________________________________________________________
________________________________________________________________________________________
________________________________________________________________________________________

Thank you very much for your input! We look forward to working with you in the future.

COGNEX
Customer Education Center 10/14/04
COGNEX
Cognex Corporation
1 Vision Drive, Natick, MA 01760, USA
508-650-3000
Website: http://www.cognex.com/

Book Version 4.3 (Advanced 4.3) 2009-12-11


Copyright © 2009 Cognex Corporation. All Rights Reserved. Printed in USA. This document may not be copied in whole or in part, nor transferred to any
other media or language without the written permission of Cognex Corporation.
6. Save the job as Comm_FTP_1.job onto the In-Sight camera’s Flash ROM
In addition, it may be advisable to save the job as Comm_FTP_1.job onto the PC

7. Try altering the data again, but this time only change the format in the result cell –
GetClock. Do not use any additional functions.

MGP/gb/bbb labNetworkComm.doc 12/10/09 7:12 PM

You might also like