10 Nov 2022.

Tags: Test Development

Stb-tester v33 introduces a new, easier, way of defining masks for image-processing APIs such as is_screen_black, press_and_wait, and wait_for_motion.

Previously, these APIs could take a single rectangular Region to restrict the image-processing to that part of the screen. If you needed to process an area that isn’t a rectangle —for example processing the whole screen except for some parts— then you had to create a black-and-white mask in an image editor:

frame mask is_screen_black(frame, mask)
None False
True

Since v33, you can construct such a mask in Python code by adding or subtracting regions. For example, the mask shown above can be created with the following code:

channel_patch = stbt.Region(x=570, y=264, right=715, bottom=450)
info_bar = stbt.Region(x=0, y=520, right=1280, bottom=690)
mask = stbt.Region.ALL - channel_patch - info_bar

To learn more, see Regions and Masks in the Stb-tester manual.

v33 includes many other improvements, including an upgrade to Python 3.10, APIs for interacting with Android and Roku devices, and more. See the release notes for instructions on how to upgrade.