Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion detect_merge/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def most_pix_around(pad=6, offset=2):

def merge(img_path, compo_path, text_path, merge_root=None, is_paragraph=False, is_remove_bar=True, show=False, wait_key=0):
compo_json = json.load(open(compo_path, 'r'))
text_json = json.load(open(text_path, 'r'))
text_json = json.load(open(text_path, 'r',encoding='utf-8'))

# load text and non-text compo
ele_id = 0
Expand Down
4 changes: 2 additions & 2 deletions detect_text/text_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def save_detection_json(file_path, texts, img_shape):
f_out = open(file_path, 'w')
f_out = open(file_path, 'w',encoding='utf-8')
output = {'img_shape': img_shape, 'texts': []}
for text in texts:
c = {'id': text.id, 'content': text.content}
Expand All @@ -18,7 +18,7 @@ def save_detection_json(file_path, texts, img_shape):
c['width'] = text.width
c['height'] = text.height
output['texts'].append(c)
json.dump(output, f_out, indent=4)
json.dump(output, f_out, indent=4,ensure_ascii=False)


def visualize_texts(org_img, texts, shown_resize_height=None, show=False, write_path=None):
Expand Down