Match

Read-only recognition match result returned by region.find* helpers. In a recognition Success branch, Recognition.result points to the active Match or MatchList.

Syntax

Match

This 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

NameDescription
nameString?
Matched target name. Template matches use the template name without extension, OCR uses the matched target text, and color matches use Color.
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]
Match point. Image/OCR/object recognition usually returns Point; image matches below threshold can still return the best candidate point when bounds are available. Color and multi-target recognition can return list[Point] so match.point[0].x/y works for the best point.
boundsRegion?
Bounding box of the matched area. Image matches below threshold can still expose the best candidate bounds.
regionRegion?
Alias of bounds; returns the same matched Region or None.
inference_infodict?
Model or color metadata when available. TFLite metadata includes backend, class_id, class_name, preprocess_ms, inference_ms, postprocess_ms, total_ms, input_width, input_height, optional debug image dimensions, and capture telemetry. Detailed debug_result rows are shown only in the inference debug dialog. Color metadata includes backend=color, target_color, sampled_color, point, max_channel_delta, confidence, interval, match_count, and matches.
Field example
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
info_class_id = info.class_id
info_class_name = info.class_name

color_hit = Region(0, 0, 1080, 1920).find_color("#FFFFFF", tolerance=4)
color_name = color_hit.name
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)

Methods

2 methods

Match.highlight

Draw a highlight frame for this match when found=true. Uses bounds first; when bounds is missing, draws one square for each point in point/list.

Syntax

match.highlight(color="green", line_width=2, region_width=36, auto_hide_ms=0)

Parameters

NameDescription
colorColor | String | Number
Highlight color.
Optional · Positional or named
Default: green
line_widthNumber
Outline width in pixels.
Optional · Positional or named
Default: 2
region_widthNumber
Fallback square width when the match only has point.
Optional · Positional or named
Default: 36
auto_hide_msNumber
Auto-hide timeout in milliseconds. 0 keeps highlight visible.
Optional · Positional or named
Default: 0

Returns

Match — Returns the same match after drawing highlight.

Example

m = Region(100, 200, 300, 400).find("start", 3000)
m.highlight(color="yellow", line_width=3, auto_hide_ms=1200)

Match.highlight_off

Turn off the active highlight generated from this match instance.

Syntax

match.highlight_off()

Returns

Match — Returns the same match after turning highlight off.

Example

m = Region(100, 200, 300, 400).find("start", 3000)
m.highlight()
m.highlight_off()