Enhanced Search ("enhanced")
4.2.5 Enhanced Search (“enhanced”)
Similar to the “search2” algorithm it searches the desktop for a component represented by the input template image(s) or image collection(s) and the pass rate. Designed on the feature matching principles it delivers significant improvements such as:
Ability to deal with color changes
Tolerance to minor size changes or even rotation
No internet connection required (no AI dependency)
Disadvantages over the “search2” algorithm are:
Lower performance (typically 2-4 times slower)
Lower pass rate values may cause hallucinations (find the components where they are not)
Not supported on older Linux systems such as Ubuntu 18 and RHEL 8 (to be enabled)
To preserve compatibility with other search algorithms the resulting match locations are exposed to the calling script in the form of a set of _SEARCH prefixed variables. The results are always sorted by the similarity with the most matching location in the first place.
Method Created Variable | Description |
|---|---|
_SEARCH_MATCH_COUNT=<number> | Number of matching locations identified by the Object Search. |
_SEARCH_X<n>=<X-coordinate> | The X,Y coordinates of the n-th match location where "n" is between 1 and the _SEARCH_MATCH_COUNT value. |
_SEARCH_X=<X-coordinate> | The X,Y coordinates of the first match location (synonyms for_SEARCH_X_1 and _SEARCH_Y_1). |
OPTIONS
The method requires one or more template images and/or image collections specified through the hosting command or Java method call.
The "passrate" parameter specifies the required minimum similarity between the template image and the matching location on the screen. The default value is 80%. The lower the value the fuzzier the search is which may result in false matches (vaguely similar components) or even hallucinations.
The "cmparea" parameter is optional and defaults to the full screen when omitted.
RETURNS
The method makes the calling command (method call) return 0 (success) if at least one matching location is found or 1 otherwise.
EXAMPLES
Compareto ok.png method="enhanced" passrate="85"
if ({_EXIT_CODE} > 0) {
Screenshot failure.png desc="Failed to find the OK button."
Exit 1 desc="Failed to find the OK button."
} else {
Mouse click to=x:{_SEARCH_X},y:{_SEARCH_Y}
}
Find the OK button and click it. If the button is not found take an exit screenshot and terminate the script with the exit code of 1.