예제 #1
0
def load_normalizer(fname):
    fname = ocrolib.findfile(fname)
    model = ocrolib.load_component(fname)
    if "lineParameters" in dir(model):
        return LineestNormalizer(model,params=default_params)
    if "normalize" in dir(model):
        return model
    raise Exception("model seems to be neither a normalizer nor a line estimator")
예제 #2
0
파일: lineest.py 프로젝트: doubaokun/ocropy
def load_normalizer(fname):
    if fname=="center":
        fname = "=ocrolib.lineest.CenterNormalizer()"
    if fname[0] not in "=@":
        fname = ocrolib.findfile(fname)
    model = ocrolib.load_component(fname)
    if "lineParameters" in dir(model):
        return LineestNormalizer(model,params=default_params)
    if "normalize" in dir(model):
        return model
    raise BadInput("model seems to be neither a normalizer nor a line estimator")
예제 #3
0
def load_normalizer(fname):
    if fname == "center":
        fname = "=ocrolib.lineest.CenterNormalizer()"
    if fname[0] not in "=@":
        fname = ocrolib.findfile(fname)
    model = ocrolib.load_component(fname)
    if "lineParameters" in dir(model):
        return LineestNormalizer(model, params=default_params)
    if "normalize" in dir(model):
        return model
    raise Exception(
        "model seems to be neither a normalizer nor a line estimator")
예제 #4
0
 def __init__(self, *args):
     unittest.TestCase.__init__(self, *args)
     self.model = ocrolib.load_component(self.model_file)
     self.linerec = self.LineRecognizer(cmodel=self.model)