file display
Browse files
main.py
CHANGED
@@ -43,37 +43,6 @@ def tracking(video, model, boxes=True):
|
|
43 |
|
44 |
|
45 |
|
46 |
-
#def show_tracking(video_content):
|
47 |
-
|
48 |
-
video = cv2.VideoCapture(video_content)
|
49 |
-
|
50 |
-
# Track
|
51 |
-
video_track = tracking(video_content, track_model.track)
|
52 |
-
|
53 |
-
# Prepare to save video
|
54 |
-
output_file_track = os.path.join("track.mp4")
|
55 |
-
|
56 |
-
fourcc = cv2.VideoWriter_fourcc(*"mp4v") # Codec for MP4 video
|
57 |
-
fps = video.get(cv2.CAP_PROP_FPS)
|
58 |
-
height, width, _ = video_track[0][0].orig_img.shape
|
59 |
-
size = (width,height)
|
60 |
-
|
61 |
-
out_track = cv2.VideoWriter(output_file_track, fourcc, fps, size)
|
62 |
-
|
63 |
-
# Go through frames and write them
|
64 |
-
for frame_track in video_track:
|
65 |
-
result_track = frame_track[0].plot() # plot a BGR numpy array of predictions
|
66 |
-
|
67 |
-
#print(type(result_pose)) numpy ndarray
|
68 |
-
out_track.write(result_track)
|
69 |
-
|
70 |
-
out_track.release()
|
71 |
-
|
72 |
-
video.release()
|
73 |
-
cv2.destroyAllWindows() # Closing window
|
74 |
-
|
75 |
-
return output_file_track
|
76 |
-
|
77 |
def poses(photo, check):
|
78 |
# Selecting the specific inferencer
|
79 |
out_files=[]
|
@@ -107,7 +76,7 @@ def run():
|
|
107 |
webcam = gr.Interface(
|
108 |
fn=poses,
|
109 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
110 |
-
outputs = [gr.PlayableVideo(),gr.PlayableVideo(),gr.PlayableVideo()],
|
111 |
title = 'Pose estimation',
|
112 |
description = 'Pose estimation on video',
|
113 |
allow_flagging=False
|
|
|
43 |
|
44 |
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
def poses(photo, check):
|
47 |
# Selecting the specific inferencer
|
48 |
out_files=[]
|
|
|
76 |
webcam = gr.Interface(
|
77 |
fn=poses,
|
78 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
79 |
+
outputs = [gr.PlayableVideo(), gr.PlayableVideo(), gr.PlayableVideo()],
|
80 |
title = 'Pose estimation',
|
81 |
description = 'Pose estimation on video',
|
82 |
allow_flagging=False
|