In-Sight Spreadsheets Advanced Final Lab Final Lab Section 1 - Patmax

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

In-Sight Spreadsheets Advanced Final Lab Section 1 – PatMax


Final Lab
• Part: Keys
Objective: • Estimated Time: 10-15 minutes
In this Final Lab, you will select some of the tools covered in this class – the ones that interest • Emulation: In-Sight 7400
you the most – and explore them further, using additional images of parts. The instructions • Tools: TrainPatMaxPattern and FindPatMaxPatterns
are deliberately less detailed than in the sectional labs, encouraging you to come up with • Overiew: You will use four PatMax tools, each with a pattern for one of the four differently
your own solutions. In some cases, there will be more than one way to solve the application. shaped keys. Then you will inspect images of unknown keys to identify which pattern
Most of the exercises include sample jobs located in the same folders as the images. each key matches best, based on the scores returned.

It is not expected that you complete all the sections of this Final Lab in the time allocated,
just those that are the most relevant to your applications.

Before You Start:


Create a new folder on the Desktop named AdvancedJobs for storing the jobs you create
in this Final Lab.

All image folders are found in the following (or similarly named) pathway:
1. Start a new job.
IS_Student\Classes\Spreadsheets Advanced\Resources_Final_Lab 2. Browse to the images file in the Keys folder.
3. Use a different TrainPatMaxPattern tool to train a model of each of the 4 key variations
Contents: (Key1 – Key4)
Section 1: PatMax (1 exercise) 4. Add four FindPatMaxPatterns tools to search for the four patterns.
Section 2: InspectEdgeForDefects (3 exercises) 5. Insert logic in the spreadsheet to choose the pattern with the highest score, which
BeadInspect (1 exercise) should be the correct key.
Section 3: OCRMax (3 exercises) 6. Run the job on images sample00 – sample08.
Section 4: Color (2 exercises)
Section 5: TestRun (1 exercise) 7. Save your job as MyKeys.
Section 6: Flexible Flaw Detection (3 exercises)
Section 7: Surface Flaw Detection (1 exercise)
Section 8: Scripting (2 exercises)

Page 1 Page 2
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Final Lab Section 2 – Edge and Bead Inspection Tools

Exercise 2.1: InspectEdgeForDefect

• Part: Cookies
• Estimated Time: 10-15 minutes
• Emulation: In-Sight 7400
• Tools: InspectEdge and InspectEdgeForDefect
• Overview: All four cookies should fail, due to missing parts of the edges. However, the
radial cracks should not be reported as defects. 1. Start a new job.
2. Browse to the images file in the Unions folder.
3. Use a pattern tool to fixture the part.
4. Use InspectEdge and InspectEdgeForDefect tools to inspect the parts. The first
four images should fail, while the last four images should pass.
HINT: The Region for InspectEdge should be an annulus. This can be created by
dragging the Bend icon on the Region around circularly.
5. Save your job as MyUnions
1. Start a new job.
A sample solution job is provided in the Unions folder. It includes numerous
2. Browse to the images file in the Cookies folder. comments. It also inspects for the diameter of the parts being in a range.
3. Use the InspectEdge and InspectEdgeForDefect tools to inspect the four cookies.
All four should fail. The defects should be the varations on the circumference. The
cracks that go inward radially should not be flagged as defects.
HINT: The Region for InspectEdge should be an annulus. This can be created by Exercise 2.3: BeadInspect
dragging the Bend icon on the Region around circularly.
4. Save your job as MyCookies. • Part: Gaskets
A sample solution job is provided in the Cookies folder. • Estimated Time: 10-15 minutes
• Emulation: In-Sight 7400
• Tools: BeadFind and BeadInspect
• Overview: You will inspect for defects on the beads
Exercise 2.2: InspectEdgeForDefect

• Part: Unions
• Estimated Time: 15-20 minutes
• Emulation: 7400
• Tools: InspectEdge and InspectEdgeForDefect
• Overview: The “defects” that the tool will identify are not actually defects, but desired
depressions called “grips.” We want to confirm there are 18 grips. Fewer than 18 grips
should cause the part to fail.

1. Start a new job.


2. Browse to the images file in the Gaskets folder.

Page 3 Page 4
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

3. Use BeadFind and BeadInspect tools to inspect the parts. The first three images Final Lab Section 3 – OCRMax
should pass, while the last three images should fail.
4. Save your job as MyGaskets.
Exercise 3.1: OCRMax Distorted Images

• Part: Distorted characters


Exercise 2.4: InspectEdgeForDefect • Estimated Time: 10 minutes
• Emulation: In-Sight 7400
• Part: Caps • Tools: OCRMax
• Estimated Time: 20-30 minutes • Overview: Read the characters
• Emulation: In-Sight 7400
• Tools: InspectEdge and two InspectEdgeForDefect tools
• Overview: You will inspect the outer and inner edges for defects.

1. Start a new job.


2. Browse to the images file in the Distorted folder.
3. Use OCRMax to read the characters.
4. Save your job as MyDistorted.

1. Start a new job.


Exercise 3.2: OCRMax ExpirationDate
2. Browse to the images file in the Caps folder.
3. Use an InspectEdge tool and two InspectEdgeForDefect tools to inspect the caps.
• Part: Characters with expiration dates
Make the region for InspectEdge an annulus. Configure one InspectEdgeForDefect to
• Estimated Time: 10 minutes
analyze the inner edge and the other to analyze the outer edge. The first four images
• Emulation: In-Sight 7400
should fail, while the last three images should pass.
• Tools: OCRMax
HINT: The Find Edge Direction and Edge First parameters must be configured • Overview: Read the expiration dates. Then verify a date.
properly.

4. Save your job as MyCaps.


A sample solution job is provided in the Caps folder.

1. Start a new job.


2. Browse to the images file in the Expiration folder.
3. Use OCRMax to read the characters.
4. Change the OCRMax to verify that the expiration date is 1/14. The first four images
should pass, while the last image should fail.
5. Save your job as MyExpirationDate.
A sample solution job is provided in the Expiration folder.

Page 5 Page 6
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Final Lab Section 4 – Color


Exercise 3.3: OCRMax HotBlock
Exercise 4.1: Color Fuses
• Part: block with multiple lines of characters
• Estimated Time: 10-15 minutes
• Emulation: In-Sight 7400C (color) • Part: Fuses
• Tools: OCRMax • Estimated Time: 20-30 minutes
• Overview: Read the characters. Then verify the expiration date. • Emulation: In-Sight 7400C
• Tools: TrainExtractColor, ExtractColor, DetectBlobs
• Overview: inspect fuses to make sure that the fuse elements are intact. You will use the
Extract Color tools to create a binarize image of the fuse, followed by a DetectBlobs tool
to inspect the binarized image.

This is the lab that appears in the Color section of this class, dsignated as “If Time
Permits.” If you did not complete it then and want to delve more into the Extract Color
tools, go back to that section and do the lab.

go back g o back t o
1. Start a new job.
2. Browse to the images file in the HotBlock folder. • Part: Fruit
3. Use several OCRMax tools to read the characters. • Estimated Time: 10-20 minutes
4. Change the OCRMax that reads the expiration date to verify that the expiration date is • Emulation: In-Sight 7400C
26/08/2016. All images should fail. • Tools: MatchColor and ExtractColor
5. Save your job as MyHotblock • Overview: You will compare the Match Color tools with the Extract Color tools for
A sample solution job is provided in the HotBlock folder. identifying apples and oranges. First, try MatchColor. It can be configured to work, but
the difficulty is that the fruit has shadows and glare, i.e., it is not a uniform color. After
trying MatchColor, try ExtractColor, which should be easier because it can handle the
shadows and glare as different colors.

1. Start a new job.


2. Browse to the images file in the Fruit folder.
3. Use PatMax to locate the parts, using the bottom half of the orange as the Model.

Page 7 Page 8
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Click “OK.” This will create a structure in a cell with the trained colors Library.

7. Add a MatchColor tool. Set the region of interest to cover ONLY the area where each
color will be displayed

4. Add a TrainMatchColor to the job. Click on the “Add New Color” button and place
the tool region (Circle) around an area free of any other markings and represents the
color to train. Click on the Green Check Box or the “Enter” key.

NOTE: Making the Region of Interest too lage or small will affect the averaging of
pixels to determine a match. Example –Too large would include the background
pixels,too small –just saturated pixels, thus changing the average pixel color found.

Reference the Match Color Library parameter to the cell containing the
TrainMatchColor tool you just created.
5. Name each color to something more intuitive than Color_1. Orange will work for this
particular selection. Run the images through your job and see if it correctly identifies the fruits. If not, try
modifying training region(s), the matching region, and/or tolerance slider

Save your job as MyMatchFruit.


A sample solution job is provided in the Fruit folder.

8. Take a different approach by adding TrainExtractColor and ExtractColor tools,


treating the different light intensities as separate colors.

9. Compare the two approaches (Match vs. Extract) in terms of ease of use and
effectiveness.

10. Save your job as MyExtractFruit.

6. Repeat the process for Apple. Be sure to click on the appropriate image in the “Film
Strip’ to train on.

You will probably need to account for different intensities of a single color by using the
Color Tolerance Bar to adjust for lighter or darker appearances of each color.

Page 9 Page 10
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Final Lab Section 5 – TestRun Final Lab Section 6 – Flexible Flaw Detection
• Part: Aluminum blocks Exercise 6.1: Flexible Flaw Detection
• Estimated Time: 15-20 minutes
• Emulation: Standard • Part: Knobs
• Tools: TestRun • Estimated Time: 15 minutes
• Overview: Configure TestRun to verify a job • Emulation: In-Sight 7400
• Tools: TrainFlawModel, FlexFlawModel, DetectFlaw
• Overview: Use the Flexible Flaw tools to look for defects on knobs

1. Browse to the images file in the Knobs folder. Cycle through the images to see the
variations you will encounter. Image0 and Image7 represent good parts, without any
defects. The other images are bad parts.
2. Use PatMax tools to fixture, using the following pattern region on Image0:

1. Open the job TestRunBlock in the TestRun folder.


2. Go to the TestRun utility and select Configure.
3. Set the Job Pass/Fail cell to C44.
4. Under Image DataBase Folder, navigate to the TestRun folder.
5. Under Job  Image Selection, select all five images by checking them. Also click
on the Good button for the first image, and the Bad button for the other four images.
6. There are three kinds of defects:
Gouge, as denoted by 0 or 1 in cell L16
Incorrect Holes, denoted by 0 or 1 in cell O27
Incorrect Width, as denoted by 0 or 1 in cell L20
3. Insert and configure TrainFlawModel, FlexFlawModel (if needed), and DetectFlaw
Set up and apply Defect Tests for the five images as follows: tools to identify the following defects:
Image0: 0 defects (good part)
Image1: 1 defect: gouge 4.
Image2: 3 defects: gouge, holes, and width
Image3: 0 defects (good part)
Image4: 3 defects: gouge, holes, and width Image1

7. Run TestRun to verify the job.


8. Save your job as MyTestRun.
9. Change cell L20 (the logic for width) to 0 so it always fails. Run TestRun again and
observe what happens.
Image2

Page 11 Page 12
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Image3

Image4

Image5
3. Insert and configure TrainFlawModel, FlexFlawModel (if needed), and DetectFlaw
tools to identify the following defects:

4.

Image6
Image0

5. Save your job as MyKnobs.


A sample solution job is provided in the Knobs folder.

Image1
Exercise 6.2: Flexible Flaw Detection

• Part: LCD screen


• Estimated Time: 15-20 minutes
• Emulation: In-Sight 7400
• Tools: TrainFlawModel, FlexFlawModel, DetectFlaw
• Overview: Use the Flexible Flaw tools to look for defects on LCD screens
Image2

1. Browse to the images file in the Screens folder. Cycle through the images to see the
variations you will encounter.
2. Image0 – Image4 represent bad parts, with defects. Image5-Image12 have defects.
Use PatMax tools to fixture, using the following pattern region on Image6:

Page 13 Page 14
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

2. Create a Fixture using the “Aquafr” letters as the pattern.


3. Insert a TrainFlawModel tool to train on image001.bmp.
4. Insert a FlexFlawModel tool that references the TrainFlawModel. Specify a search
Image3 region as follows:

Image4

5. Use the Default Flex Recipe.


5. Save your job as MyScreens. 6. Insert a DetectFlaw tool.
A sample solution job is provided in the Screens folder.
7. Set the DetectFlaw tool Contrast to 20 and find both Area defects and Missing Edges.
NOTE: Defects should be found in images 11, 12, 13, 14, 16, 17, 18, 20, 21, 129, 138,
152, 153, 154, 155, 156, 157, 162, 203 and 208.
Exercise 6.3: Flexible Flaw Detection 8. Save your job as MyLabel.

• Part: Labels
• Estimated Time: 20-30 minutes
• Emulation: In-Sight 7400
• Tools: TrainFlawModel, FlexFlawModel, DetectFlaw
• Overview: Use the Flexible Flaw tools to look for defects on labels

1. Browse to the images file in the Labels folder. Cycle through the images to see the
variations you will encounter.

Page 15 Page 16
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Final Lab Section 7 – Surface Flaw Detection HINT: Make sure you set your Detection Size to be larger than the defect to be found.
4. Save the job as MyInsightLabel.
• Part: In-Sight labels A sample solution job is provided in the In-Sight_Label folder.
• Estimated Time: 20-30 minutes
• Emulation: In-Sight 7402
• Tools: Mask and SurfaceFlaw
• Overview: Use the SurfaceFlaw tool to look for defects on labels that also have the In-
Sight logo on them. To ignore the logo, you will use a Mask structure.

Good Part:

1. Browse to the images file in the InSightLabels folder. Cycle through the images to see
the variations you will encounter.
2. Use the Mask and SurfaceFlaw tools to detect flaws on a sponge. Image0-Image4
should pass, while Image5-Image14 should fail.

Image6:

3. You will need to use fixturing.

Page 17 Page 18
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

Final Lab Section 8 – Scripting The Snippets Menu displays.


In the two sub-sections of this lab, you will take a look at some existing scripts.

Exercise 8.1: Scripting with Multiple Gets for Results

• Part: none
• Estimated Time: 15 minutes
• Emulation: In-Sight 5705 and version 5.1 or later of In-Sight Explorer
• Tools: Script, Get
• Overview: This lab demonstrates the use of a Script with a variable number of inputs,
and four results that are inserted in spreadsheet cells by four Get functions.

At the end of this lab exercise, Participants will be able to:


- Change a spreadsheet to pass 12 input values to a Script instead of 10 values
- Change a JavaScript program to calculate an additional value and return it to the
spreadsheet

1. Start a New Job. No images are used.


2. Click on the Snippets tab in the Palette.

3. Open the Scripting category and drag the ArgumentsAndResults snippet into cell
A2 of the spreadsheet.

Page 19 Page 20
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

The spreadsheet displays. 8. Find the part of the JavaScript program that looks like this:
return {
avg: avg,
stddev: stddev,
min: minAndMax.min,
max: minAndMax.max
}
}
NOTE: The ‘return’ tells the Script to return the four values calculated elsewhere in
the Script, naming the returned values avg, stddev, min, and max. The four Gets in
the spreadsheet use these same names.
9. Modify the Script so that it also returns the ratio min/max.
The return section will look like this:
return {
avg: avg,
stddev: stddev,
min: minAndMax.min,
max: minAndMax.max,
ratio: minAndMax.min/minAndMax.max
}
}
Description of Snippet: 10. Add another Get to the spreadsheet to display the ratio.
A4:A15 contain 10 numbers, generated by Rand (random number) functions. The updated spreadsheet displays.
D3: Script(A4:A15) – This executes JavaScript code written to calculate the
average, standard deviation, minimum, and maximum of the 10 numbers.
D4: Get(D3, “avg”) retrieves the average calculated by the Script
D5: Get(D3, “stddev”) retrieves the standard deviation calculated by the Script
D6: Get(D3, “min”) retrieves the minimum calculated by the Script
D7: Get(D3, “max”) retrieves the maximum calculated by the Script
NOTE: Each time the spreadsheet is executed, new random numbers are generated
by the Rand functions and sent to the Script.
4. Insert a Button function into cell B0 and change its trigger parameter to Manual.
NOTE: When running the Emulator, F5 or the toolbar trigger icon does not trigger the
spreadsheet.
5. Each time you click the Button, the spreadsheet will execute, the 10 input values
will change, and the average, standard deviation, minimum, and maximum will
update.
6. Add 2 more Rand functions in cells A16 and A17.
NOTE: This increases the number of values from 10 to 12. Each time you click the
button the spreadsheet will now process 12 values.
7. Double click on cell D3, which will display the JavaScript code.
NOTE: Read through the code to get a sense of how it works. Even if you are not
familiar with JavaScript, you can read the comments.

Page 21 Page 22
In-Sight Spreadsheets Advanced Final Lab In-Sight Spreadsheets Advanced Final Lab

3ge Labe 3 3Look at Additional Examples of Scripting 3. To execute an example, check the Enable checkbox for that example.

• Part: LCD screen


• Estimated Time: 15-30 minutes
• Emulation: In-Sight 5705 and version 5.1 or later of In-Sight Explorer
• Tools: Script, Get NOTE: Some of the examples show alternate ways to set up Scripting to accomplish
• Overview: the same thing.
Participants will analyze sample Scripts that: 4. The last example requires an image – use the images in the Scripting folder.
− Add two numbers
− Compute the sum and mean of four numbers and return two outputs
− Compute the mean and maximum of the height and width of blobs detected in an
image
− From two blob results, return the blob results set that has 1) highest average
blob area if today's date is an even number, or 2) lowest average perimeter if
today’s date is an odd number
− Compare two dates and determine which occurs sooner
− Plot a polygon using randomly picked centroids from blobs in an image.

The only Script that requires an image is the last.

1. Navigate to the Scripting folder and open the Scripting_GettingStarted job.


2. This job contains a number of examples of Scripts, each described by comments in The Script will plot a polygon on the image similar to the image below.
the spreadsheet and each controlled by a CheckBox. NOTE: The crosshairs will be in green, the connecting polygon in red.

Page 23 Page 24

You might also like