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



SurfaceAnalyzer - 91

The SurfaceAnalyzer can identify connected colored areas in an image. It is based on the ColorMatcher tool, and uses the same algorithm for color matching; defining colors and a set of reference images to each color is also done the same way. The image is divided into a regular set of rectangles, and a match is performed on each rectangle. The results are then grouped by a blob analysis.

To be completed

You can also add inactive colors to the tool, e.g. backgrounds. The inactive colors will be matched, but not reported or grouped.


Reference - Reference system selection

ROI - the tool's region of interest

  • Whole picture - the whole picture is analysed instead of the selected rectangle
  • Use rows/cols - active
    • specify the number of columns and rows in the grid inside the ROI - with Grid Rows and Grid Cols
  • Use rows/cols - deactivated
    • Grid-X, Grid-Y - the pixel size of the cells for color analysis
  • Center-X, Center-Y, dX, dY - ROI rectangle
  • Angle - the angle of the ROI rectangle
  • Use% - percentage of pixels within grid rectangles to use (centered within rectangle)
    • Decreasing this number will decrease the image processing time

The ROI can be managed by the buttons

  • Paste - paste the ROI from the image to the scorpion clipboard
  • Copy - copy the ROI to the image from the scorpion clipboard

Point & Click Clipboard Support

The rectangular ROI is defined by four points.

 One point will change the center point.



  • Selected Reference - displays the image of the selected reference
  • - Adds a color with a given name
  • - Removes a color with it's reference images
  • - Adds the current image as a reference to the selected reference
  • - Removes the selected reference

Colors Mouse Menu

  • Add color

  • Active - toggle the active flag (inactive colors are not reported as results, and are listed with yellow checkmark in front of the name)

  • Set code - a colors numeric value

  • Set display color - for visualisation

  • Rename color

  • Delete color

  • Delete all references

Reference Mouse Menu

  • Add reference

  • Rename reference

  • Delete reference

  • Delete all references

Adding references using Point & Click

By adding a rectangle to the clipboard selecting the a named color and pressing   will add a reference image to the tool.


Classification type -

Classification of each rectangle within the grid can be done using color, texture or a combination:

  • Color only - disable texture classification

  • Texture only - disable color classification

  • Color, then texture - color is used to create regions in the image; texture information is added using a voting

  • Texture, then color - texture is used to create regions in the image; color information is added using a voting

  • Combined - regions are created with both similar color and texture

Color features

Color distance

  • Activates the color planes to be part of the distance calculation

    • H - activates Hue

    • S - activates Saturation

    • I - activates Intensity

    • H std - activates Standard Deviation Hue

    • S std - activates Standard Deviation Saturation

    • I std - activates Standard Deviation Intensity

  • Weighting factors - coeffisients for the feature distance formula

    • H - Mean Hue - default 4 - increases the importance of the Hue value

    • S - Mean Saturation - default 1

    • I - Mean Intensity - default 1

    • H std - Standard Deviation Hue

    • S std - Standard Deviation Saturation

    • I std - Standard Deviation Intensity

  • Weighing of H by

    • S - Saturation - default on

    • I - Intensity - default  on

  • Feature Distance Formula

    • H weighted by square  root of normalized S and I as selected - recommended Feature Distance

    • H linearly weighted by normalized S and I as selected

    • Normal measure H, S and I equivalent - d = sqrt(H*H + S*S + I*I)

Note: adding the standard deviation coeffisient to the distance measure makes it possible to separate non-monochrome colors.

Color constraints

  • Maximum distance - the maximum distance to the current image for a reference image to be accepted

  • Minimum separation - the minimum separation between the best and the second best color for the color to be accepted

Note: The separation is often used to get only clear colors matched - A typical value can be 6.

Texture features

Image decimation

  • Active - activates image decimation

    • Horizontal - horizontal decimation factor

    • Vertical - vertical decimation factor

    Note - Image decimation speeds up the TextureMatcher - it is by default off

Normalizing - used to make the texture matcher less sensitive to intensity variations

  • Method

    • 1-Offset normalizing - default

    • 2-Offset- and mean-gain normalizing

    • 3-Offset- and std-gain normalizing

Texture distance - specifies how to calculate the distance - difference is the best method

  • Method

    • 1-Dissimilarity - default

    • 2-Symmetric dissimilarity

    • 3-Similarity without weights

    • 4-Similarity

  • Active coefficients

    • By default all coeffisient except LL and HH are included - to deviate from default one verify the performance on a large image set

Texture constraints - to specify an absolute criteria to accept a texture

  • Maximum distance - the maximum distance to the current image for a reference image to be accepted

  • Minimum separation - the minimum separation between the best and the second best texture for the texture to be accepted


To be completed

This is a list of statistics for the defined colors. Within each color group the least similar sample is found, and its mean distance to the other references in the same group is calculated (Max int dist). Further, this reference's mean distance to each of the other color groups is found, and the nearest result is reported (Closest col and Min ext dist).

The ratio between Min ext. dist and Max int. dist in dB is reported as mid. A negative value here means the reference is on average closer to another group than its own. 

Finally, the ratio between the least similar sample's closest match to any reference in other color groups and the closest match within its own group is reported, also in dB. Even if the mid value is low, this min value can be positive, which means the reference is still closer to its own group, though not on average.

These results can be used to spot outliers in a color group. If the mid separation in dB falls below the Mid color separation warning threshold, and the min separation below the Closest separation warning threshold, the checkmark in front of the color name turns red. You can spot the outlier reference under the Setup page as well, where both the color and the reference will be marked in red.

NOTE: this has NO effect on the tool's results, it is just an aid in setting up well defined color sets.


Blob analysis


A blob analysis is performed on the classified rectangles, creating connected areas. The blobs can be grown and shrunk using a Morphology string.

Hole filter

Blob holes can be ignored based on size.

Results sorted by

A number of "the best" blobs are reported in the Results pane; here you decide which blobs are considered "best".

Result string

  • Create code grid string result: create a python 2d tuple with classification codes (color+texture codes)

    • Raw - result from raw blob analysis (prior to morphology and constraints)

    • Final - result after morph/constraints. If blob collision, code is overwritten



The blobs resulting from the analysis can be filtered out by a set of criteria:

  • Contour area - the total area of the blob

  • Blob area - contour area minus area of any holes

  • Hole count - number of holes in the blob

  • Axis ratio - length/width of bounding box

  • Angle - angle of bounding box major axis

  • Length of bounding box

  • Width of bounding box

  • Blob circularity - closeness to circular shape (max 1). Smoothing blobs with a higher factor will help

The bounding box is the smallest possible rectangle containing the blob.


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.

Visualization - 

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

  • Include order - object number
  • Include color/texture names - names describing color/texture classification results
  • Include class name - object class name, if any
  • Include code - color+texture code
  • Include distance - object classification distance
  • Include separation - object classification separation (dB)

Displayed objects can also be limited -

  • Show all blobs - default
  • Show only dominant class - only objects being classified as the dominant class (class with most objects) are shown
  • Limit to max - display only the N "best" objects



Needs description


BlobDescription Text describing a classified blob
BlobDescription (invalid) Text describing a blob falling outside the classification limits
Blobs Raw blobs
BoundingBox She smallest rectangle containing the blob
CenterOfGravity Blob center
Grid Analysis rectangles
ROI Region of interest
SmoothBlobs Smoothed blobs

Note: The visualisation colors for the BlobDescription, BlobDescription (invalid), Blobs, BoundingBoxCenterOfGravity or SmoothBlobs are not used. Instead, individual colors can be defined under the Setup tab.


GridCount Total number of analysis rectangles
Rows Analysis grid height


Analysis grid width
BlobCount Total number of blobs found
CodeResult A Python dictionary detailing the results. For each grid rectangle the color/texture codes are added
DominantClass Name of class with most objects found
DominantCount Number of these objects
DominantClass2 Name of class with second most objects found
DominantCount2 Number of these objects
ColorName[1-16] Color name, first 16 sorted blobs
TextureName[1-16] Texture name, first 16 sorted blobs
ClassName[1-16] Blob class name, first 16 sorted blobs
Code[1-16] Color+texture code, first 16 sorted blobs
ContourArea[1-16] Contour area, first 16 sorted blobs
BlobArea[1-16] Blob area, first 16 sorted blobs
HoleCount[1-16] Hole count, first 16 sorted blobs
CenterOfGravity[1-16]_x Center x position, first 16 sorted blobs
CenterOfGravity[1-16]_y Center y position, first 16 sorted blobs
AxisRatio[1-16] Bounding box axis ratio, first 16 sorted blobs
Angle[1-16] Bounding box angle, first 16 sorted blobs
Length[1-16] Bounding box length, first 16 sorted blobs
Width[1-16] Bounding box width, first 16 sorted blobs
Circularity[1-16] (Smoothed) blob circularity, first 16 sorted blobs

ExecuteCmd support (see also executeCmd)



Return values


Set Object=ROI;Value=<polygon>
Sets the tool's ROI. See Copy/paste ROIs for details.
Get Object=ROI ok,<polygon> Current ROI as rectangular, closed polygon


ok,None Creates or replaces named color reference. The polygon defines the reference's position in the image. Name and Code are optional
Get Object=Colornames ok,<names> All color names as a Python tuple
Get Object=Referencenames;Color=<color> ok,<names> All reference names defined for the named color
Get Object=Texturenames ok,<names> All texture names as a Python tuple
Get Object=Referencenames;Texture=<texture> ok,<names> All reference names defined for the named texture
Delete Object=Color;Name=<name> ok,None Removes named color and all its references
Delete Object=Texture;Name=<name> ok,None Removes named texture and all its references
Delete Object=Reference;Color=<color>;
ok,None Deletes specified color reference
Delete Object=Reference;Texture=<texture>;
ok,None Deletes specified texture reference
DeleteAll - ok,None Deletes all colors, textures and references



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