Closed tengerye closed 4 years ago
In your `documents.py' file, there is a snippet:
def sort_box_with_list(data: List[Tuple], left_right_first=True): def compare_key(x): # x is (index, points, transcription, type) or (index, points, transcription) points = x[1] box = np.array([[points[0], points[1]], [points[2], points[3]], [points[4], points[5]], [points[6], points[7]]], dtype=np.float32) rect = cv2.minAreaRect(box) # Smallest rectangle around the box. # rect: center(x,y), (width, height), angle of rotation center = rect[0] if left_right_first: return center[1], center[0] else: return center[0], center[1] data = sorted(data, key=compare_key) return data
I think if you want left_right_first, you shall return center[0], center[1] instead of center[1], center[0]. Since center=(x, y).
left_right_first
center[0], center[1]
center[1], center[0]
center=(x, y)
Thank you for bringing it to my attention. You are right. I have fixed it, and the default value of left_right_first is set to False.
False
In your `documents.py' file, there is a snippet:
I think if you want
left_right_first
, you shall returncenter[0], center[1]
instead ofcenter[1], center[0]
. Sincecenter=(x, y)
.