Skip to content

Commit

Permalink
Added README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cris committed Apr 10, 2021
1 parent 1cdcb06 commit abda958
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# BasketTracking

<p align='center'>
<img src="demo.gif" />
</p>
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pano_enhanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions video_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
search_params = dict(checks=50)
flann = cv2.FlannBasedMatcher(index_params, search_params)


class VideoHandler:
def __init__(self, pano, video, ball_detector, feet_detector, map_2d):
self.M1 = np.load("Rectify1.npy")
Expand All @@ -29,14 +30,19 @@ def run_detectors(self):
if not ok:
break
else:
if 0 <= time_index < 20:
if 0 <= time_index < 200:

print("\r Computing DEMO: " + str(int(100 * time_index / 200)) + "%",
flush=True, end='')

frame = frame[TOPCUT:, :]
M = self.get_homography(frame, self.des1, self.kp1)
frame, self.map_2d, map_2d_text = self.feet_detector.get_players_pos(M, self.M1, frame, time_index, self.map_2d)
frame, self.map_2d, map_2d_text = self.feet_detector.get_players_pos(M, self.M1, frame, time_index,
self.map_2d)
frame, ball_map_2d = self.ball_detector.ball_tracker(M, self.M1, frame, self.map_2d.copy())
vis = np.vstack((frame, cv2.resize(map_2d_text, (frame.shape[1], frame.shape[1] // 2))))

cv2.imshow("Tracking", vis)
# cv2.imshow("Tracking", vis)
writer.writeFrame(cv2.cvtColor(vis, cv2.COLOR_BGR2RGB))

k = cv2.waitKey(1) & 0xff
Expand Down

0 comments on commit abda958

Please sign in to comment.