tests/known-fail-source.png: Crop to 228px wide
tests/known-fail-source.png: Crop to 228px wide

"stbt.gst_to_opencv" doesn't take into account any padding at the end of
each row in the GStreamer buffer. If we assume that each row is aligned to
4 bytes, then the "stbt.py" patch shown below in this comment does work
correctly with the original version of "known-fail-source.png" (231px wide)
but *fails* if I crop the image to 230px wide:

    ValueError: strides is incompatible with shape of requested array
    and size of buffer

Instead of fixing this now, I've just resized the test image
"known-fail-source.png" to a multiple of 4, so that the test
"test_wait_for_match_confirm_methods_produce_different_results" passes.
This problem doesn't affect template images, only the source video
frames taken from GStreamer; so this shouldn't affect real-world stbt
usage, where our input width is always a multiple of 4 (1280, 1080,
etc).

The afore-mentioned patch to stbt.py:

    diff --git a/stbt.py b/stbt.py
    index 8e0ae3d..1a3772f 100644
    --- a/stbt.py
    +++ b/stbt.py
    @@ -14,6 +14,7 @@
     import errno
     import functools
     import inspect
    +import math
     import os
     import Queue
     import re
    @@ -876,10 +877,12 @@

     def gst_to_opencv(gst_buffer):
    +    height = gst_buffer.get_caps().get_structure(0)["height"]
    +    width = gst_buffer.get_caps().get_structure(0)["width"]
    +    channels = 3
         return numpy.ndarray(
    -        (gst_buffer.get_caps().get_structure(0)["height"],
    -         gst_buffer.get_caps().get_structure(0)["width"],
    -         3),
    +        (height, width, channels),
    +        strides=(4 * math.ceil(width / 4.0) * channels, channels, 1),
             buffer=gst_buffer.data,
             dtype=numpy.uint8)

martynjarvis/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,wmanley/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,stb-tester/stb-tester,martynjarvis/stb-tester,wmanley/stb-tester,wmanley/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,stb-tester/stb-tester,LewisHaley/stb-tester,stb-tester/stb-tester,wmanley/stb-tester,martynjarvis/stb-tester,martynjarvis/stb-tester,martynjarvis/stb-tester,wmanley/stb-tester,stb-tester/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester