Top Banner
Label Light Exercise
44

Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Jan 15, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Label Light Exercise

Page 2: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 2

Profiles related to the exercise

• When starting use profile:Label_Light_Start

• The fully completed profile:Label_Light_Final

Page 3: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 3

ObjectivesTo solve a complex vision task using

the following fuctions:

• Scorpion reference system

• Intensity Tool

• LineEdgeFinder and LineEdgeCaliper Tools

• Constructing lines between points/lines

• Make a simple Phyton script

Page 4: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 4

Task - Label

• Measure– Label position on syringe

• Resolution 1/100 mm

• Tolerance 5/100 mm

• Check – Position is between 3.6 and 3.85 mm.

Page 5: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 5

SetupImage shows syringe with label.

The syringe is illuminated with a diffuse lighting with a dark background. This reduces reflections and ensures edge contrasts.

To measure the label position it is necessary to constructs a reference line defined by the two edgepoints where the syringe starts to get smaller.

The image is captured with an industrial Sony b/w camera XC-75, 760 x 570 pixels and 256 gray levels

Page 6: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 6

Scorpion in Operation

• This exercise is a part of the comprehensive Label demo profile

• The picture show the final user interface

• This exercise will focus on the vision task only

• Please read and investigate the complete demo at a later stage

Page 7: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 7

Label block diagram

Industrial VISION-PC SCORPIONVision Software

Set Mode capture Pass / Fail

TDVCmdProtocolRS-232

DataExport

csvfile

External VDUand Keyboard

Cam

era

PLCDisk

Page 8: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 8

Creating MyLabel_Light profile

• Restore profile Label_Light_Start.zip

• Create a new profile and give it a namei.e. MyLabel_Light

• Copy thye Label_Light_Start profile to the new one

Page 9: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 9

Creating the Reference System

• Activate Service.Toolbox.New to create MMReference of ScaleReference type

• Set x and y scale to 24.8

• Active Results tab– Set unit for pixel resolution to

mm by using the popup menu

Note that an image must be captured for Results.pixel resolution to be defined

Page 10: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 10

Defining the reference systemWith Scorpion reference systems are

defined with a family reference tools.

In the label case MMReference of type ScaleReference is used to transform pixels to mm.

With x and y scale of 24.8 the pixel resolution is 0.04 mm

Check MMReference.Results

The scalefactor was defined by using a ruler.

Page 11: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 11

Remmber to Backup of profile

• Activate Service.Maintenance

• Press Backup – Add comment

– Press OK

Hint : Profile Backup ensures simple restore of a working profile

Page 12: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 12

Locate syringeThe following steps are performed to locate the syringe:

• Calculates blob threshold with Lightmeter

• Finds course location of syringe with blob - FindSyringe

• Establishes SyringeReference using three edge finders:

– Left Edge

– Upper Left Edge and Upper Right Edge

Page 13: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 13

Locate Syringe - LightMeterActivate Service.ToolboxCreate LightMeter – IntensityTool.Set MMReference as reference.Using LightMeter an adaptive threshold

for the blob Find Syringe is calculated.

The LightMeter ROI is defined in a narrow band across the syringe.

The LightMeter’s 70 % percentil is a good candidate for the Find Syringe threshold.

Using this threshold makes Find Syringe robust to light variations.

The LightMeter’s ROI is in a narrow band across the syringe.

Page 14: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 14

Find Syringe Create Find Syringe – BlobTool.

Set MMReference as reference.

Find Syringe requires that the light area of the syringe is greater than 10 mm2.

The ROI is around the syringe. The size defines how large variation in syringe position the system can tolerate.

Hint : All values are in mm. This is defined by the reference MMReference

Page 15: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 15

Verify – Find Syringe• Verify

– Press Start• Check that Blob locates syringe on all images

– Press Stop to terminate

• Activate Find Syringe.Visualization – Turn off all elements except MaxContour and

Center Of Gravity

• Turn off Show graphics on LightMeter.Visualization

Hint : A tool can be examined in detail using Visualization – this only

Page 16: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 16

State – Syringe Present Create the Lag logic state Syringe

Present - LogicTool

Open Syringe Present and activate the Setup tab.

Add a new condition pressing NewSet Find Syringe.Total blob area

greater than 40 mm2.

Set Syringe Present to false if condition is undefined. In this case this means that Find Syringe has failed.

Page 17: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 17

Locate Syringe Using edge finders the upper left

edges of the syringe is located.

The following edge finder – LineEdgeFinderTool is used:

• Find Left Edge

• Find Upper Left Edge

• Find Upper Right Edge

Tracecomb Find Upper Left Edge

Page 18: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 18

Setup Find Left Edge

• Create a tool – LineEdgeFinderTool named Find Left Edge

• Set Find Syringe as reference– Press Apply

– Turn on visualizations – trace lines

– Activate Show Info – Image Menu

• Position mouse at left edge to find center of ROI

Hint – All values are in mm

Page 19: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 19

Advances setup LineEdgeFinderTool• Differentiation = 1

– This means that seek peaks where the derivative is at it’s maximum. This is robust and handles light variations.

• Smooth base and counter = 4 and 2– Means that the trace combs is filtered to

remove noise

• Fit-tolerance = 0,08– This means that all points used in the

curve fitting is in a band of 0.08 mm – approx 2 pixels

• Good-fraction = 12 points– This means that more than 12 of the

trace combs has edges for the fitted line to be accepted

Page 20: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 20

Verify Find Left EdgeActivate Find Left Edge.Results

Hint : Press Start and run live inspections – the results are updated continuously

• Check the Gradient against Setup.Threshold

– Gradient should be minimum 1.5 – 2 time the threshold

• Line-fit 0.0247 means that the points on the calculated line has a noise approximately half a pixel

– The edgeline has a greater accuracy than half a pixel

– The LineEdgeFinderTool has sub-pixel resolution

Page 21: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 21

Find Upper Right Edge• Activate Service.Toolbox• Select Find Left Edge• Open mouse menu

– Press Copy

• Open mouse menu– Press Paste

• Select Copy of Find Left Edge• Name Find Upper Right Edge

• Select Find Upper Right Edge– Press Edit

• Move Find Upper Right Edge ROI to the right side of the syringe – see image– Remember to rotate trace comb

Page 22: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 22

Finn Upper Left Edge

• Activate Service.Toolbox

• Select Find Upper Right Edge

• Open mouse menu– Press Copy

• Open mouse menu– Press Paste

• Select Copy of Find Upper Right Edge

• Name Find Upper Left Edge

• Select Find Upper Left Edge– Press Edit

– Move ROI to left side of syringe

Page 23: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 23

Locate – Reference Line• Create Reference Line -

LineFromPoints

• Reference Line is defined by the Find Upper Left and Find Upper Right Edge center points.

Page 24: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 24

Locate – Syringe ReferenceCreate Syringe Reference –

PointLineReferenceSet the reference to MMReferenceReference Line and Find Left Edge

defines a reference system that handles syringe rotation and translation. The rest of the image analysis benefits from this.

It is important that Reference Line is defined as the first tool in PointLineReference because the first points handles rotation.

Page 25: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 25

Syringe Width Create Syringe Width- LineEdgeCaliper

– Purpose measure width of syringe in mm

LineEdgeCaliper has two trace combs – see image. Select Syringe Reference as reference. Using Syringe Reference means that the tool is

relatively positioned and all parameters and results are in mm inherited from MMReference.

Set Trace line start and end point to 2 and 6 – remember to set the angle and threshold

Remember to set fit-tolerance in mm. A good starting point is 0.04 mm – equal to the pixel size.

Set number of trace lines to 21Set unit and precision of the width and line fit

results to mm and two and four decimals. Nominal width is 8.90 mm

Page 26: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 26

Measure label positionUsing two edge finders the left edge and the

left slope edge is found. The intersection of these lines defines where the syringe bends. The same applies to the right side of the syringe.

The two bends points is used to construct a Label Reference Line.

Using a blob Find Marker and an edge finder the upper edge of the upper marker is located precisely.

The label position is defined as the distance between the Label Reference Line and the Upper Marker Edge.

The distance is classified and is presented in mm i the state panel.

Page 27: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 27

Find Left SlopeCreate Find Left Slope –

LineEdgeFinderTool • Make a copy of Find Left Edge

• Paste Find Left Slope

Select Find Left Slope

Set Syringe Reference as reference

Activate image menu Show Info

Set ROI center and correct angle

Hint : By activating Visualization.Tracelines one can see where the trace comb hits the edge

Page 28: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 28

Find Lower Left EdgeCreate Find Lower Left Edge –

LineEdgeFinderTool • Copy Find Left Slope• Paste Find Lower Left Edge

Select Find Lower Left EdgeActivate image menu Show InfoSet new roi center and correct angleHint – Gradient is lower on this edge

and threshold must be lower on this tool. The edge detection can be improved by smoothing or increasing the number of trace lines.

Page 29: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 29

Right side edgefindersThe easiest way to configure Find Right

Slope and Find Lower Right Edge is to copy the corresponding left edge finders

After copying – Change ROI

• Center and angle– Turn on trace line visualization to

see where the trace comb is located– Verify edge polarity and threshold

Hint – When moving a copied tool it is very convenient to activate Visualization.this only

Page 30: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 30

Verify edgefinders

• Press Start – Verify that the edge finders located all edge for all test images

– On failure• Verify threshold and position

• The number of trace lines increases the image processing time but also the probability to locate an edge

Hint : By stopping the continuous inspection it is possible to select images from the history list and reprocess interactively until the edges are located. By pressing Inspection image processing is performed on user request.

Page 31: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 31

Construct intersectionsCreate Left intersection –

PointFromLines.

Select Find Left Slope.Line and Find Lower Left Edge.Line

Copy Left Intersection

Paste Right Intersection

Select Find Right Slope.Line and

Find Lower Right Edge.Line

Page 32: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 32

Marker Reference LineCreate Marker Reference Line

using LineFromPoints

Select Right Intersection and Left Intersection as points

The constructed line defines a zero position for the marker label.

The Marker Reference Line has to be constructed. It is not possible to measure due to missing contrast and varying reflection from the syringe.

Page 33: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 33

Locate label markerThe next step is to locate the

label marker.

This is done by using a Marker LightMeter and the blob Find Marker.

The blob threshold is set dynamically using a python script.

Page 34: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 34

Marker LightMeter Create Marker LightMeter of type

IntensityTool.

Set the reference to Syringe Reference.

Press Apply.

Active Marker LightMeter.Visualization.this only

Activate Image.Show Info to set the center of the lightmeter roi.

Verify that the lightmeter roi is placed on the syringe and handles both syringe rotation and translation.

Page 35: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 35

Find Marker ThresholdCreate Find Marker Threshold of type PythonScript

The Find Marker blob’s dynamic threshold is calculated using the following script:

min = GetTagValue('Marker LightMeter.Min');

#LightMeter.Min is a result of Marker LightMeter

SetTagValue('Find Marker Threshold.Value',min+25)

#Sets the threshold to itself

Hint : Activate Parameters

The parameter dialog is available to find the name of the results in the Scorpion tag database.

Page 36: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 36

Find MarkerCreate Find Marker of BlobTool

Set reference to Syringe Reference

Set the roi equal to Marker LightMeter

Set Area Search - thresholdsMinimum = 0

Maximum = Find Marker Threshold.Value

Set minimum area to 0.2 mm2

Verify that the marker is found for all images by pressing Start.

Page 37: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 37

Find Marker Upper EdgeCreate Find Marker Upper Edge –

LineEdgeFinderToolCopy Find Lower Right Edge

Paste Find Marker Upper Edge

Set reference to Find Marker

Set roi x and y to zero.

Activate Visualization.Show Graphics

Use Image.Show Info to select position and correct angle

Adjust and verify threshold for all test images

Verify that the upper edge is found by pressing Start.

Hint : Increase smooth base and count if the edge of the label is detected.

Page 38: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 38

Marker DistanceCreate Marker Distance –

NearestPointOnLine

Set reference to MMReferanse

Select Find Marker Upper Edge.Center to point and select Marker Reference Line.Line to line.

The marker distance is equal to the Marker Distance.Distance result.

The dimension is in mm given by the MMReference reference tool.

Set the unit and the precision for the Marker Distance.Distance result.

Page 39: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 39

Display distance in State Panel

• Activate State Panel Menu– Select General.No of measured values

– Set No of measured values to 1

– Set General.caption = State

• Activate menu by clicking the value– Select Measured Value.Title = Distance

– Select Measured Value.Parameter = Marker Distance.Distance

– Select Measured Value .Decimals = 2

– Select Measured Value.Unit = mm

• Set font Condition to size=20 and bold

Page 40: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 40

Operation.Results• Active Operation.Results

• Press New and select a set of parameters

• To the right a selection of parameters are shown

Page 41: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 41

Operation.Curves• All results can be graphed and

watched• To the right the Marker Distance is

displayed• Activate the Curve Menu and

select parameter– The curve configuration is changed

by double clicking the curve.

Hint : The curve can only be edited in service mode.

Hint 2 : Watch the inspection cycle time is a good way to check the system condition

Page 42: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 42

Curve Setup – Marker DistanceHint : By capturing N images of a

syringe one can establish an estimate for the noise level of measurement by recording the standard deviation

Page 43: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 43

Exercise summary

• Scorpion solved this task by using it’s robust and good edge tools.

• The edges where detected with a sub-pixel resolution of 5 micrometer.

• The lines detected are intermediate results but ensures that the label position is measured with at 3 sigma tolerance better than 0.06 mm – this is very good.

• This means that the customer’s expectations are met without any programming.

Page 44: Label Light Exercise. Introduction to Scorpion - Demo 1- Label on Syringe Page 2 Profiles related to the exercise When starting use profile: Label_Light_Start.

Introduction to Scorpion - Demo 1- Label on Syringe Page 44