Free Motion Capture for Everyone πβ¨
TypeScript
add setup and preview thingy jon is gonna make an api endpoint now.
Endurance Idehen5de08071b8b5
diff --git a/freemocap-ui/package.json b/freemocap-ui/package.jsonindex 2a5f05fa..0200dd84 100644--- a/freemocap-ui/package.json+++ b/freemocap-ui/package.json@@ -2,8 +2,9 @@"name": "freemocap-ui","version": "0.1.0","private": true,+ "main": "src/index.tsx","engines": {- "node": "=16.13.2"+ "node": "=16"},"dependencies": {"@emotion/react": "^11.7.1",@@ -43,7 +44,7 @@"@types/react-router-dom": "^5.1.6"},"scripts": {- "start": "REACT_APP_DISABLE_LIVE_RELOAD=true react-scripts start",+ "start": "react-scripts start","start:https": "HTTPS=true SSL_CRT_FILE=./localhost.pem SSL_KEY_FILE=./localhost-key.pem react-scripts start","certs": "./scripts/cert.sh","build": "react-scripts build",diff --git a/freemocap-ui/src/layout/Navigator.tsx b/freemocap-ui/src/layout/Navigator.tsxindex 09347cf2..b462d209 100644--- a/freemocap-ui/src/layout/Navigator.tsx+++ b/freemocap-ui/src/layout/Navigator.tsx@@ -14,6 +14,10 @@ const categories = [{id: 'Build',children: [+ {+ id: 'Setup and Preview',+ route: "/setup_and_preview"+ },{id: 'Show Cameras',route: "/show_cameras"diff --git a/freemocap-ui/src/layout/routing/router.tsx b/freemocap-ui/src/layout/routing/router.tsxindex 0395b636..cd57faf2 100644--- a/freemocap-ui/src/layout/routing/router.tsx+++ b/freemocap-ui/src/layout/routing/router.tsx@@ -6,11 +6,13 @@ import {WebcamJonTest} from "../../views/WebcamJonTest";import {PythonToJsTest} from "../../views/PythonToJsTest";import {BoardDetection} from "../../views/BoardDetection";import {SkeletonDetection} from "../../views/SkeletonDetection";+import {SetupAndPreview} from "../../views/prod/SetupAndPreview";export const Router = () => {return (<Routes><Route path={'/'} element={<React.Fragment />} />+ <Route path={'/setup_and_preview'} element={<SetupAndPreview />} /><Route path={'/show_cameras'} element={<WebcamStreamCapture />} /><Route path={'/config'} element={<ConfigView />} /><Route path={'/jontestplayground'} element={<WebcamJonTest />} />diff --git a/freemocap-ui/src/views/prod/SetupAndPreview.tsx b/freemocap-ui/src/views/prod/SetupAndPreview.tsxnew file mode 100644index 00000000..611c42aa--- /dev/null+++ b/freemocap-ui/src/views/prod/SetupAndPreview.tsx@@ -0,0 +1,27 @@+import {useFrameCapture} from "../../hooks/use-frame-capture";+import {CaptureType} from "../../services/frame-capture";+import {Box} from "@mui/material";+import React from "react";++// So what do we need?++// We need to know what all the cameras are ahead of time, so that we can tell the UI+// what is possible to connect to.++// SetupAndPreview View will run through that list of available cameras, and display it to the user.++// Finally, We'll include form inputs so that users can select configuration on screen, and submit their results+// for freemocap (api) to save (prolly to disk).++export const SetupAndPreview = () => {+ const [frameCapture, data] = useFrameCapture("0", CaptureType.BoardDetection);+ if (!data) {+ return null;+ }++ return (+ <Box>+ {!frameCapture.isConnectionClosed && <img src={frameCapture.current_data_url} alt={"video capture"} />}+ </Box>+ )+}\ No newline at end of filediff --git a/planning/2022-05-21_planning_notes.md b/planning/2022-05-21_planning_notes.mdindex 03bb2deb..e52280fe 100644--- a/planning/2022-05-21_planning_notes.md+++ b/planning/2022-05-21_planning_notes.md@@ -53,3 +53,10 @@4 - post-processing and analysis- do stuff with data output from 3 and/or 4+++## Questions for those Pyuvc people - Pupil Labs++1. What is a good, robust way to detect cameras on a system regardless of Operating System?+2. Also, whats a good way to get unique identifiers for camera devices regardless of Operating System?+3. Whats a good way to retrieve camera data for N number of cameras without incurring steep processing penalties? (Threading, Multiprocessing, other techniques?)\ No newline at end of filediff --git a/src/cameras/detection/cam_singleton.py b/src/cameras/detection/cam_singleton.pyindex 30a5c68e..9a82f4d4 100644--- a/src/cameras/detection/cam_singleton.py+++ b/src/cameras/detection/cam_singleton.py@@ -7,9 +7,9 @@ _available_cameras: FoundCamerasResponse = None# If you want cams, you call this function-def get_or_create_cams():+def get_or_create_cams(always_create=False):global _available_cameras- if _available_cameras is None:+ if _available_cameras is None or always_create:d = DetectPossibleCameras()_available_cameras = d.find_available_cameras()