Added some code.
This commit is contained in:
1 parent
6bda4df111
commit
67a7224f42
3 files changed
+29
-2
No files matched your search
@@ -3,3 +3,4 @@ env
|
||||
.idea
|
||||
.DS_Store
|
||||
*.pt
|
||||
*.png
|
||||
@@ -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)
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
.court-border {
|
||||
stroke: red;
|
||||
stroke-width: 4px;
|
||||
fill-opacity: 0;
|
||||
/*fill-opacity: 0;*/
|
||||
fill: gray;
|
||||
}
|
||||
|
||||
.return-line {
|
||||
stroke: yellow;
|
||||
stroke: blue;
|
||||
stroke-width: 2px;
|
||||
fill-opacity: 0;
|
||||
}
|
||||
Reference in new issue
Block a user