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

+1
View File
@@ -3,3 +3,4 @@ env
.idea .idea
.DS_Store .DS_Store
*.pt *.pt
*.png
+25
View File
@@ -63,6 +63,31 @@ def crazy_experiment(frame):
cv2.polylines(frame, pts, True, (0, 255, 255), 8) 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): def main(input_filename: Path, output_filename: Path, detected_box_objects):
# define some constants # define some constants
detected_box_objects = sorted(detected_box_objects, reverse=True) detected_box_objects = sorted(detected_box_objects, reverse=True)
+3 -2
View File
@@ -1,11 +1,12 @@
.court-border { .court-border {
stroke: red; stroke: red;
stroke-width: 4px; stroke-width: 4px;
fill-opacity: 0; /*fill-opacity: 0;*/
fill: gray;
} }
.return-line { .return-line {
stroke: yellow; stroke: blue;
stroke-width: 2px; stroke-width: 2px;
fill-opacity: 0; fill-opacity: 0;
} }