Up | CircleFinder2D - 165 | EasyOCR - 78 | PolygonMatch2 - 84 | GCPS -110 | HeightMap3D - 111 | ImageExtrema - 129 | PCA3D - 140 | CameraPose3D - 148 | MonoPose3D - 149 | ImagePicker3D - 145 | ExternalCoordinates3D - 157 | MaMa3D - 152 | CircleSegmentor - 153 | PolygonMatch3 - 160

Release Notes
 

  

 
CircleSegmentor - 153

CircleSegmentor is a multistage tool to identify and separate circular objects in the image. The following steps are invoked to locate circular objects:

  • Edges (high gradient areas) in the image are located using a Sobel filter, possibly combined with the Canny algorithm

  • A RANSAC search is performed, identifying possible circles with a given diameter or diameter range

  • A PolygonMatch search follows, locating the circles with subpixel accuracy

  • [Optional]  A secondary PolygonMatch is run, where the user can add other identifying polygons using a Polygon Wizard

Setup

Reference - Reference system selection

ROI

  • Use whole picture - do not use the ROI polygons
  • Vector/Contents - the ROI consists of the interior of all polygons defined

Gradients

Gradient definition

  • Pick gradient positions with Canny - If checked, the Canny algorithm from OpenCV is used to find edges.

    • Canny threshold1/2 - the larger value is used to find initial edges, the smaller is used in linking them.

    • Canny aperture size - Sobel aperture for Canny

  • Sobel smooth count - if Canny is not used, an internal Sobel algorithm is used to find edges. This offers additional smoothing of the image.

  • Prune gradients closer than - if Canny is not used, the number of large gradients may become large. Gradients can be pruned within a neighbourhood if they differ in size but not angle:

    • Less than (%) - remove neighbour gradients smaller than this

    • Within angle (deg) - and with approximately the same direction

  • Gradient min - ignore gradients smaller than this value

  • Gradient max - ignore gradients larger than this value

  • Image decimation - decimate image in both X and Y before the analysis

  • Gradient decimation - decimate number of found gradients prior to RANSAC

Gradient visualization

  • Reduce length by (factor) - visualisation of gradients in the image

Search settings

  • Nominal diameter - Size of circles to search for

  • Range (+/-) - Size range

  • Min distance - Do not report circles closer than this

  • Max RANSAC - Max number of RANSAC tests

  • Max angle (deg) - An accepted gradient must point toward the circle center with max this angle error

  • Min quality count - Number of accepted gradients to identify a circle

Polygon match

There are two polygon match stages in CircleSegmentor. By default stage 1 (Circle match) is active, while stage 2 (Additional match) is disabled. Stage two is intended to differentiate circles based on other marks or identifiers.

Circle match

Run circle polygon match - if disabled, neither polygon match step is run. Useful to evaluate the gradient/RANSAC steps.

Tracelines

  • Use Traceline Count - selects to specify the traceline count
    • Count - number of trace lines
    • Step length - distance between traceline
      • Ref coord
      • Pixels
  • Start point - position of starting point on trace line given in reference coordinates
  • End point - position of 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 - 3 is normally a good value
  • Smooth counter - 1 default - given i pixels
    • The smoothing increasing with higher values
  • Differentiation
    • 0 - give threshold
    • 1 - 1. order differentiation - the derivative - default normally used
    • 2 - 2. order differentiation
  • Threshold - the threshold or sensitivity of the edge detector - a lower value increases the sensitivity
    • % activates adaptive - threshold is set to N % of maximum values of edges
    • Minimum treshold define minimum value of threshold to accept when adaptive treshold is active
  • Polarity - All transitions | Light to dark | Dark to light
  • Mode - Peak | Threshold
  • Edge choice - First | Largest | Last | Nearest | First then nearest | Largest then nearest
    • Largest is default and normally the best choice

Polygon match

  • Parameters to adjust

    • Translation, scale - default

    • Translation - translation only, most useful when diameter is known

  • Max repeat count - the number of iterations to fit the polygons

    • 2 is default but higher values will normally increase the accuracy

    • Lower values will save image processing time

  • Stop if result deteriorates - if the polygonmatch seems to fail, do not process further

    • Match count/RMS/RMS factor - determines which result to evaluate

    • Hysteresis (%) - allow a small drop in performance

    • RMS factor - weight for RMS if both RMS and match count is used to measure the match

  • Abort if fit % is less than - stops matching process if less than % edge points is located

  • Keep best points (%) - the percentage of edge points used in iteration

    • 95% is default

  • Perform final fit with distance constraints - default on - added to be able to investigate polygon matching in detail

    • Final fit max distance - can be given in pixels or reference coordinates

Diameters

  • Use diameter steps (otherwise use nominal diameter, Gradients page) - if checked, run a series of matches with increasing diameter. Useful to find circles with varying size.

  • Min diameter - start at this value

  • Max diameter - end at this value

  • Step - with these steps in between

Circle distance

  • Min distance - do not report circles closer than this (also called kill radius)

Constraints

  • Min fit percentage - percentage of edge points within range

  • Max RMS - mean edge point inaccuracy

  • Max movement - distance from original position

  • Max offset X (abs) - X distance from original position

  • Max offset Y (abs) - Y distance from original position

  • Min intensity - min intensity within the circle

  • Max intensity - max intensity within the circle

Additional match

The secondary polygon match stage is run centered at each accepted match from the Circle match stage. After a succesful stage 1, the tool lets you import an image around any of the original matches. Here you can use the polygon wizard to draw polygons matching interesting features within or outside the found circle.

Run additional polygon match  - disabled by default

Polygons

Polygon properties

  • Closed polygons - Select this box if the polygons are closed by default. Individual polygons can be customised separately.

Polygon Editor

  • Numbered list - ordered list of polygons. Each polygon can be made active/inactive by clicking the checkbox in front of the number. It can also have its own custom trace line settings, indicated by a red color (2 *)
  • Contents - the points of the selected polygon
  • Paste new - creates a new polygon and pastes the polygon from the clipboard - this is the quickest way to create many polygons
  • Highlight selection - highlights the selected polygon in the image
    • used to identify a 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

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

  • New - creates a new vector
  • Delete - deletes the selected vector
  • Custom... - open dialog to define settings for a single polygon
  • Set defaults - remove custom settings for a polygon and revert to defaults
  • Paste new - paste clipboard as new polygon
  • Up - moves polygon up in list
  • Down - moved polygon down in list
  • Delete all - removes all polygons from list
  • Delete empty vectors - remove all empty polygons

Pick image from match

An image can be imported when the Circle match step is successful.

  • No - which match to import
  • Size X/Y - image size in reference coordinates
  • Pick - An image is imported, overwriting any earlier picture and polygons
    • The pixel size is as close to the original image as possible
    • For your convenience, a first polygon is inserted which is the circle itself. This can be deactivated and/or deleted
  • Clear - Remove the imported image and any polygons

Autofit - Polygon Model Wizard

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

  • Autofit
    • When active Ctrl LMouse will make an edge contour along a path or an object

The traceline settings are defined under the Tracelines tab except:

  • Step length
  • Start and End of trace lines

Visualize will display the trace line - see image to the right

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

Polygon properties dialog - vector list Custom choice:

Each polygon can have its own settings, overriding the default values. The custom settings include open/closed, tracelines and edge detection.

Hint: Use individual polygon traceline setting to improve the model

        

Tracelines

  • Use Traceline Count - selects to specify the traceline count
    • Count - number of trace lines
    • Step length - distance between traceline
      • Ref coord
      • Pixels
  • Start point - position of starting point on trace line given in reference coordinates
  • End point - position of 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 - 3 is normally a good value
  • Smooth counter - 1 default - given i pixels
    • The smoothing increasing with higher values
  • Differentiation
    • 0 - give threshold
    • 1 - 1. order differentiation - the derivative - default normally used
    • 2 - 2. order differentiation
  • Threshold - the threshold or sensitivity of the edge detector - a lower value increases the sensitivity
    • % activates adaptive - threshold is set to N % of maximum values of edges
    • Minimum treshold define minimum value of threshold to accept when adaptive treshold is active
  • Polarity - All transitions | Light to dark | Dark to light
  • Mode - Peak | Threshold
  • Edge choice - First | Largest | Last | Nearest | First then nearest | Largest then nearest
    • Largest is default and normally the best choice

Initial values

  • Copy values from circle match - a convenient way to pick default traceline settings

Polygon match

  • Parameters to adjust

    • Translation, rotation, scale - default

    • Translation, rotation - translation and rotation only, most useful when diameter is known

  • Max repeat count - the number of iterations to fit the polygons

    • 2 is default but higher values will normally increase the accuracy

    • Lower values will save image processing time

  • Stop if result deteriorates - if the polygonmatch seems to fail, do not process further

    • Match count/RMS/RMS factor - determines which result to evaluate

    • Hysteresis (%) - allow a small drop in performance

    • RMS factor - weight for RMS if both RMS and match count is used to measure the match

  • Abort if fit % is less than - stops matching process if less than % edge points is located

  • Keep best points (%) - the percentage of edge points used in iteration

    • 95% is default

  • Perform final fit with distance constraints - default on - added to be able to investigate polygon matching in detail

    • Final fit max distance - can be given in pixels or reference coordinates

Rotation

  • Rotate template to find match - find the polygons in any position

  • From/To/Step angle - default is to search the full circle [0..360> in steps of 30 degrees

Result updates

  • Update match center, offset and movement - this will cause the position of the found circle to be reported from polygon additional match. Default is to use the position from Circle match.

Constraints

  • Min fit percentage - percentage of edge points within range

  • Max RMS - mean edge point inaccuracy

  • Max movement - distance from original position

  • Max offset X (abs) - X distance from original position

  • Max offset Y (abs) - Y distance from original position

Advanced

Constraints

  • Max object count - limit reported circles

String results

  • Report matched circles as strings - report the found circles as Python tuples.
    • If polygon match step 2 is run, the result is the first active polygon on the polygon list (normally the circle)

Sort result by

  • Rev - reverse
  • RMS/Match percent/Diameter/X position/Y position/Grid X then Y/Grid Y then X - sort criterion
  • Grid threshold X/Y - defines the grid size
  • Asc - ascending

Include in match description (visualisation)

Include in the onscreen description of match

  • Result order
  • Position
  • Diameter
  • RMS
  • Polygon match %

Visualisation

Added

New candidate points added by the RANSAC search

Center

Found circle centers

Description

On-screen description of each match

EdgePoints

Edge points, final iteration

EdgePointsOrig

Edge points, first iteration

FittedPoints

Fitted points final iteration

FittedPointsOrig

Fitted points first iteration

Gradient Gradients picked by Sobel/Canny
MatchedPolygon The best fitted polygons

MissingPoints

Tracelines without edgepoints, final iteration

MissingPointsOrig

Tracelines without edgepoints, first iteration

OriginalPolygon The original model

OutlierPoints

Points too far from polygon, final iteration

OutlierPointsOrig

Points too far from polygon, first iteration

RawCenter Centers found by RANSAC
Replaced Better candidate points  found by RANSAC
ROI Region of interest
ROI Holes Region of interest
SubROI Rectangles used for RANSAC search
TraceLines Tracelines, final iteration
TraceLinesOrig Tracelines, first iteration


Results
 

OriginalCount

Number of centers found by RANSAC

IntermediateCount

Number of centers found by Circle match

Count Final number of circles
Centers All found centers as a Python tuple

Gradients

Number of high gradients found by Sobel or Canny

Center[n]_x _y

Position of found circle n

Angle[n] Rotation of polygon n (if Additional match is active)

Diameter[n]

Diameter of circle n

RMS[n]

Polygon fit, circle n

Percent[n]

Polygon fit, circle n

Movement[n]

Polygon match movement from raw center

OffsetX[n]

Polygon match movement from raw center (X)

OffsetY[n]

Polygon match movement from raw center (Y)

Intensity[n] Mean intensity within circle n
Std[n] Intensity variation within circle n


ExecuteCmd support (see also executeCmd)

Command

Parameters

Return values

Comments

Set Object=ROI;Value=<polygon> ok,None Sets the first ROI polygon. See Copy/paste ROIs for details. (*)
Set Object=ROI;Number=<number>;
Value=<polygon>
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 ROI polygon, as Scorpion polygon (StrArr format)
Get Object=Tuple;Number=<number> ok,<tuple> Gets numbered ROI polygon, as Python tuple
Clear Object=ROI;Number=<number> ok,None Clears numbered polygon (makes empty)
DeleteAll - ok,None Deletes all polygons

(*) Note: Polygon properties are not supported by these methods, although existing properties will be kept when the SET command is used.

 


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