Skip to content

Commit

Permalink
visualize text content
Browse files Browse the repository at this point in the history
  • Loading branch information
MulongXie committed Jul 6, 2021
1 parent fe161e3 commit a0c2f9e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions detect_merge/Element.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def element_relation(self, element_b, bias=0):
def visualize_element(self, img, color=(0, 255, 0), line=1, show=False):
loc = self.put_bbox()
cv2.rectangle(img, loc[:2], loc[2:], color, line)
for child in self.children:
child.visualize_element(img, color=(255, 0, 255), line=line)
if show:
cv2.imshow('element', img)
cv2.waitKey(0)
Expand Down
Binary file modified detect_merge/__pycache__/Element.cpython-35.pyc
Binary file not shown.
Binary file modified detect_merge/__pycache__/merge.cpython-35.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion detect_merge/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def show_elements(org_img, eles, show=False, win_name='element', wait_key=0, shown_resize=None, line=2):
color_map = {'Text':(0, 0, 255), 'Compo':(0, 255, 0), 'Block':(255, 0, 0)}
color_map = {'Text':(0, 0, 255), 'Compo':(0, 255, 0), 'Text Content':(255, 0, 255)}
img = org_img.copy()
for ele in eles:
color = color_map[ele.category]
Expand Down

0 comments on commit a0c2f9e

Please sign in to comment.