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

Commit

Permalink
Merge branch 'main' of github.com:PatNei/Bsc-Sign-Language-Recon
Browse files Browse the repository at this point in the history
  • Loading branch information
PatNei committed Feb 13, 2024
2 parents 607f159 + 12d24f4 commit b6d60d4
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 121 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic"
}
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
poetry run uvicorn backend.sign.main:app --reload
poetry run uvicorn backend.sign.main:app --reload
18 changes: 9 additions & 9 deletions frontend/src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { drawConnectors, drawLandmarks, NormalizedLandmark } from '@mediapipe/dr
import { HAND_CONNECTIONS, InputImage } from '@mediapipe/holistic';
import { APIPost } from "../api";

interface Landmark {
interface LandmarkDTO {
x: string;
y: string;
z: string;
Expand Down Expand Up @@ -60,17 +60,17 @@ export default function Canvas(props?: CanvasHTMLAttributes<HTMLCanvasElement>):
results.image, 0, 0, canvas.width, canvas.height);
if (results.multiHandLandmarks) {
for (const landmarks of results.multiHandLandmarks) {
let newLandmarks: Landmark[] = []
landmarks.forEach((element, i) => {
newLandmarks[i] = {
x: element.x.toFixed(),
y: element.y.toFixed(),
z: element.z ? element.z.toFixed() : "0"
let landmarksDTO: LandmarkDTO[] = landmarks.map((element : NormalizedLandmark) : LandmarkDTO => {
return {
x: element.x.toFixed(20),
y: element.y.toFixed(20),
z: element.z ? element.z.toFixed(20) : "0"
}
});
})
console.log(JSON.stringify(landmarksDTO))
drawConnectors(canvasCtx, landmarks, HAND_CONNECTIONS, { color: '#00FF00', lineWidth: 2 });
drawLandmarks(canvasCtx, landmarks, { color: '#FF0000', lineWidth: 2 });
let postState = await APIPost(`annotation`, newLandmarks);
let postState = await APIPost(`annotation`, landmarksDTO);
if (postState.response && !postState.error) console.log(postState.response)
else if (postState.error) console.log(postState.error)
}
Expand Down
Loading

0 comments on commit b6d60d4

Please sign in to comment.