Commit 69e8592d authored by Tom Breuel's avatar Tom Breuel
Browse files

Small cleanups after removing files.

parent 57a666e4
......@@ -5,6 +5,7 @@
import os,hashlib
from ctypes import c_int,c_float,c_double,c_byte
from numpy.ctypeslib import ndpointer
import ctypes
import time
import errno
......@@ -13,9 +14,9 @@ import contextlib
def lockfile(fname,delay=0.5):
while 1:
fd =,os.O_RDWR|os.O_CREAT|os.O_EXCL)
except OSError as e:
except OSError as e:
if e.errno!=errno.EEXIST: raise
......@@ -4,6 +4,7 @@ import numpy
import os
import sys
import warnings
from types import NoneType
# FIXME from ... import wrap
### printing
......@@ -150,7 +151,7 @@ class CheckWarning(CheckError):
def checktype(value,type_):
"""Check value against the type spec. If everything
is OK, this just returns the value itself.
is OK, this just returns the value itself.
If the types don't check out, an exception is thrown."""
# True skips any check
if type_ is True:
......@@ -245,7 +246,7 @@ def ANY(*checks):
raise CheckError(x,": failed all checks:",[strc(x) for x in checks])
return CHK_
@makeargcheck("value should be type book or 0/1")
def BOOL(x):
......@@ -292,7 +293,7 @@ int_dtypes = [numpy.dtype('uint8'),numpy.dtype('int32'),numpy.dtype('int64'),num
@makeargcheck("array must contain integer values")
def AINT(a):
return a.dtype in int_dtypes
return a.dtype in int_dtypes
@makeargcheck("expected a byte (uint8) array")
def ABYTE(a):
......@@ -408,10 +409,10 @@ def SEGMENTATION(a):
return isinstance(a,numpy.ndarray) and a.ndim==2 and a.dtype in ['int32','int64']
@makeargcheck("expected a segmentation with white background")
def WHITESEG(a):
return numpy.amax(a)==0xffffff
return numpy.amax(a)==0xffffff
@makeargcheck("expected a segmentation with black background")
def BLACKSEG(a):
return numpy.amax(a)<0xffffff
return numpy.amax(a)<0xffffff
@makeargcheck("all non-zero pixels in a page segmentation must have a column value >0")
u = numpy.unique(a)
......@@ -2,13 +2,11 @@
import matplotlib
import sys,os,signal
from scipy.ndimage import interpolation
import pylab
from pylab import *
import glob
import ocrolib
from ocrolib import linerec,morph
from scipy.misc import imsave
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment