Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
fix: processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouwrice committed Apr 22, 2024
1 parent c83350e commit c513005
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 2 additions & 0 deletions build_exe.nu
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
--include-plugin-directory=.venv/Lib/site-packages/pygame_gui/data/
--include-data-files=.venv/Lib/site-packages/pygame_gui/data/*.*=pygame_gui/data/
--include-data-files=.venv/Lib/site-packages/pygame_gui/data/translations/*=pygame_gui/data/translations/
--enable-console
--enable-plugin=no-qt
--onefile ./drumpy/cli.py)
8 changes: 4 additions & 4 deletions drumpy/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ def start(self: Self) -> None:

def main() -> None:
app = App(
source=Source.CAMERA,
running_mode=RunningMode.LIVE_STREAM, # type: ignore
model=LandmarkerModel.FULL,
source=Source.FILE,
running_mode=RunningMode.VIDEO, # type: ignore
model=LandmarkerModel.LITE,
delegate=BaseOptions.Delegate.CPU, # type: ignore
landmark_type=LandmarkType.WORLD_LANDMARKS,
landmark_type=LandmarkType.LANDMARKS,
file_path="../data/Recordings/multicam_asil_01_front.mkv",
# log_file="test.csv",
disable_drum=False,
Expand Down
12 changes: 4 additions & 8 deletions drumpy/mediapipe_pose/process_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ def mollifier(self, x: float) -> float:
if x <= 0:
return 0

return math.exp((-(math.log(x / self.peak) ** 4)) * self.tightness)
return math.exp((-(math.log(x / self.peak) ** 2)) * self.tightness)

def process_result(
self, result: PoseLandmarkerResult, timestamp_ms: float
) -> PoseLandmarkerResult:
"""
Process the result of the pose estimation
"""
if len(self.results) == 0 or len(result.pose_landmarks) == 0:
if result.pose_landmarks is None or len(result.pose_landmarks) == 0:
print("No pose landmarks found")
return result

for i, landmark in enumerate(result.pose_landmarks[0]):
result.pose_landmarks[0][i] = self.process_landmark(
landmark, i, timestamp_ms
Expand Down Expand Up @@ -169,9 +171,3 @@ def calculate_diff(
diff.y = current.y - previous.y
diff.z = current.z - previous.z
return diff


if __name__ == "__main__":
processor = ResultProcessor(LandmarkType.LANDMARKS)
for i in range(20):
print(processor.mollifier(i / 2))

0 comments on commit c513005

Please sign in to comment.