Read the result of a recognition search. Check found before clicking or using its location; a failed image search can still contain the best candidate's location.
Syntax
MatchThis class cannot be constructed directly.
Returns
—Example
m = Region(100, 200, 300, 400).find("btn", 3000)
if m.found:
click(m)
conf = m.confidence
# Recognition.result is only available in Python for the Recognition success branch.
if Recognition.result.found:
click(Recognition.result, random=0)Fields
| Name | Description |
|---|---|
nameString? | |
foundBoolean | Whether a match was found. |
confidenceNumber | Confidence score from 0.0 to 1.0. |
confNumber | Alias of confidence; returns the same score from 0.0 to 1.0. |
pointPoint? | list[Point] | |
boundsRegion? | Rectangle around the result, or None when unavailable. A failed image search may still provide the best candidate's rectangle; check found first. |
regionRegion? | Alias of bounds; returns the same matched Region or None. |
inference_infodict? | Extra result details, or None. Model results can include class_id, class_name, timing fields ending in _ms (milliseconds), and input_width/input_height (pixels). Color results can include target_color, sampled_color, max_channel_delta, match_count, and matches. Keys vary by search; check that a key exists before reading it. |
Field example
# Read optional details and color points safely.
m = Region(100, 200, 300, 400).find("btn", 3000)
target_name = m.name
is_found = m.found
score = m.confidence
short_score = m.conf
center = m.point
box = m.bounds
same_box = m.region
info = m.inference_info
if info is not None:
info_class_id = info.get("class_id")
info_class_name = info.get("class_name")
color_hit = Region(0, 0, 1080, 1920).find_color("#FFFFFF", tolerance=4)
color_name = color_hit.name
if color_hit.found and color_hit.point:
first_color_point = color_hit.point[0]
# In the Recognition success branch:
current = Recognition.result
if current.found:
text(current.name)
current.highlight(color="yellow", auto_hide_ms=800)