def init(filename, type): # 矫正 -> 行提取 out_file, flag, attributeLine = surface(filename, type) # ocr和分词 jsonResult, origin = flow.cropToOcr(out_file, attributeLine, flag) return jsonResult, origin
def init(filename, typeP): print("ocr.init() begin") # 矫正 -> 行提取 # 处理路径前面的前缀 if "allstatic" in filename: filename = filename.replace("allstatic/", ""); out_file, flag, attributeLine, ticketNo = surface(filename, typeP) print("cropToOcr begin") #wt 2019.09.25 保存tickeNO imgName = time.strftime('%Y-%m-%d %H_%M_%S',time.localtime(time.time())) ticketNo = Image.fromarray(ticketNo) ticketNo.save("/home/ocr/organize/TrianTicketNo/"+imgName+".jpg") # ocr和分词 jsonResult, origin = flow.cropToOcr(out_file, attributeLine, flag, ticketNo) return jsonResult, origin
def ocrWithoutSurface(out_file, line_result, flag=1): # ocr和分词 jsonResult, origin = flow.cropToOcr(out_file, line_result, flag) return jsonResult, origin