(self, contour)
| 147 | return expanded |
| 148 | |
| 149 | def get_mini_boxes(self, contour): |
| 150 | bounding_box = cv2.minAreaRect(contour) |
| 151 | points = sorted(list(cv2.boxPoints(bounding_box)), key=lambda x: x[0]) |
| 152 | |
| 153 | index_1, index_2, index_3, index_4 = 0, 1, 2, 3 |
| 154 | if points[1][1] > points[0][1]: |
| 155 | index_1 = 0 |
| 156 | index_4 = 1 |
| 157 | else: |
| 158 | index_1 = 1 |
| 159 | index_4 = 0 |
| 160 | if points[3][1] > points[2][1]: |
| 161 | index_2 = 2 |
| 162 | index_3 = 3 |
| 163 | else: |
| 164 | index_2 = 3 |
| 165 | index_3 = 2 |
| 166 | |
| 167 | box = [ |
| 168 | points[index_1], points[index_2], points[index_3], points[index_4] |
| 169 | ] |
| 170 | return box, min(bounding_box[1]) |
| 171 | |
| 172 | def box_score_fast(self, bitmap, _box): |
| 173 | """ |
no outgoing calls
no test coverage detected