Up | ImageResampler - 70 | Blob4 - 87 | TemplateFinder3 - 63 | Blob3 - 60 | MultiBlob - 47 | TemplateFinder2 - 44 | TextureMatcher - 53 | PolyLineGapFinder - 49 | ColorSegmentor - 57 | PolygonMatch - 62 | ColorAnalyzer - 80 | PolyLineEdgeFaults2 - 85 | PolarUnwrap - 113 | SurfaceAnalyzer - 91 | ImageMixer - 147 | AreaFilter - 158

Release Notes


PolyLineEdgeFaults2 - 85

PolyLineEdgeFaults2 is a PolyLineEdgeFaults with shape classification, Polygon Model Wizard and several other advanced features included.

The advanced polygon match fitting ensures that each character is fitted with subpixel precision. With high quality image - translation, rotation, size and skew is optimised before edge fault detection. Below the character M to the left is fitted with translation and rotation - to the right it is fitted with translation , rotation, size and skew. False edgefaults are found on the character only rotated and translated into position. In the example the edge is sampled with a steplength of one pixel.

PolyLineEdgeFaults2 can in addition classify the faults found. This is done by adding classes and references (Advanced/Feature classification).


Reference - Reference system selection


  • Use trace line count - select count or step length
    • Count - number of trace lines
    • Step length - distance between trace lines
      • Ref.coord
      • Pixels
  • Start, end point - position of starting and end point on trace line given in reference coordinates
    • Inverted the sign of start and stop point will change the direction of the trace comb
  • Trace step (pixels) - normally 1 - given in pixels
  • Line width (pixels) - 0 - trace line is not averaged - a higher value will average 2N+1 pixels perpendicular to the trace comb

Edge detection

  • Smooth base - sample count. 3 is normally a good value
  • Smooth counter - 1 default - number of smoothing iterations
    • The smoothing increases with higher values
  • Differentiation
    • 0 - give threshold
    • 1 - 1. order differentiation - the derivative - default normally used
    • 2 - 2. order differentiation
  • Percent threshold - calculate threshold for each scan line
  • Threshold - the threshold or sensitivity of the edge detector - a lower value increases the sensitivity
  • Min threshold - for percent threshold only: lower limit
  • Polarity - All transitions | Light to dark | Dark to light
  • Mode - Peak | Threshold
  • Edge choice - First | Largest | Last






















Line definition file - The paths to be searched can initially be read from a text file, see the StrVec format. The name of that file is also stored, for possible future reload. The path information, however, is stored directly in the system, without need for the external file.
You can browse for or manually edit the filename; by clicking "Load", the file is read and its contents stored internally. 

  • Always read file at startup (overwrite SPB) - With this selection, the file is always loaded at startup.

Polygon properties

  • Closed polygon - Check this box if the polygons are closed

Search area

  • Vector - list of numbered polygons
  • Contents - the points of the selected polygon
  • New - add polygon
  • Delete - remove selected polygon
  • Up - Move polygon up in list
  • Down - moves polygon down in list
  • Paste new - creates a new polygon, pastes the polygon from the clipboard and presses apply  - this is the quickest way to create many polygons
  • Highlight selection - highlights the selected polygon in the image
  • Copy - copies the selected polygon to the clipboard
  • Paste - pastes the clipboard to the selected polygon - will overwrite an existing polygon

Note: Copy is used to transfer a polygon to the image for editing and modification. The edited polygon is pasted back to the tool using Paste

Vector mouse menu - activate by right mouse clicking in the Vector list

  • New - create a new vector

  • Delete - delete the selected vector

  • Custom... - set individual polygon properties, overriding the settings on the Setup page

  • Set defaults - restore default polygon settings

  • Paste new - paste clipboard as new polygon

  • Up - move polygon up in list

  • Down - move polygon down in list

  • Grid... - activate dialog for defining polygon grid

  • Delete all - remove all polygons from list

  • Delete empty vectors - remove all empty polygons

Autofit - Polygon Model Wizard

Using the Polygon Model Wizard Scorpion helps you create optimal edge polygons for PolyLineEdgeFaults.

  • AutoSelect polygons
    • When active Ctrl LMouse will make a edge contour around a object

The traceline settings are defined under the Setup tab except:

  • Step length
  • Start and End of tracelines

Visualize will display the traceline - see image to the right

Note: If Edge trace is difficult - verify wizard settings - long tracelines may cause problems around edge or in corners.

Advanced.Advanced 1

Missing edgepoint interpolation - Interpolate missing edgepoints

  • Max number of points in sequence - the number of points to interpolate

Fault/gap measurements as - Fault tolerance either given in Pixels or Reference coordinates.

  • Pixels

  • Reference coordinates

Faults (polygon mismatch) -

  • Report faults - turn fault detection on or off

  • Trend filter - optional highpass filter

    • Active - if checked, a bidirectional notch filter is applied to the fault distance measures. In effect, this filter fits the model polygon to the general trend or shape of the found edge

    • Factor - notch factor

    • Remove DC at ends before filtering - shift the distance measurements prior to filtering. Might introduce unwanted artifacts

  • Depth - distance from edge to model polygon

    • Negative - measure faults on negative side of model only

    • Positive - measure faults on positive side of model only

    • Both - measure faults on both sides

    • Collapse adjacent negative/positive faults - combine juxtaposed faults with opposite polarity

    • Min/Max - values defining a fault

  • Depth deviation within window - additional depth measurement to define a fault: absolute depth difference within a sliding window

    • Min - min deviation for fault

    • Window length (odd) - size of sliding window (this value is automatically made odd before use)

  • Smoothed absolute depth - additional depth measurement to define a fault: absolute value of smoothed values

    • Min - min deviation for fault

    • Smooth base (odd) - smooth window length (this value is automatically made odd before use)

  • Width - fault width

    • Min/Max

  • Area - fault area

    • Min/Max

Advanced.Advanced 2

Gaps (missing or distant edgepoints) - Gaps are defined as number of missing points in sequence.

  • Report gaps

  • Gap definition

    • Min/Max number of points in sequence

    • Treat as missing if distance is longer than given - default off

Polygon match - check adjust polygons positions, and the polygon is fitted before edge detection

  • Parameters to adjust

    • Translation, rotation - default

    • Translation, scale

    • Translation, rotation, scale, skew

    • Translation, rotation, perspective

    • Translation, rotation, scale

      • Note: good image quality and an increased Repeat Count is needed to get a good fit

      • Note: the shape of the polygon must contain information to be able to calculate all  degrees of freedom

  • Repeat count - the number of iteration to fitting the polygons

    • 2 is default but higher values normally increase the accuracy

  • Keep best points (%) - specifies the number of edge points used for iteration - a lower value makes it more robust - default is 80%

  • Stop if fewer than (%) - terminates iteration when less than edge points in % is located - default is 50% but deactivated

String result

  • Create string result with edgepoint coordinates

    • Simplify - speeds up processing

  • Create string result with fitted point coordinates

    • Simplify - speeds up processing

  • Create string results with polygon match percentages

  • Create string with fault polygons

    Note: deactivate these to reduce processing time

Trace line samples dialog - a helper window to set trace line filter parameters and thresholds

  • Middle - show the middle traceline
  • Middle+edges - show the first, middle and last traceline
  • Selection - show the selected tracelines
  • Line indices - traceline selection
    • example: 2,3,12-15
    • example: 1 3 5 7
  • Polygon number - select among the defined polygons
  • Show trace line popup - activate a modeless traceline window

Example tracelines - Middle+edges is selected

Connected faults

An additional result from faults processing: a Python tuple with a series of fault values (x position,y position,width)

  • Connect and report faults separasted by max
    • Max traceline gaps - faults are connected if they are this close or closer




















Advanced.Feature classification

Classification constraints active - check to filter objects by the Classification limits (below)

Only objects in active classes - if checked, objects classified as belonging to a deactivated class are removed. If unchecked, objects in deactivated classes are retained, and not filtered by the classification limits.

Feature classes/references - define feature classes and add references

- Define a new feature class

- Delete feature class and all references

- Add a reference. The Add reference dialog box opens:

The defined classes are listed in the Class dropdown. Select a class to add references to. By clicking one of the numbered fields under Select, the numbered object is highlighted in the main image.

  • Click OK to add a single reference and close the add references box
  • Click Add to add a reference and keep the dialog open
  • Click Cancel or Close to close the dialog

Show all - overrides classification constraints set, displaying all objects.
Show classified - show only recognised (classified) objects
Show unclassified - show only unrecognised (unclassified) objects.

- Remove a selected reference

Class list popup menu

  • Add class - same as
  • Rename class - set new class name
  • Delete class - same as
  • Delete all classes - empty all lists
  • Copy all classes - copy all classes with references to the clipboard. Useful for moving definitions between tool instances
  • Paste (replace all classes) - replaces all class definitions with contents on the clipboard

Note that these operations cannot be undone.

Reference list popup menu

  • Add reference - same as
  • Rename reference - set new reference name
  • Edit reference - bring up a dialog for manual editing of the reference's details
  • Delete reference - same as
  • Delete all references - empty the reference list for the selected class

Note that these operations cannot be undone.

Classification limits - Used to filter objects when Classification constraints active is checked.

Max distance - max accepted distance limit to reference

Min separation (dB) - min accepted separation between best and second-best match

Weights - a number of object properties can be selected to be used in the classification. Each property has an associated function and a weight.

Check each property that is to be included

Automatic weight calculation - 

  • Checked: always keep the weights updated when references are added or deleted. Select the calculation function from the drop-down box [1/(max-min), 1/Std, 1/(3*Std) or 1).
  • Unchecked: weights can be set individually (below). Click the button to calculate all weights with the function selected in the drop-down box - useful as a starting point.

To set a relative weight manually you must uncheck Automatic weight calculation; weights can then be entered in the edit fields.

Functions and static values -

Pressing the button for a feature brings up this dialog:

Function - a normalising function can be applied to the property value prior to weighing. Reasonable defaults are set for new tools.

  • None
  • Square root - x^(1/2)
  • Cube root - x^(1/3)
  • Square - x^2
  • Cube - x^3

Static -  A static value can be used in the classification, overriding the individual references' feature values. Check the Static checkbox and enter the static value. The button is changed to as a reminder.

Include in description -

Classification results can be displayed next to the class name in the image. Useful for deciding the classification limit values

  • Index - object number
  • Name - class name, if any
  • Distance - classification distance
  • Separation - classification separation (dB)

Advanced.Feature Statistics

This list displays statistics for the properties across all references.



Gap centers


Polygon axes - may help in positioning polygons with the mouse


Description Visualise feature classification
Description (invalid) Visualise feature classification when not accepted


Final detected edges


Detected edges prior to polygon fit


Edge points outside fault limits


Polygons defining faults


Edge points within fault limits

GapPoints Points defining gaps


Missing edgepoints


Final path (lines) along the polygon.


The path (lines) along the polygon prior to polygon fit


Final search lines


The search lines prior to polygon fit


Number of faults

Number of faults found along the polygon

Number of gaps Number of gaps found
Number of errors Faults + gaps

Interpolated points

Missing but interpolated points

Missing points Missing edge points
Longest gap In pixels or reference coordinates (Advanced 1)
Dominant class Feature classification: dominant class name
Dominant count Feature classification: largest value
Second dominant class Feature classification: next dominant class name
Second dominant count Feature classification: second largest value
Dominant separation Feature classification: separation between these values
Connected faults Python tuples: connected faults (x,y,length)
EdgePoints Python tuples: all found edgepoints
Fitted points Python tuples: all fitted points
MatchPercent Python tuple: polygon match fit percent for each polygon, if Adjust polygon positions checked
Fault polygons Python tuples: fault polygons

Line index [n]

Polygon index for fault n

Depth [n]

Depth of fault n

Width [n]

Width of fault n

Area [n]

Area of fault n

Smoothed depth[n] Smoothed depth (absolute value), fault n

Direction [n]

Direction of fault n, +1 or -1

Circularity[n] Circularity of fault n
Intensity[n] Pixel intensity within fault n
Std[n] Pixel intensity variation within fault n

Center [n].x

Position of fault n

Center [n].y

Position of fault n

Classification[n] Class name for fault n
Distance[n] Distance to best match or fault n
Separation[n] Separation best to second-best match for fault n

ExecuteCmd Support
- see also executeCmd



Return values


Set Object=ROI;Value=<polygon> ok,None Sets the first ROI polygon. See Copy/paste ROIs for details.
Set Object=ROI;Number=<number>;
ok,None Sets the numbered ROI polygon. See Copy/paste ROIs for details.
Add Object=ROI;Value=<polygon> ok,None Adds ROI polygon to the end of the list. See Copy/paste ROIs for details.
Get Object=ROI;Number=<number> ok,<polygon> Gets numbered polygon, as Scorpion polygon (StrArr format).
Get Object=Tuple;Number=<number> ok,<tuple> Gets numbered polygon, as Python tuple
Clear Object=ROI;Number=<number> ok,None Clears numbered polygon (makes empty)
DeleteAll - ok,None Deletes all polygons

More examples - Example 33 - Changing the ROI of a tool

Keyboard shortcuts
- More information




Ctrl-Z Set ROI Sets the selected polygon to points marked in the image. If only a single point is marked, the polygon is moved, centered around the point.
If the tool dialog is not open, the first polygon is set.
Ctrl-1 - Ctrl-0 Set polygon 0-10 Sets the numbered polygon to points marked in the image. If only a single point is marked, the polygon is moved, centered around the point. If a new polygon is defined this way, any missing polygons in between are set as empty.
Ctrl-Shift-1 - Ctrl-Shift-0 Clear polygon 0-10 Clears the numbered polygon (sets empty).

Example 1: Dynamically changing PLEF2 polygon 0

# used to dynamically define path to locate defects

ROI = '<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>'

ROI = ROI + '<SPB name="PolygonList">'
ROI = ROI + '  <SPB name="0">'
ROI = ROI + '    <NTP_BOOL name="Active" value="true"/>'
ROI = ROI + '    <NTP_TXT name="Custom" value=""/>'
ROI = ROI + '    <NTP_TXT name="Polygon" value="{('

ROI = ROI +         GetStringValue('156 ul_left.Center[1]_x')

ROI = ROI + ';'   + GetStringValue('156 ul_left.Center[1]_y')
ROI = ROI + ')(' + GetStringValue('156 ul_c1.Point_x')
ROI = ROI + ';'   + GetStringValue('156 ul_c1.Point_y')
ROI = ROI + ')(' + GetStringValue('156 ul_c2.Point_x')
ROI = ROI + ';'   + GetStringValue('156 ul_c2.Point_y')
ROI = ROI + ')(' + GetStringValue('156 ul_upper.Center[1]_x')
ROI = ROI + ';'   + GetStringValue('156 ul_upper.Center[1]_y')

ROI = ROI + ')}"/>'

ROI = ROI + '  </SPB>'
ROI = ROI + '  <NTP_INT name="Count" value="1"/>'
ROI = ROI + '</SPB>'
print ROI


Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.