Purpose

CompareScreenshotsStable compares two images: the template image (from File 1) with the reference image (File 2 which is considered the “correct”, “expected”, or “reference” image). Both are shown at the outputs outScreenshot1Image and outScreenshot2Image, respectively, as well as their color coded difference at outDifferenceImage. A visual presentation is available as outHorizontalView in the user interface of the module as well as a same-named output connector. A strength gives a hint about how much the images differ, it is calculated according to the comparison metric SimilarityMeasure. A zero strength in similarity indicates incomparable images (as explained below) as well as a strong difference, a higher and positive value a small or no difference.

For example similarity SSD, NCC, and NMI indicate a maximum similarity (= equal images) with the value 1, other measures use different values, see MetaSimilarityMeasure for details.

The comparison is performed especially to be used for tests. The following properties are considered/compared:

A zero similarity and a Status Code != Ok is calculated in the following cases:

  • any undefined or invalid input image or empty input path
  • different image extents in any image dimension
  • different color models (for example HSV versus RGB)
  • image with extents > 1 in z-, t-, or u-dimension

A successful comparison is indicated with Ok in Status Code and may lead to zero or non-zero values in similarity dependent on the strength of the image difference.

Note

On python programming level there is also a helper function under Packages/FMEstable/ReleaseMeVis/Modules/Scripts/python/fmeTestSupport/ScreenShotComparsion.py which makes use of this module to simplify screenshot comparisons in python tests.

Windows

Default Panel

../../../Projects/CompareScreenshotsStable/Modules/mhelp/Images/Screenshots/CompareScreenshotsStable._default.png

Output Fields

outScreenshot1Image

name: outScreenshot1Image, type: Image

The template image which shall be compared against the reference image from File 2.

outScreenshot2Image

name: outScreenshot2Image, type: Image

The reference (defining the “truth” or “expected”) image.

outDifferenceImage

name: outDifferenceImage, type: Image

The color coded difference of the first (current) and second (reference) screenshot. Low or black values indicate small differences, large (bright/white) values indicate high differences. See the color bar in right hand side of outHorizontalView for the color coded intensities describing the strength of the difference.

outHorizontalView

name: outHorizontalView, type: SoNode

The view containing, from left to right, the current, reference and difference image with corresponding label below. Right from the difference image, a vertical bar with a color spectrum is shown as legend, starting on top with black (from no or small difference) to the white bottom (large difference).

Parameter Fields

Field Index

[]: Trigger SimilarityMeasure: Enum
Clear: Trigger Status Code: Enum
doNotClearOnFailedUpdate: Bool Status Message: String
File 1: String Update: Trigger
File 2: String  
Has Valid Output: Bool  
On Input Change Behavior: Enum  
Similarity: Double  

Visible Fields

Update

name: update, type: Trigger

Initiates update of all output field values.

Clear

name: clear, type: Trigger

Clears all output field values to a clean initial state.

On Input Change Behavior

name: onInputChangeBehavior, type: Enum, default: Clear, deprecated name: shouldAutoUpdate,shouldUpdateAutomatically

Declares how the module should react if a value of an input field changes.

Values:

Title Name Deprecated Name
Update Update TRUE
Clear Clear FALSE

[]

name: updateDone, type: Trigger, persistent: no

Notifies that an update was performed (Check status interface fields to identify success or failure).

Has Valid Output

name: hasValidOutput, type: Bool, persistent: no

Indicates validity of output field values (success of computation).

Status Code

name: statusCode, type: Enum, persistent: no

Reflects module’s status (successful or failed computations), Ok indicates a successful operation, for example cleared outputs or values or comparison. Note: to detect a valid similarity value only check for an enabled Has Valid Output.

Status Message

name: statusMessage, type: String, persistent: no

Gives additional, detailed information about status code as human-readable message.

SimilarityMeasure

name: inSimilarityMeasure, type: Enum, default: NCC

The metric/measure algorithm to compare the screenshots, see MetaSimilarityMeasure for a detailed description of the difference measures. A typically useful metric NCC.

File 1

name: inScreenshotFilename1, type: String, default: /Repository/FMEstable/ReleaseMeVis/Projects/CompareScreenshotsStable/Modules/networks/LaGomeraPlant_NoDifference.png

The template image to compare with in ScreenshotFileName2.

File 2

name: inScreenshotFilename2, type: String, default: /Repository/FMEstable/ReleaseMeVis/Projects/CompareScreenshotsStable/Modules/networks/LaGomeraPlant_3x3Median.png

The reference image to compare with as file name.

Similarity

name: outSimilarityValue, type: Double, persistent: no

The computed difference measure between current and reference image.

Hidden Fields

doNotClearOnFailedUpdate

name: doNotClearOnFailedUpdate, type: Bool, persistent: no

Prevents automated clear after update failed. This does not affect status fields. It enables the developer to analyze module’s state after failure.