Closed suqian1988 closed 2 years ago
@suqian1988 Hi Mike, thanks for opening the issue!
Yes, it sure can.
Here, if you pass --bounce=1
, it should mark the bounces in blue and display them, like in the following image (unless the model failed to predict bounces 😅)
If you want all the bounces to be marked on the court, then 👇
https://github.com/ArtLabss/tennis-tracking/blob/91f0fa2ba740e9840d23c5c0bf3dbeb3b62cbe05/predict_video.py#L337-L339
the list idx
stores the frame numbers where the ball touches the court. So, change this
https://github.com/ArtLabss/tennis-tracking/blob/91f0fa2ba740e9840d23c5c0bf3dbeb3b62cbe05/predict_video.py#L357-L370
with this
while True:
ret, frame = video.read()
if ret:
# if coords[i] is not None:
for loc in idx:
center_coordinates = int(xy[loc][0]), int(xy[loc][1])
radius = 3
color = (255, 0, 0)
thickness = -1
cv2.circle(frame, center_coordinates, 10, color, thickness)
i += 1
output_video.write(frame)
else:
break
Didn't run the code myself, but should work. Feel free to reopen the issue, anytime! 😄
oh,on the small black court, right?
is there a way to mark the bounce points on the main court?
thank you so much.
Mike.
On Mon, Feb 14, 2022 at 7:11 AM Shukur Sabzaliev @.***> wrote:
@suqian1988 https://github.com/suqian1988 Hi there, thanks for opening the issue! Yes, it sure can. In README.md I included a gif image where the bounces are marked in blue, here
[image: image] https://user-images.githubusercontent.com/78250180/153860050-72db9991-b505-4e7d-bebb-253f926a419c.png
If you want all the bounces to be marked on the court, then 👇
https://github.com/ArtLabss/tennis-tracking/blob/91f0fa2ba740e9840d23c5c0bf3dbeb3b62cbe05/predict_video.py#L337-L339 the list idx stores the frame numbers where the ball touches the court. So, change this
while True:
ret, frame = video.read() if ret: # if coords[i] is not None: for loc in idx: center_coordinates = int(xy[loc][0]), int(xy[loc][1]) radius = 3 color = (255, 0, 0) thickness = -1 cv2.circle(frame, center_coordinates, 10, color, thickness) i += 1 output_video.write(frame) else: break
Didn't run the code myself, but should work. Feel free to reopen the issue, anytime! 😄
— Reply to this email directly, view it on GitHub https://github.com/ArtLabss/tennis-tracking/issues/13#issuecomment-1039012652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEJ6UWQI653EAP6G54SSILU3DWNHANCNFSM5OHCONCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
@suqian1988 No, the code provided will mark the bounces only on the real court itself. As for for marking on the black court (mini-map), it is a bit more complex. We will need the inverse matrix and will then apply perspective transform.
Can the tennis-tracking mark the ball bounce position in the video?
thank you very much. Mike