Refactor: Region: Change internal representation of `Region`

`Region` is now represented internally as (x, y, right, bottom) rather than
(x, y, width, height).  This gives us a way to represent regions which are
infinite, such as the region x < 5, y > 10.  This seems to be a more
natural representation anyway as most of out methods and uses use right and
bottom.

This is not intended as an externally visible change, although some details
may leak through the cracks.  These include:

* The string returned by `__repr__` lists right and bottom rather than
  width and height.  This is necessary as `repr` should be unambiguous.
* If you use subscripting to get at the internal representation of the
  `Region` (e.g. `region[2:]`) this will now return `right` and `bottom`.
API: Region: Add Region.ALL

`Region.ALL` represents the entire 2D frame from -∞ to +∞ in both the x
and y directions.  This is useful to pass to functions that take a
`region=` parameter to say that we want the whole frame considered.  This
is really quite nice as it behaves as you might expect with functions
such as `contains()`, `intersect()` and `extend()` without any special
casing.

In the 0.20 release the only public function which took a `region=`
parameter was `ocr()`.  In this case the parameter defaulted to `None`
meaning the whole frame.  It now defaults to `Region.ALL` with the same
meaning as before.  Passing `region=None` to `ocr()` is deprecated so in
the future we can change its meaning to mean the empty region consistent
with the return value of `Region.intersect()` and the region parameter
of `TextMatchResult` as returned from `match_text()`.
API: Region: Make intersect commutative and associative

`intersect` returns None if the two given regions don't intersect.  By
making `intersect` a `@staticmethod` `None` can be passed as either
argument rather than having to be the second.  This allows constructions
such as:

    Region.intersect(Region.intersect(a, b), c)

or

    reduce(Region.intersect, [a, b, c], Region.ALL)

to behave consistently if any of `a`, `b` or `c` are either `None` or
don't overlap with any of `a`, `b` or `c`.

`Region.intersect` has not yet been in a public release so this is not
considered an API break.
API: Region: Add Region.translate

This is a convenience function implemented to help with the implementation
of passing `region=` to `stbt.match()`
Merge pull request #208 from wmanley/region-all

Region API consistency and helper functions
gst_hacks: Fix crash on Debian since upgrade to GStreamer 1.4

This fixes a double-free encountered on my Debian system since I upgraded
to GStreamer 1.4, although the potential for the issue has existed longer
than that.

Previously our description of `GstMemoryInfo` as a `ctypes.Structure` only
included the public members mentioned in the documentation, but the
structure in C is actually 32 bytes larger due to private fields and
padding.

We would allocate these structures in Python (via `ctypes`) and then pass
pointers to them to the GStreamer functions `gst_buffer_map` and
`gst_buffer_unmap`.  These functions now make use of these extra bytes but
because we weren't allocating a large enough buffer we were getting a
buffer-overflow causing a double-free to be reported and a crash.

This commit fixes this issue by copying the structure information from the
header file rather than the documentation, which is the true definition of
the structure.
pylint.sh: Silence uninteresting output with GStreamer 1.4

Since upgrading my Debian system to GStreamer 1.4 pylint tells me:

    /usr/lib/python2.7/inspect.py:65: Warning: /tmp/buildd/glib2.0-2.40.0/./gobject/gsignal.c:1631: parameter 1 of type '<invalid>' for signal "GstBus::sync_message" is not a value type
    /usr/lib/python2.7/inspect.py:65: Warning: /tmp/buildd/glib2.0-2.40.0/./gobject/gsignal.c:1631: parameter 1 of type '<invalid>' for signal "GstBus::message" is not a value type

Over and over again.  There doesn't seem to be any real problem so I
silence this warning in `pylint.sh` much like the other warnings.
GStreamer 1.4 support: Work around GStreamer overlay bug

Since upgrading my Debian system to GStreamer 1.4 the test
`test_ocr_on_live_video` has been failing with the error:

    FAIL: test.py: UITestError: Internal data flow error.: Internal data flow error.
    gstbasesrc.c(2933): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
    streaming task paused, reason not-negotiated (-4)

The source pipeline in this test contains a `textoverlay` element.  This
has changed in GStreamer 1.4 to use the new `GstVideoOverlayComposition`
mechanism optionally allowing sinks to do any required compositing as this
may be more efficient.  This adds additional meta information to the
output caps if `textoverlay` thinks the downstream elements can handle
composition.

In this case downstream can't handle composition, but there is a
`decodebin` in the middle which obscures this from upstream so the meta
caps get added anyway.  When `decodebin` comes to create its output pad
it fails to link with the rest of the downstream elements because the caps
have the meta info and don't match.

This commit works around this bug by making `videotestsrc` output RGB
video that `textoverlay` can composite onto directly.  I have not yet
reported this bug upstream.

For more information see GStreamer bugzilla [#732040]

[#732040]: https://bugzilla.gnome.org/show_bug.cgi?id=732040
Merge pull request #210 from wmanley/gst-1.4

Fixes to work with GStreamer 1.4
Refactoring: Factor out loading templates

In preparation for adding `stbt.match`.

Internally we now pass around an `_AnnotatedTemplate` object rather than
an `numpy.ndarray` so we can attach the template name and any other
information we wish to. This tidies up an number of bits of code and
should make them more robust to changes in the future.
stbt.py: Refactor drawing MatchResults on frames

We can re-use this when adding the `stbt.match()` API.
WIP: Add `stbt.match`

Added new API `stbt.match` which was previously conspicuous in it's
absense.  It simply searches for a template match in a video frame,
returning a `MatchResult`, and notably not throwing an exception if the
template cannot be found.

This, in combination with the ability to treat `MatchResult` as a boolean
makes it much easier to compose matching operations in user code.  e.g.:

    assert stbt.match('template.png') or stbt.match('template2.png')

TODO:
* Add tests involving passing a frame with the frame= parameter
WIP: API: Add region parameter to match

TODO:
* Documentation
* Tests