Region: Add convenience methods

Sometimes it's convenient to think in terms of width and height, other
times in terms of extents.  The addition of `right`, `bottom` and
`from_extents` to `Region` allow either model to be used as convenient.

These and the `_bounding_box` helper function will be useful for more
advanced uses of OCR which requires manipulating regions.
OCR: Support tesseract writing to files with any extension

The second argument to the tesseract command line tool is "output base"
which is a filename to which an extension will be appended.  Unfortunately
this extension varies depending on the arguments passed to tesseract and
even varies between different versions of tesseract[^1].

Using a temporary directory means that we don't need to know the extension
in advance and we can read the output independent of the extension that
tesseract appends.

[^1]: In hOCR mode tesseract 3.02 will write to base.html whereas 3.03 will
      write to base.hocr.
Refactor: _tesseract: Require that a frame to be passed in

This removes a dependency on `Display` from `_tesseract` making it a pure
function depending entirely on it's arguments and producing no
side-effects[^1].  This makes uses of it clearer.

[^1]: Or close enough.
Refactor: _tesseract: Allow passing a `Gst.Sample` as frame

This was originally written to allow getting the timestamp of frames being
passed to `_tesseract` allowing returning richer information.  This has not
yet been done but being able to pass a `GstSample` is still a nice thing to
be able to do.  It makes _tesseract more like the other image analysis
functions and has the pleasant side-effect of reducing copying.
OCR: Add ability to pass configuration to tesseract

tesseract has many configuration values controlling many aspects of the
OCR algorithm.  For instance `tessedit_char_whitelist` can be used to
only recognise certain charactors such as numbers and
`language_model_penalty_non_dict_word` controls the strength of the
dictionary.  Depending on the situation the user can use these to tailor
tesseract's algorithms to improve OCR accuracy.  This commit directly
exposes this configuration functionality/complexity to the user such that
they can set any configuration value.

Ideally we wouldn't expse this level of complexity to the user, but after
experimentation it seems that OCR is an inherently complex field, so this
commit directly exposes the controls that tesseract provide.  This is
better than us adding an additional layer of abstraction/obfuscation in
an attempt to make it simpler for the user.  Once we learn more about the
circumstances under which each configuration value is useful we can
publish recommendations in the documentation.
OCR: Add ability to pass user_patterns and user_words to tesseract

tesseract uses a dictionary to help choose the correct words from the
list of possibilities it produces.  This is helpful when reading real
words but can get in the way of reading serial numbers.

This commit allows the user to help tesseract by giving it hints about
the words it's reading.  This takes the form of adding words to
tesseract's dictionary and adding patterns for tesseract to recognise.

Unfortunately the pattern language is specific to tesseract, and while
it bears some resemblance to regexs the impedance mismatch between the
tesseract pattern language and regex is high enough that a mapping would
be impractical.  As a result the pattern language is exposed verbatim.
Documentation can be found in the tesseract source code[1].

[1]: https://code.google.com/p/tesseract-ocr/source/browse/trunk/dict/trie.h?spec=svn894&r=894#188
validate-ocr: Improve error reporting if no image is found
validate-ocr: Don't consider all `.txt` files as tests

Previously if you had a `README.txt` in your corpus directory validation
would fail as it was expecting a PNG image called `README`.
Fix running `make doc` on Travis

`make doc` on Travis prints:

    UnicodeEncodeError: 'ascii' codec can't encode characters in position
    416-423: ordinal not in range(128)

This commit tells pydoc that we're expecting UTF-8 on stdout so Unicode
strings should be encoded as UTF-8.  This fixes that issue but I'm
uncertain what else this will have fixed.  It seems like the right thing
to do anyway though.
documentation: Add OCR tips
Merge pull request #155 from wmanley/ocr-patterns

Expose tesseract configurability to allow users to specialize OCR for their use-cases
make dist: Make release tarball generation more deterministic

Debian packages include a `.orig.tar.gz` which is supposed to contain the
pristine upstream tarball.  We don't tend to use tarballs, generating our
tarballs and debian source packages directly from git.  Unfortunately
the Ubuntu PPA builders (and debian builders in general) will complain
if you try to upload the same package with the same version twice if the
orig tarballs are not byte for byte identical.

One way in which tarball generation is non-deterministic is storage of
timestamps in tarballs.  This commit improves the determinism of the
dist tarball by overriding the mtime of the files stored in the tarball,
setting it to the commit time, much like `git archive` does.

In my tests on my (Debian testing) machine, running `make dist` twice in
succession now produces byte-for-byte identical tarballs.  This is good
enough for the purposes of publishing PPAs.  I wouldn't be confident that
the tarballs would be byte-for-byte identical with different versions
of tar and gzip, on different architectures or even with different
environment variables set though.

I would have preferred to specify "pax" (posix 2001) rather than "gnu"
format tarballs but pax seems to store additional header information
which makes it nondeterministic.  Either way there is no real change here
as my tar defaults to gnu anyway, this just makes it explicit.
make dist: Make release tarball generation even more deterministic

With this commit the generated tarball doesn't depend on the user that
ran `make dist`.  It makes the tarballs identical whether run on my Debian
or my Ubuntu 12.04 docker container.

This is an extension to the work started in ce079fe.

Tested with:

    make -B dist && md5sum stb-tester-$(<VERSION).tar.gz
make check: Disable pylint 1.2's "Wrong hanging indentation"

Pylint 1.2's C0330 (Wrong handing indentation) gives false positives:
https://bitbucket.org/logilab/pylint/issue/232
Merge pull request #161 from wmanley/pylint-1.2-compat

make check: Disable pylint 1.2's "Wrong hanging indentation"
Revert ".travis.yml: Install `stbt` for the `runner` self-tests"

This reverts commit 99ed926946648b8f31676b279843ce14ff053811.

This isn't necessary since 4ffa6b6c.
Debian package: Build dependencies for selftests

python-yaml is used by tests/validate-ocr.py -- even though `make check`
doesn't run that script, it does run pylint over it.

The tesseract German language pack is needed for
test_ocr.test_user_dictionary_with_non_english_language and
test_ocr.test_that_ocr_reads_unicode.
stbt-control: Remove unnecessary runtime dependency on nose

The functionality in stbt-control doesn't require nose, but it's tests
did.  Unfortunately as we were using `nose.tools.raises` to decorate
a top level function so we had to import `nose.tools.raises` at the top
level intoducing an unnecessary dependency even when not running the
tests.

This is a little less declarative but is still quite readable and seems to
be better than the alternatives such as moving the test into a different
file or conditionally defining the test function.
Debian package: Install tesseract English language data

Because `stbt.ocr`'s `lang` parameter defaults to English.

On Fedora the English language data is already included in the base
tesseract package.
Merge pull request #164 from drothlis/packaging-dependencies

A couple of missing build- and run-time dependencies I noticed when
building stb-tester from scratch on a new Ubuntu 14.04 system.