Transform pixel location to different reference.
(pt, center, scale, res, invert=0, rot=0)
| 989 | |
| 990 | |
| 991 | def transform(pt, center, scale, res, invert=0, rot=0): |
| 992 | """Transform pixel location to different reference.""" |
| 993 | t = get_transform(center, scale, res, rot=rot) |
| 994 | if invert: |
| 995 | t = np.linalg.inv(t) |
| 996 | new_pt = np.array([pt[0] - 1, pt[1] - 1, 1.0]).T |
| 997 | new_pt = np.dot(t, new_pt) |
| 998 | return np.array([round(new_pt[0]), round(new_pt[1])], dtype=int) + 1 |
| 999 | |
| 1000 | |
| 1001 | def bbox_from_detector(bbox, input_resolution=(224, 224), rescale=1.25): |
no test coverage detected