Added some code.

This commit is contained in:
didier amyot committed 2024-01-21 12:06:17 -05:00
1 parent 6bda4df111
commit 67a7224f42
3 files changed
+29 -2

No files matched your search

+25
View File
@@ -63,6 +63,31 @@ def crazy_experiment(frame):
cv2.polylines(frame, pts, True, (0, 255, 255), 8)
def get_court_perspective_transform():
"""
"""
empirical_top_left = np.float32([416, 175])
empirical_top_right = np.float32([905, 173])
empirical_bottom_left = np.float32([51, 702])
empirical_bottom_right = np.float32([1188, 695])
court_top_left = np.float32([0, 0])
court_top_right = np.float32([9, 0])
court_bottom_left = np.float32([0, 18])
court_bottom_right = np.float32([9, 18])
empirical_source = np.float32([empirical_top_left,
empirical_top_right,
empirical_bottom_left,
empirical_bottom_right])
pixel_per_meter = 50
empirical_target = np.float32([court_top_left,
court_top_right,
court_bottom_left,
court_bottom_right]) * pixel_per_meter
return cv2.getPerspectiveTransform(empirical_source, empirical_target)
def main(input_filename: Path, output_filename: Path, detected_box_objects):
# define some constants
detected_box_objects = sorted(detected_box_objects, reverse=True)