Skip to content

Commit

Permalink
fix image shape bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MulongXie committed Jul 13, 2021
1 parent 5f257e3 commit 2a263a2
Show file tree
Hide file tree
Showing 6 changed files with 474 additions and 399 deletions.
11 changes: 8 additions & 3 deletions GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def resize_by_longest_side(self, img_resize_longest_side=800):
height, width = self.img.shape[:2]
if height > width:
width_re = int(img_resize_longest_side * (width / height))
return width_re, img_resize_longest_side, self.img.shape[2]
return img_resize_longest_side, width_re, self.img.shape[2]
else:
height_re = int(img_resize_longest_side * (height / width))
return img_resize_longest_side, height_re, self.img.shape[2]
return height_re, img_resize_longest_side, self.img.shape[2]

def element_detection(self, is_ocr=True, is_non_text=True, is_merge=True, img_resize_longest_side=800, show=False):
if self.img_file is None:
Expand All @@ -63,7 +63,7 @@ def element_detection(self, is_ocr=True, is_non_text=True, is_merge=True, img_re
# resize GUI image by the longest side while detecting non-text elements
if img_resize_longest_side is not None:
self.img_reshape = self.resize_by_longest_side(img_resize_longest_side)
resize_height = self.img_reshape[1]
resize_height = self.img_reshape[0]
else:
self.img_reshape = self.img.shape
resize_height = None
Expand Down Expand Up @@ -133,6 +133,11 @@ def visualize_element_detection(self):
cv2.waitKey()
cv2.destroyAllWindows()

def visualize_layout_recognition(self):
self.visualize_compos_df('group')
self.visualize_compos_df('group_pair')
self.visualize_all_compos()

def visualize_compos_df(self, visualize_attr):
board = cv2.resize(self.img, (self.img_reshape[1], self.img_reshape[0]))
self.compos_df.visualize_fill(board, gather_attr=visualize_attr)
Expand Down
Binary file modified __pycache__/GUI.cpython-35.pyc
Binary file not shown.
Loading

0 comments on commit 2a263a2

Please sign in to comment.