Skip to content

Commit 20de8fb

Browse files
committed
remove fat
1 parent f96e724 commit 20de8fb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

html/rps-tf/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ const VIDEO_WIDTH = 640;
1111
const VIDEO_HEIGHT = 500;
1212
const mobile = false;
1313

14-
const state = {
15-
backend: 'webgl'
16-
};
17-
1814
function drawKeypoints(ctx, keypoints) {
1915
function drawPoint(ctx, y, x, r) {
2016
ctx.beginPath();
@@ -84,7 +80,6 @@ async function loadVideo() {
8480

8581
const main =
8682
async () => {
87-
await tf.setBackend(state.backend);
8883
model = await handpose.load();
8984
let video;
9085

@@ -111,9 +106,6 @@ const landmarksRealTime = async (video) => {
111106

112107
const ctx = canvas.getContext('2d');
113108

114-
video.width = videoWidth;
115-
video.height = videoHeight;
116-
117109
ctx.clearRect(0, 0, videoWidth, videoHeight);
118110
ctx.strokeStyle = 'red';
119111
ctx.fillStyle = 'red';
@@ -135,7 +127,12 @@ const landmarksRealTime = async (video) => {
135127
const predictions = await model.estimateHands(video);
136128
if (predictions.length > 0) {
137129
const result = predictions[0].landmarks;
138-
drawKeypoints(ctx, result, predictions[0].annotations);
130+
const annots = predictions[0].annotations;
131+
console.log('result');
132+
console.log(result);
133+
console.log('annots');
134+
console.log(annots);
135+
drawKeypoints(ctx, result, annots);
139136
}
140137
requestAnimationFrame(frameLandmarks);
141138
};

0 commit comments

Comments
 (0)