In [26]:
from pylab import *
import ocrolib
from scipy.ndimage import filters,interpolation
from scipy import stats
from ocrolib import lineest
reload(lineest)
Out[26]:
In [27]:
figsize(8,8)
image = 1-ocrolib.read_image_gray("010036.bin.png")
image = interpolation.affine_transform(image,array([[1,0.03],[0,1]]),offset=(-30,0),output_shape=(100,700),order=0)
imshow(image,cmap=cm.gray)
h,w = image.shape
In [28]:
reload(lineest)
mv = lineest.MvNormalizer()
mv.measure(image)
In [29]:
imshow(mv.normalize(image,order=0),cmap=cm.gray)
Out[29]:
In [30]:
reload(lineest)
le = lineest.load_normalizer("en-mixed.lineest")
le
Out[30]:
In [31]:
le.measure(image)
In [32]:
imshow(le.normalize(image),cmap=cm.gray,interpolation='nearest')
Out[32]:
In [33]:
imshow(le.normalize(image,order=0)[:,:40],cmap=cm.gray,interpolation='nearest')
Out[33]:
In [34]:
reload(lineest)
le = lineest.load_normalizer("../models/mvnorm-24.lnorm")
le.measure(image)
imshow(le.normalize(image),cmap=cm.gray)
le.target_height
Out[34]:
In [35]:
reload(lineest)
le = lineest.load_normalizer("../models/gradnorm-48.lnorm")
le.measure(image)
imshow(le.normalize(image),cmap=cm.gray)
le.target_height
Out[35]:
In [35]: