Professional Documents
Culture Documents
Section 1 | Slide 2
The In-Sight Spreadsheets Advanced class teaches the more advanced topics of how to configure a **Upon successful completion of the In-Sight Spreadsheets Advanced training course
vision application using the spreadsheets configuration environment and user interface. the participant will receive 1.2 CEUs.**
The In-Sight Spreadsheets Advanced product class puts the focus on getting the most out of the In-Sight In order to earn CEUs (Continuing Education Units) for this training event the participant will:
Explorer spreadsheets interface. The spreadsheets interface uses intuitive tools and traditional • Be an active participant throughout the training event
spreadsheets functions allowing students to focus on solving their application quickly and effectively while • Be in attendance for 100% of the training course’s designated training hours
taking advantage of the latest and greatest tools available through the spreadsheets. o The participant can miss up to 15% of the live training event and still earn CEUs provided
they watch the prerecorded missed lessons, performs the hands on lab exercises and
The labs will give you hands-on experience with the inspection of an actual part. completes the appropriate skills journal entries
• In a 2 day class = 126 minutes (2 hours and 6 minutes)
• In a 4 day class = 252 minutes (4 hours and 12 minutes)
At the end of the In-Sight Spreadsheets Advanced training class, Participants will be able to: Proprietary Interests are profits, rights, ownership shares or advantages held by the full or partial owner
of a tangible or intangible asset or property.
- Configure the PatMax (PatMax and PatMax RedLine) tools
- Incorporate InspectEdge tools to solve challenging applications involving complex edges The Cognex Technical Instructors have no proprietary interest in any of the materials or products that are
- Analyze the results returned from the OCRMax tools included within this training event.
- Determine where color tools are helpful and implement them
- Implement Dialog Boxes and Wizards, Audit Messaging, and Test Run functions into an
application
- Identify applications for the Flaw Detection tools and implement these tools
- Demonstrate how the spreadsheet can interface with JavaScript programs
PatMax and PatMax At the end of this Section Participants will be able to:
RedLine
- Identify uses for the PatMax technology
Section 1
- Configure the PatMax (PatMax and PatMax RedLine) tools
- List 3 differences between PatMax and PatMax RedLine
- Implement the PatMax tools to solve challenging applications
Section 1 | Slide 6
The first section of the In-Sight Spreadsheets Advanced training will focus on the PatMax and PatMax At the end of this section of training, Participants will be able to:
RedLine tools.
- Identify uses for PatMax technology
- Configure the PatMax (PatMax and PatMax RedLine) tools
- List 3 differences between PatMax and PatMax RedLine
- Implement the PatMax tools to solve challenging applications
A PatMax pattern is a collection of geometric features where each feature is a point on the boundary PatMax more closely resembles the way humans discern between similar things and recognize familiar
between two regions of dissimilar pixel values. PatMax calculates geometric representations of curves. ones.
This makes it more accurate than FindPatterns, which approximates curves with line segments that follow
the pixel grid. Consider the examples of remembering the faces of people you know well.
Even if the faces change due to lighting, extra features, and fewer features, you will still likely
recognize them if there is enough of the original detail intact.
FindPatMaxPatterns
- Finds features in an image based
on the trained pattern
TrainPatMaxPattern
- Extracts and trains a pattern: a
trained geometric description of an
object you wish to find
PatMax offers three key features that distinguish it from other pattern-location technologies in machine The TrainPatMaxPattern Property Sheet includes the following:
vision:
- High-speed location of objects whose appearance is rotated, scaled and/or stretched - Image – Reference to target image cell
- Location technology that is based on object shape, not greyscale values - Fixture – Where tool should fixture itself
- Very high accuracy - Pattern Region – Region specifying features to train
- External Region – Allows use of custom region
PatMax uses two tools: - Pattern Origin – Location within pattern to report
- FindPatMaxPatterns - Pattern Settings – Specialized settings
- Finds features in an image based on the trained pattern - Algorithm – Choose from PatQuick or PatMax
- TrainPatMaxPattern - Elasticity – Specifies allowed perimeter deviation
- Extracts and trains a pattern; a trained geometric description of an object you wish to - Ignore Polarity – Toggles to check for opposite polarity
find - Sensitivity – Disabled
- Coarse Granularity – Granularity used to find large features
- Fine Granularity – Granularity used to find small features
- Reuse Training Image – Model image is saved for later use (retrain)
- Timeout – Milliseconds before tool gives up
- Show – Graphic options to display
NOTE: Any time you make region changes to the TrainPatMaxPattern tool (directly or through an
EditRegion), the model is retrained on whatever is inside the training region at that time – even with the
“Reuse Training Image” selected. If that is not selected, any changes to TrainPatMaxPattern will retrain
the model.
PatQuick PatMax
Choose from two algorithms: Elasticity specifies the amount of non-linear perimeter deviation (0 to 10; 0 = default).
- 0 = No Tolerance
PatQuick - 1 or Greater = Flexible Boundary
- First step in PatMax
- Uses coarse granularity (details later) A linear change in a pattern is where the whole pattern changes in the same way. For example, if a cross
- Faster than PatMax, but less accurate were twice as large all over, as the model, that would be a linear change, called Scale. But in the cross at
the right, only part of the cross has changed. For example, it could be made of rubber, and the top
PatMax section was pulled out at the corners. This is a non-linear change.
- Uses fine granularity (details later)
- Slower than PatQuick, but more accurate Increasing the elasticity parameter makes it more likely to find a part such as this. But if you increase the
elasticity value too much, you run the risk of a wrong feature being selected.
NOTE: The color of a trained feature (Green, Yellow and Red) represents the quality of the feature
candidate for matching. Green represents high quality; Red represents low quality and Yellow is
intermediate quality. The Granularity parameters should be adjusted until all trained features are green or
you should select a better image to train. Distinct features (edges) and good image contrast will yield the
best results.
Model
The Ignore Polarity defines whether or not parts with color-inverted match features will be considered On the left:
matches (default = Off, unchecked). When Ignore Polarity is applied (On, Checked), detected patterns Ignore Polarity is unchecked, meaning a part must match the polarity of the model. Only one match is
with color inverted features, such as black/white vs. white/black in the Model pattern, for example, will be reported.
classified as matching the Model pattern.
On the right:
Ignore Polarity instructs PatMax to check for original polarity identified at training and opposite polarity as Ignore Polarity is checked. Both parts match the shape of the Model, and both are reported, even
well. This may increase the execution time for PatMax. though the part on the right is opposite polarity from the model.
GetGranCoarse returns
6.579
Granularity works to determine the number of boundary points extracted from features in an image. Coarse Granularity is used by the PatQuick algorithm.
- A granularity value of 6 means that boundary points will have a radius of 6 pixels where no other - If set to 0, it is automatically set to the best value for coarse granularity.
boundary points can exist. - If set to > 1, coarse granularity is manually set to that number.
- A granularity value of 1 means that boundary points will have a radius of 1 pixel where no other
boundary points can exist. Since PatQuick is optimized for speed, coarse granularity should never be set to 1.
GetGranFine returns 1
Fine Granularity is used by the PatMax algorithm. The algorithm used by PatMax in pattern matching involves more than points. In the end PatMax creates
- If set to 0, it is automatically set to 1. a compilation of vectors which include boundary point information, direction (polarity), and their
- If set to > 1, fine granularity is manually set to that number, and is no longer using the best relationship to one another.
accuracy setting.
Since PatMax is optimized for accuracy, fine granularity should always be set to 1.
GetTrained
0 80 100
Accept = 80
No match is found
Not Valid Accept Valid
Matches Threshold Matches
Accept = 70
Match is found with a score of 87.405
Section 1 | Slide 21 Section 1 | Slide 22
Accept Threshold defines the degree of similarity that must exist between the model pattern and the Why wasn’t a match found with Accept = 80?
found feature. The minimum acceptable score will vary depending upon the Location Tool selected.
Accept is used only with PatQuick, which uses coarse granularity. Suppose, at coarse granularity, the
PatMax uses this to determine if the match represents a valid instance of the model within the search part scores 75%, and so fails because it is below 80%.
region. Increasing the Accept value reduces the time required for search. With Accept = 70, a part scoring 75% passes in PatQuick, and so is reevaluated in PatMax, using fine
granularity (more points). With fine granularity, it scores 87.405% and passes.
NOTE: A way around this is set Accept low so that more parts pass PatQuick and are then reevaluated in
PatMax using fine granularity. You can use logic in the spreadsheet to compare the reported score to the
desired threshold score.
In the example in the slide, we could set Accept to 20, and then add the following in another cell:
If(G7>80, 1, 0) where G7 is the cell with the score and 1 means pass.
This would still allow a threshold of 80%, but the pass/fail would be based on fine granularity.
Increasing the Accept value reduces the time required for a search because fewer features will be
promoted from PatQuick to PatMax.
The minimum acceptable contrast that must be present in the found pattern to be
considered a match
92 62 31
16 5 Score: 68
Score: 94
Contrast Threshold defines the minimum acceptable contrast that must be present in the found pattern; Clutter is a term used to describe extra features present adjacent to the boundary features of the part
the contrast for a found pattern must be greater than the Contrast Threshold value to be considered a that are not part of the original model.
valid instance. A low Contrast Threshold value is used for low-contrast images, while a high Contrast
Threshold value is used for high-contrast images. Clutter in Score – Specifies whether missing or occluded pattern features will reduce the response
score(s).
Contrast threshold sets the minimum contrast required in order to consider a change in grayscale a
potential boundary point. For a boundary point to be detected its feature contrast must exceed this value. - 0 = OFF
Do not include the effect of clutter in score.
- 1 = ON (default)
Include the effect of clutter in score.
Outside Region specifies the percentage of pattern features that may be found outside the Find Region Find Tolerances – Specifies the settings for finding patterns that are rotated or scaled with respect to the
without degrading the pattern response score (0 to 100: default = 0). trained pattern.
The Score of the feature will be based only on section of the feature that is within the Find Region. - Angle Start – Specifies the angle at which to begin searching for matches, in degrees counter-
clockwise (-180 to 180, default = -15).
- Angle End – Specifies the angle at which to stop searching for matches, in degrees counter-
clockwise (-180 to 180; default = 15).
- Scale Start – Specifies the scale at which to begin searching for matches (1 to 10,000; default
= 100).
- Scale End – Specifies the scale at which to stop searching for matches (1 to 10,000; default =
100).
- Aspect Ratio – Limits match-finding to uniform scale only or allows aspect ratio in X or Y, in
addition to a uniform scale.
NOTE: The Aspect Start and Aspect End parameters are disabled if Uniform Scale Change is
selected.
- 0 = Uniform Scale Change
- 1 = Uniform and X Change
- 2 = Uniform and Y Change
- Aspect Start – Specifies the minimum scale change, at which to begin searching for matches,
as a percentage of the trained pattern (1 to 10,000; default = 100).
- Aspect End – Specifies the maximum scale change, at which to stop searching for matches, as
a percentage of the trained pattern (1 to 10,000; default = 100).
Find Overlapping specifies the settings for finding patterns that overlap each other with respect to PatMax RedLine has been designed from the ground up to be optimized for speed on the newer In-Sight
position, rotation, and scale. 5 megapixel models. PatMax RedLine is typically 3 – 7X faster than PatMax, and is sometimes even
faster. It allows for both speed in pattern matching and high resolution (accuracy).
- XY Overlap – Specifies the expected position difference between multiple overlapping patterns
in roughly the same X,Y location, as a percentage of the trained pattern size (0 to 100; default = NOTE: This function is only available on In-Sight vision systems running In-Sight firmware 5.1.0 and later.
80).
- Angle Overlap – Specifies the expected angle between multiple rotated overlapping patterns in PatMax RedLine uses two tools:
roughly the same X,Y location. A (0 to 360; default = 360). - FindPatMaxRedLine
- Scale Overlap – Specifies the expected uniform scale difference between multiple overlapping - Finds objects in an image based on a trained pattern. FindPatMaxRedLine finds
patterns in roughly the same X,Y location, as a percentage of the trained pattern size (1 to patterns within an image based on a trained pattern from a Patterns structure.
10,000; default = 140). - TrainPatMaxRedLine
- Aspect Overlap – Specifies the expected aspect scale difference between multiple overlapping - Extracts and trains a pattern from an image for use with the FindPatMaxRedLine
patterns in roughly the same X,Y location, as a percentage of the trained pattern size (1 to function.
10,000; default = 140).
In-Sight series 57xx and 8xxx PatMax RedLine 150 ms (3.2x faster) PatMax RedLine 111 ms (4.9x faster) PatMax RedLine 31 ms (6.8x faster)
PatMax RedLine 208 ms (16x faster) PatMax RedLine 54 ms (4.5x faster) PatMax RedLine 810 ms (10.8x faster)
In-Sight Micro 8405 PatMax = 3330 ms PatMax = 242 ms PatMax = 8795 ms*
In-Sight 5705
Section 1 | Slide 29 Section 1 | Slide 30
Requirements for PatMax RedLine: The speeds depend on the In-Sight model, the nature of the part itself, and the settings in the Property
- In-Sight series 57xx and 8xxx Sheet, including Model Region, Find Region, and Angle of Rotation.
- Spreadsheet mode: In-Sight Explorer and firmware version 5.1.0 or higher
- EasyBuilder mode: In-Sight Explorer and firmware version 5.2.0 or higher NOTE: These timings were obtained on an In-Sight 5705.
FindPatMaxRedLine
PatMax RedLine consists of two functions: TrainPatMaxRedLine and FindPatMaxRedLine. Moving from PatMax to PatMax RedLine:
NOTE: These functions are only available on In-Sight vision systems running In-Sight firmware 5.1.0 and - Existing job files using PatMax can be converted to PatMax RedLine
later. - Load job on supported 5 MP system (5705, 5705C or Micro 8405)
- Replace TrainPatMaxPattern function with TrainPatMaxRedLine
TrainPatMaxRedLine – Extracts and trains a pattern from an image for use with the FindPatMaxRedLine - Retrain the pattern using PatMax RedLine (PatMax RedLine can not use PatMax
function. patterns)
NOTE: A trained pattern consumes approximately 1Mb when using the default pattern Region (320 X 440), - Replace FindPatMaxPatterns with FindPatMaxRedLine
although the pattern size varies greatly depending on the size of the trained pattern. - However, there are some differences in the Property Sheet parameters and how they work.
- Some parameters are not present in both tools
FindPatMaxRedLine – Finds objects in an image based on a trained pattern. FindPatMaxRedLine finds - Some parameters are in both tools, but behave differently
patterns within an image based on a trained pattern from a Patterns structure.
Setup and runtime differences between PatMax and Applications where PatMax may still be needed:
PatMax RedLine include:
- Fixtured search region (tool can run slow)
- Accept Thresholds and scoring methods are different - Variable aspect ratio, perspective, or skew
- Contrast Threshold has different meaning - Non-linear deviations along perimeter
- Automatic search optimization behaves differently - Filtering match results at approximately same X/Y location by
- Angle and Scale Find Tolerance behavior is different Angle and Scale Overlap
PatMax RedLine matches tend to score higher than PatMax. Therefore, it may be necessary to use a Differences:
higher Accept Threshold for PatMax RedLine compared to PatMax.
- Fixtured search region – PatMax RedLine’s automatic search optimization may cause it to run
PatMax RedLine contrast is a relative measure of contrast change between features in the trained slower than PatMax if the search region is fixtured, especially when searching for multiple
pattern versus target features in the search image. PatMax contrast is an absolute measure of contrast targets on a confusing image background
for target features in the search image. - Variable aspect ratio, perspective or skew – PatMax RedLine does not yet support X/Y
aspect ratio changes, perspective changes, or skew in target compared to trained pattern
In PatMax RedLine, an automatic (re)optimization occurs following any change to Angle/Scale Find - Non-linear deviations along perimeter – PatMax RedLine does not yet have an Elasticity
Tolerances or search ROI. This includes optimization at every trigger when PatMax RedLine is fixtured. parameter, and may be less tolerant of deviations along the target perimeter compared to
This can make the tool run slow if it is fixtured. However, PatMax RedLine is so much faster than PatMax
PatMax for a 5MP image that a fixture is no longer needed in most cases. - Filtering match results at approximately the same X/Y location by Angle and Scale
Overlap – PatMax RedLine cannot filter results based on angle and/or scale differences
PatMax RedLine Find Tolerances are strict, meaning the tool will fail if a limit is exceeded. PatMax Find between two or more matches found at the same X/Y location (as allowed by XY Overlap
Tolerances are permissive, meaning there is some allowance beyond the limits. Therefore, if PatMax setting).
RedLine does not find matches that PatMax finds, it may be necessary to widen the Angle and Scale Find
Tolerances in PatMax RedLine.
PatMax
FIndPatterns PatMax
RedLine • PatMax can be used to locate trained models when the
~4 times more appearance of the model is adversely affected.
~4 times more accurate
Location Accuracy accurate accurate than
than FindPatterns
FindPatterns
• PatMax provides high accuracy because the model is
4x - 7x faster than
Relative Speed good moderately fast
PatMax
feature based.
Excellent for Excellent for challenging
Versatility
Excellent for many
applications
challenging apps requiring both • PatMax RedLine provides both high speed and high
applications speed & accuracy
resolution.
Scale Range 90 - 110% 1 - 10,000% 1 - 10,000%
• Both PatMax and PatMax RedLine consist of two
Additional Price included ~$500
~$750 functions, one for training and one for finding.
(includes PatMax)
Take a moment to review the differences between the Pattern Matching tools that are available in the In this section we covered the following topics:
various In-Sight vision systems. Comparisons of speed are general, and may not apply to every situation.
The best way to compare speeds is to measure them for your setup. - PatMax can be used to locate trained models when the appearance of the model is adversely
affected.
- PatMax provides high accuracy because the model is feature based.
- PatMax RedLine provides both high speed and high resolution.
- Both PatMax and PatMax RedLine consist of two functions, one for training and one for finding.
Section 1 | Slide 37
Complete:
Lab Exercise 1.1 – PatMax
Section 1 | Slide 37