Track background translation between screen frames using native OpenCV multi-patch matching. Construction does not capture a frame; at most 16 trackers may be open per flow. This does not detect a player or locate an atlas. Exclude the HUD and character; handle game zoom externally with template matching and scale. Suspected zoom or rotation produces LOST, not a zoom estimate.
Syntax
MotionTracker(region=None, exclude=None, max_displacement=80, max_gap_ms=850, max_frame_age_ms=250)Constructor parameters
| Name | Description |
|---|---|
regionRegion | None | Tracking rectangle in screen pixels, entirely inside the current screen, with finite positive width and height. None selects the full screen. Its coordinates are frozen when constructed. A very small or narrow region raises an error; choose a larger region. Optional · Positional or named Default: None |
excludelist | tuple | None | Up to 32 Regions to exclude, clipped to the tracking rectangle. Each has finite positive width and height; coordinates are frozen when constructed. None excludes nothing. Optional · Positional or named Default: None |
max_displacementNumber (1..256) | Maximum finite displacement per axis in screen pixels; default 80. Optional · Positional or named Default: 80 |
max_gap_msNumber (1..5000) | Maximum whole-number gap between frames in milliseconds; default 850. Optional · Positional or named Default: 850 |
max_frame_age_msNumber (1..5000) | Maximum whole-number frame age in milliseconds; default 250. Optional · Positional or named Default: 250 |
Returns
Example
# Track background motion between captured frames
tracker = MotionTracker()
first = tracker.update()
wait(100)
result = tracker.update()
if result.status == "TRACKED":
print(result.dx, result.dy)
tracker.close()