Stb-tester v28 released: Multi-threading support, better OCR, better video recordings

76 views
Skip to first unread message

David Röthlisberger

unread,
Feb 6, 2018, 7:16:55 AM2/6/18
to stb-t...@googlegroups.com
Stb-tester 28 includes support for multi-threading in your test scripts; better OCR performance for text on translucent overlays; higher-quality and higher-framerate video recordings of each test-run; and many API improvements.

Ubuntu 14.04 & 16.04 packages are available at the usual location.

Breaking changes since v27
  • The default parameters for the image-matching algorithm have changed from MatchParameters(confirm_method="absdiff", confirm_threshold=0.16) to MatchParameters(confirm_method="normed-absdiff" confirm_threshold=0.30). This has been our recommended setting for several years; now it's the default. The "normed-absdiff" algorithm works better in most cases, except when you're looking for an image with very little structure (for example a plain patch of a single colour). We recommend that you always include some structure (edges) in your reference images; if you really need to match a plain blob of colour, you can override the algorithm for specific invocations of stbt.match by passing a match_parameters argument.

    To keep using the previous defaults, add this to the [match] section of your stbt config file:

    confirm_method=absdiff
    confirm_threshold=0.16
    

    Note that users of the Stb-tester hardware have always been been using these new values, as we provide a custom stbt.conf file to our customers.

  • The default interpress_delay_secs for stbt.press is now 0.3 instead of 0. This matches best practices and what the documentation actually says. To keep using the previous default, add this to the [press] section of your stbt config file:

    interpress_delay_secs = 0
    

    Thanks to Rinaldo Merlo for the bug report.

    Note that users of the Stb-tester hardware have always been using the best-practices default value of 0.3, as we provide a custom stbt.conf file to our customers.

  • Passing region=None to stbt.ocr raises a TypeError. Use region=stbt.Region.ALL instead. Note that passing None has printed a deprecation warning since v0.21 (three years ago); raising an exception will force users to update their test scripts, allowing us to change the behaviour again in a future release to be consistent with stbt.match_text where None means an empty region.

  • Passing type_=bool to stbt.get_config now returns False for values of "0", "false", "off", and "no" (all of these are checked in a case-insensitive manner). Previously it would always return True for any non-empty value.

  • Removed workaround for 4 year old deadlock bug in decklinksrc. If this is still necessary, set source_teardown_eos = True in the [global] section of your stbt config file, and let us know on the mailing list as we may remove the workaround completely in a future release.

  • A call to stbt.get_frame() is no-longer guaranteed to return a new frame, it may return the same frame that the previous call to stbt.get_frame() returned. This may have subtle effects on the timing of existing test-scripts. Functions that depend on this behaviour should be refactored to use the stbt.frames() iterator method instead.

    If this change causes you problems you can add:

    [global]
    use_old_threading_behaviour = true
    

    to your stbt.conf to restore the old behaviour. This option may be removed in the future. Please let us know on stb-tester/stb-tester#449 if this will cause you problems.

    The benefit is that you can now call stbt.get_frame() from multiple threads and usage like wait_until(lambda: match('a.png') or match('b.png')) will run faster as the second match will no longer block waiting for a new frame.

  • stbt.get_frame() and stbt.frames() now return read-only frames for better performance. Use frame.copy() to get a writeable copy of the frame.

New features
  • Python API: stbt can now be used from multiple threads simultaneously. Each call to stbt.frames() returns an independent iterator that can be used concurrently. Example, wait for tv to start playing or an error screen:

    pool = multiprocessing.pool.ThreadPool()
    result = pool.imap_unordered(apply, [
          lambda: wait_for_motion(),
          lambda: wait_for_match("error-screen.png")
      ]).next()
    if isinstance(result, MotionResult):
        print "TV is playing ok"
    else:
        print "Error screen"
    
  • New Android control mechanism to send taps, swipes, and key events. See the stbt.android.AdbDevice docstrings for usage instructions. You can capture video from an Android mobile device using HDMI video-capture via an "MHL" USB-to-HDMI cable, or with the Stb-tester CAMERA pointed at the device's screen, or even by taking screenshots via AdbDevice.get_frame (but if you're using AdbDevice.get_frame the Android device wont be visible in the output video as this mechanism bypasses stb-tester's GStreamer pipeline). See https://stb-tester.com/blog/2017/02/21/testing-video-playback-on-mobile-devices for a discussion of the trade-offs of each video-capture mechanism.

  • New control mechanism using the VNC RFB protocol. This protocol is used by Cisco to control some of their set-top boxes. Thanks to Antonio Fin and Fabrice Triboix, both at Cisco.

  • Python API: New function stbt.crop to crop a region from a video-frame.

  • Python API: New function stbt.load_image to load an image from disk, using the same path lookup algorithm that stbt.match uses.

  • Python API: The mask parameter to stbt.detect_motion, stbt.wait_for_motion, and stbt.is_screen_black can be an OpenCV image (previously it could only be a filename). This makes it easier to construct masks programmatically.

  • Python API: stbt.detect_motion, stbt.wait_for_motion, and stbt.is_screen_black can take a new region parameter.

  • Python API: stbt.wait_until has two new parameters: predicate and stable_secs. Together they allow waiting for something to stabilise (for example to wait for the position of a moving selection to stop moving).

  • Python API: stbt.ocr and stbt.match_text have a new parameter text_color. Specifying this can improve OCR results when tesseract's default thresholding algorithm doesn't detect the text, for example for light-colored text or text on a translucent overlay.

  • Python API: The pre-processing performed by stbt.ocr and stbt.match_text can now be disabled by passing upscale=False. This is useful if you want to do your own pre-processing.

  • Python API: The default lang (language) parameter to stbt.ocr and stbt.match_text is now configurable. Set lang in the [ocr] section of your configuration file.

  • Python API: Added region parameter to stbt.press_until_match. Thanks to Rinaldo Merlo for the patch.

  • OpenCV 3 compatibility: stb-tester will now work with either OpenCV 2.4 or OpenCV 3. This support is in beta, please let us know if you see anything not working properly with OpenCV 3. OpenCV 2.4 is still our primary supported target version of OpenCV.

  • Output video now runs a the full frame-rate of the input video rather than slowing down during wait_for_match. As a side-effect the latency of the video has increased by 0.5s and if the image processing is particularly slow the annotations won't appear on the output video. Apart from that caveat, annotations now appear if you got the frame using stbt.get_frame() (previously the annotations only appeared if the frames came from a stbt.frames() iterator). "Annotations" means the yellow & red rectangles showing the current match, etc.

Minor fixes and packaging fixes
  • The irnetbox control now understands "double signals" in the irNetBox config file generated by the RedRat IR Signal Database Utility. Thanks to Rinaldo Merlo for the fix.

  • Fixed stbt power for ATEN power supplies with more than 8 ports. Thanks to Lucas Maneos at YouView for the patch.

  • stbt batch run: New option --no-save-video disables video recordings of each test-run. This can be used to reduce CPU consumption when video recordings aren't required or are being captured in some other way.

  • stbt lint: Catch & ignore pylint inference exceptions.

  • stbt auto-selftest: Fix when running for the first time (when the auto_selftest directory doesn't exist).

  • Python API: The is_visible property of stbt.FrameObject subclasses can call other public properties. Furthermore, the value of is_visible is always a bool, so you don't have to remember to cast it to bool in your implementation.

  • Python API: stbt.wait_until will try one last time after the timeout is reached. This allows you to use a short timeout_secs with operations that can take a long time.

  • Python API: The stbt.MotionResult object returned by stbt.detect_motion and stbt.wait_for_motion includes the video-frame that was analysed. This allows you to perform additional analysis -- for example if there was no motion is the frame black?

  • Configuration: global.sink_pipeline can now be set to an empty value (sink_pipeline=). This will have the same effect as sink_pipeline = fakesink but with lower resource utilisation.






David Röthlisberger
Stb-tester.com Ltd.

--
Stb-tester.com Ltd is a company registered in England and Wales.
Registered number: 08800454. Registered office: 33b Aliwal Road,
Battersea, London, SW11 1RB.

Reply all
Reply to author
Forward
0 new messages