Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

show fps on mediapipe

Endurance Idehen2f29ee94b3ba
diff --git a/src/core_processor/board_detection/board_detection.py b/src/core_processor/board_detection/board_detection.py
index 24670cd9..b2c5e8b7 100644
--- a/src/core_processor/board_detection/board_detection.py
+++ b/src/core_processor/board_detection/board_detection.py
@@ -32,9 +32,6 @@ class BoardDetection:
if frame is None:
logger.error("Frame is empty")
continue
- # print(
- # f"got image of shape {frame.shape} from camera at port {port_number}"
- # )
(
charuco_corners,
charuco_ids,
diff --git a/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py b/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py
index a70f4d25..d49a8acb 100644
--- a/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py
+++ b/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py
@@ -7,6 +7,8 @@ import mediapipe as mp
from src.cameras.cam_factory import create_opencv_cams
mp_holistic = mp.solutions.holistic
+mp_drawing = mp.solutions.drawing_utils
+mp_drawing_styles = mp.solutions.drawing_styles
class MediapipeSkeletonDetection:
@@ -36,17 +38,13 @@ class MediapipeSkeletonDetection:
continue
image = self.detect_mediapipe_skeleton(holistic, frame)
-
+ self.apply_fps(image, cv_cam.current_fps)
cv2.imshow(cv_cam.webcam_id_as_str, image)
def detect_mediapipe_skeleton(self, holistic, image):
# adapted from 'webcam' part of demo code here -
# https://google.github.io/mediapipe/solutions/holistic.html
- mp_drawing = mp.solutions.drawing_utils
- mp_drawing_styles = mp.solutions.drawing_styles
- mp_holistic = mp.solutions.holistic
-
# For webcam input:
# To improve performance, optionally mark the image as not writeable to
# pass by reference.
@@ -72,6 +70,17 @@ class MediapipeSkeletonDetection:
)
return image
+ def apply_fps(self, image, fps_number):
+ cv2.putText(
+ image,
+ f"FPS: {str(fps_number)}",
+ (10, 15),
+ cv2.FONT_HERSHEY_SIMPLEX,
+ 0.5,
+ (209, 180, 0, 255),
+ 1,
+ )
+
if __name__ == "__main__":
asyncio.run(MediapipeSkeletonDetection().process())