Skip to content

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

TypeScript

Committing current set for api development

Endurance Idehen016a59c4e96d
diff --git a/freemocap-ui/package.json b/freemocap-ui/package.json
index 0200dd84..cbd8f634 100644
--- a/freemocap-ui/package.json
+++ b/freemocap-ui/package.json
@@ -19,6 +19,7 @@
"class-transformer": "0.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
+ "react-number-format": "^4.9.3",
"react-redux": "^7.2.6",
"react-router": "^6.2.1",
"react-router-dom": "^6.2.1",
diff --git a/freemocap-ui/src/views/prod/ConfigForm.tsx b/freemocap-ui/src/views/prod/ConfigForm.tsx
index 3ab183a0..536db4d2 100644
--- a/freemocap-ui/src/views/prod/ConfigForm.tsx
+++ b/freemocap-ui/src/views/prod/ConfigForm.tsx
@@ -1,14 +1,37 @@
-import { Typography } from "@mui/material"
+import {Typography, TextField, Button} from "@mui/material"
import {Box} from "@mui/system";
+import {default as NumberFormat} from 'react-number-format';
+const ExposureNumberField = () => {
+ // TODO: -13 -> -1 (inclusive)
+ return (
+ <NumberFormat customInput={TextField} />
+ );
+}
export const ConfigForm = () => {
return (
<Box>
- <Typography>Exposure</Typography>
+ <Box>
+ <Typography>Exposure</Typography>
+ <ExposureNumberField />
+ </Box>
+
+ <Box>
+ <Typography>Resolution Width</Typography>
+ <NumberFormat customInput={TextField} />
+
+ <Typography>Resolution Height</Typography>
+ <NumberFormat customInput={TextField} />
+ </Box>
+ <Box>
+ <Typography>Image Rotation Degree</Typography>
+ <NumberFormat customInput={TextField} />
+ </Box>
+ <Button>Save Camera Settings</Button>
</Box>
)
}
\ No newline at end of file
diff --git a/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx b/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
index 4cf730ab..210ad238 100644
--- a/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
+++ b/freemocap-ui/src/views/prod/SetupAndPreviewCamera.tsx
@@ -1,9 +1,8 @@
import {useFrameCapture} from "../../hooks/use-frame-capture";
import {CaptureType} from "../../services/frame-capture";
-import {Box} from "@mui/material";
+import {Box, Button} from "@mui/material";
import React from "react";
-import axios from "axios";
-import {useAsync} from "react-use";
+import {ConfigForm} from "./ConfigForm";
// So what do we need?
@@ -28,7 +27,11 @@ export const SetupAndPreviewCamera = (props: Props) => {
return (
<Box>
- {!frameCapture.isConnectionClosed && <img src={frameCapture.current_data_url} alt={"video capture"} />}
+ <Box display={'flex'} flexDirection={'column'} width={400}>
+ <Button>Preview in CV2</Button>
+ {!frameCapture.isConnectionClosed && <img src={frameCapture.current_data_url} alt={"video capture"} />}
+ </Box>
+ <ConfigForm />
</Box>
)
}
\ No newline at end of file
diff --git a/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx b/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
index b028771e..a0f05956 100644
--- a/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
+++ b/freemocap-ui/src/views/prod/SetupAndPreviewView.tsx
@@ -1,5 +1,3 @@
-import {useFrameCapture} from "../../hooks/use-frame-capture";
-import {CaptureType} from "../../services/frame-capture";
import {Box} from "@mui/material";
import React from "react";
import {useAsync} from "react-use";
@@ -21,17 +19,16 @@ export const SetupAndPreviewView = () => {
const response = useAsync(async () => {
const response = await axios.get('http://localhost:8080/camera/detect');
const port_numbers = response.data.cameras_found_list.map(x => x.webcam_id);
- console.log(response.data)
- return port_numbers.map(x => {
- return <SetupAndPreviewCamera camId={x} />
- })
+ return <SetupAndPreviewCamera camId={port_numbers[0]} />
+ // return port_numbers.map(x => {
+ // return <SetupAndPreviewCamera camId={x} />
+ // })
}, []);
if (response.loading) {
return null;
}
const r = response.value;
- console.log(r)
return (
<Box>
{r}