OCR: speed up the thresholdinge.

Linear thresholding (from MINTHRESH to MAXTHRESH with STEPTHRESH)
has been replaced with alternate one (starting from mean value
and going alternately up and down).

Additionally bitwise-NOT replaced with inverted thresholding.
The same effect, less computing.

Justification: running 14 tests took 84.850s after change,
comparing to 110.232s before.

Signed-off-by: Bartek Pawlik <pawlik.bart@gmail.com>