Skip to content

Commit

Permalink
Random recording selection
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvschie committed Jan 9, 2025
1 parent dfb24d2 commit dc76d73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Binary file modified research/scripts/mediapipe/contourwall_core.dll
Binary file not shown.
17 changes: 11 additions & 6 deletions research/scripts/mediapipe/multi_person.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from random import randrange
import cv2
import numpy as np
import mediapipe as mp
Expand Down Expand Up @@ -63,6 +64,7 @@ def __init__(self, video_path:list, load_dir:str, save_dir:str, model_path:str,
self.is_recording = False
self.is_replaying = False
self.last_replay_time = 0
self.recording = []

def video_load(self):
if len(self.video_path) == 1:
Expand Down Expand Up @@ -250,7 +252,7 @@ def detect_pose_landmarks(self):
out = cv2.VideoWriter(temp_video_path, self.fourcc, 30.0, (self.width, self.height))

cw = ContourWall()
cw.new_with_ports("COM6", "COM7", "COM8", "COM9", "COM5", "COM4")
cw.new_with_ports("COM5", "COM7", "COM6", "COM8", "COM3", "COM4")
with vision.PoseLandmarker.create_from_options(self.options) as landmarker:
cap = cv2.VideoCapture(0)
while cap.isOpened():
Expand Down Expand Up @@ -280,17 +282,20 @@ def detect_pose_landmarks(self):
cv2.imshow("MediaPipe Pose Landmark Pixelated", output_pixelated)

if self.is_recording:
self.recorded_frames.append(output_pixelated)
self.recording.append(output_pixelated)
cw.pixels[:] = output_pixelated
if not self.is_recording and len(self.recording) > 0:
self.recorded_frames.append(self.recording)
self.recording = []
if self.is_replaying:
for replay_frame in self.recorded_frames:
random_recording = randrange(len(self.recorded_frames))
for replay_frame in self.recorded_frames[random_recording]:
cw.pixels[:] = replay_frame
cw.show()
self.is_replaying = False
self.is_replaying = False
else:
cw.pixels[:] = output_pixelated

cw.show()
cw.show()

current_time = time.time()

Expand Down

0 comments on commit dc76d73

Please sign in to comment.