Devesh Pant commited on
Commit
2b5ccbe
·
1 Parent(s): 1b870f4

order corrected

Browse files
Files changed (1) hide show
  1. order_text_blocks.py +4 -4
order_text_blocks.py CHANGED
@@ -89,8 +89,8 @@ def textblock_ordering(textblocks, img):
89
  ori_coords[tuple([x1, y1, x2, y2])] = [x1, y1, x2, y2]
90
  coords.append([x1, y1, x2, y2])
91
 
92
- # sort the textblocks by x1
93
- coords.sort(key = lambda x: x[0])
94
  # create vertical buckets of horizontal pixelsize of 15% of the image width
95
  buckets = []
96
  bucket_size = int(0.15 * img.shape[1])
@@ -106,9 +106,9 @@ def textblock_ordering(textblocks, img):
106
  else:
107
  buckets.append([coord])
108
 
109
- # sort each bucket by y1
110
  for bucket in buckets:
111
- bucket.sort(key = lambda x: x[1])
112
 
113
  # visualize the buckets one by one each with a different color
114
  # for bucket in buckets:
 
89
  ori_coords[tuple([x1, y1, x2, y2])] = [x1, y1, x2, y2]
90
  coords.append([x1, y1, x2, y2])
91
 
92
+ # sort the textblocks by y1
93
+ coords.sort(key = lambda x: x[1])
94
  # create vertical buckets of horizontal pixelsize of 15% of the image width
95
  buckets = []
96
  bucket_size = int(0.15 * img.shape[1])
 
106
  else:
107
  buckets.append([coord])
108
 
109
+ # sort each bucket by x1
110
  for bucket in buckets:
111
+ bucket.sort(key = lambda x: x[0])
112
 
113
  # visualize the buckets one by one each with a different color
114
  # for bucket in buckets: