fix dealername2
Showing
1 changed file
with
11 additions
and
6 deletions
... | @@ -105,15 +105,20 @@ class Retriever: | ... | @@ -105,15 +105,20 @@ class Retriever: |
105 | y_min_find = None | 105 | y_min_find = None |
106 | value = None | 106 | value = None |
107 | coordinates = None | 107 | coordinates = None |
108 | for (x0, y0, _, _, x1, y1, _, _), text in go_res.values(): | 108 | for (x0, y0, x1, y1, x2, y2, x3, y3), text in go_res.values(): |
109 | cent_x = x0 + ((x1 - x0)/2) | 109 | new_x0 = min(x0, x1, x2, x3) |
110 | cent_y = y0 + ((y1 - y0)/2) | 110 | new_y0 = min(y0, y1, y2, y3) |
111 | new_x1 = max(x0, x1, x2, x3) | ||
112 | new_y1 = max(y0, y1, y2, y3) | ||
113 | |||
114 | cent_x = new_x0 + ((new_x1 - new_x0)/2) | ||
115 | cent_y = new_y0 + ((new_y1 - new_y0)/2) | ||
111 | if x_min < cent_x < x_max and y_min < cent_y < y_max: | 116 | if x_min < cent_x < x_max and y_min < cent_y < y_max: |
112 | if y_min_find is None or y0 < y_min_find: | 117 | if y_min_find is None or new_y0 < y_min_find: |
113 | if len(text.strip()) > 0: | 118 | if len(text.strip()) > 0: |
114 | y_min_find = y0 | 119 | y_min_find = new_y0 |
115 | value = text | 120 | value = text |
116 | coordinates = (x0, y0, x1, y1) | 121 | coordinates = (new_x0, new_y0, new_x1, new_y1) |
117 | return value, coordinates | 122 | return value, coordinates |
118 | 123 | ||
119 | @staticmethod | 124 | @staticmethod | ... | ... |
-
Please register or sign in to post a comment