|
|
|
@ -71,6 +71,7 @@ def parse_args():
|
|
|
|
|
parser.add_argument("--use_space_char", type=str2bool, default=True)
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"--vis_font_path", type=str, default="./doc/simfang.ttf")
|
|
|
|
|
parser.add_argument("--drop_score", type=float, default=0.5)
|
|
|
|
|
|
|
|
|
|
# params for text classifier
|
|
|
|
|
parser.add_argument("--use_angle_cls", type=str2bool, default=False)
|
|
|
|
@ -229,10 +230,10 @@ def draw_ocr_box_txt(image,
|
|
|
|
|
box[2][1], box[3][0], box[3][1]
|
|
|
|
|
],
|
|
|
|
|
outline=color)
|
|
|
|
|
box_height = math.sqrt((box[0][0] - box[3][0])**2 + (box[0][1] - box[3][
|
|
|
|
|
1])**2)
|
|
|
|
|
box_width = math.sqrt((box[0][0] - box[1][0])**2 + (box[0][1] - box[1][
|
|
|
|
|
1])**2)
|
|
|
|
|
box_height = math.sqrt((box[0][0] - box[3][0]) ** 2 + (box[0][1] - box[3][
|
|
|
|
|
1]) ** 2)
|
|
|
|
|
box_width = math.sqrt((box[0][0] - box[1][0]) ** 2 + (box[0][1] - box[1][
|
|
|
|
|
1]) ** 2)
|
|
|
|
|
if box_height > 2 * box_width:
|
|
|
|
|
font_size = max(int(box_width * 0.9), 10)
|
|
|
|
|
font = ImageFont.truetype(font_path, font_size, encoding="utf-8")
|
|
|
|
|