Free Motion Capture for Everyone πβ¨
TypeScript
frame-capture mediapip
Endurance Idehena2ce703268c8
diff --git a/freemocap-ui/src/services/frame-capture.tsx b/freemocap-ui/src/services/frame-capture.tsxindex dcdecfed..320c2c96 100644--- a/freemocap-ui/src/services/frame-capture.tsx+++ b/freemocap-ui/src/services/frame-capture.tsx@@ -3,8 +3,7 @@ import {useEffect, useState} from "react";type OnMessageHandler = (ev: MessageEvent<Blob>, data_url: string) => Promise<void>;export enum CaptureType {- BoardDetection = "board_detection",- SkeletonDetection = "skeleton_detection",+ BoardDetection = "board_detection", SkeletonDetection = "skeleton_detection",}export class FrameCapture {@@ -12,14 +11,11 @@ export class FrameCapture {private readonly _host: string;private readonly _base_host: string = "ws://localhost:8080/ws";- constructor(- private readonly _webcamId: string,- private readonly _captureType: CaptureType = CaptureType.BoardDetection,- ) {+ constructor(private readonly _webcamId: string, private readonly _captureType: CaptureType = CaptureType.BoardDetection,) {this._host = `${this._base_host}/${this._captureType}/${this._webcamId}`}- private _current_data_url: string = ""+ private _current_data_url!: string;public get current_data_url(): string {return this._current_data_url;@@ -46,7 +42,6 @@ export class FrameCapture {}}-export const useFrameCapture = (webcam_id: string, captureType: CaptureType, onMessage?: OnMessageHandler): [FrameCapture, string] => {const [frameCapture,] = useState(() => new FrameCapture(webcam_id, captureType));const [data, setDataUrl] = useState<string>("");diff --git a/freemocap-ui/src/views/SkeletonDetection.tsx b/freemocap-ui/src/views/SkeletonDetection.tsxindex 49366b54..390781a0 100644--- a/freemocap-ui/src/views/SkeletonDetection.tsx+++ b/freemocap-ui/src/views/SkeletonDetection.tsx@@ -4,7 +4,6 @@ import {CaptureType, useFrameCapture} from "../services/frame-capture";export const SkeletonDetection = () => {const [frameCapture, data] = useFrameCapture("0", CaptureType.SkeletonDetection);-if (!data) {return null;}@@ -13,4 +12,4 @@ export const SkeletonDetection = () => {{!frameCapture.isConnectionClosed && <img src={frameCapture.current_data_url} alt={"video capture"}/>}</Box>);-}\ No newline at end of file+}diff --git a/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py b/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.pyindex b36ea217..f77a817f 100644--- a/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py+++ b/src/core_processor/mediapipe_skeleton_detection/mediapipe_skeleton_detection.py@@ -29,9 +29,10 @@ class MediapipeSkeletonDetection:image = self._process_single_cam_frame(holistic, cv_cam)if cb and image is not None:await cb(image)- except:+ except Exception as e:logger.error("Printing traceback")traceback.print_exc()+ raise easync def process(self):cam_manager: CVCameraManager = CVCameraManager()