@@ -11,10 +11,6 @@ const VIDEO_WIDTH = 640;
11
11
const VIDEO_HEIGHT = 500 ;
12
12
const mobile = false ;
13
13
14
- const state = {
15
- backend : 'webgl'
16
- } ;
17
-
18
14
function drawKeypoints ( ctx , keypoints ) {
19
15
function drawPoint ( ctx , y , x , r ) {
20
16
ctx . beginPath ( ) ;
@@ -84,7 +80,6 @@ async function loadVideo() {
84
80
85
81
const main =
86
82
async ( ) => {
87
- await tf . setBackend ( state . backend ) ;
88
83
model = await handpose . load ( ) ;
89
84
let video ;
90
85
@@ -111,9 +106,6 @@ const landmarksRealTime = async (video) => {
111
106
112
107
const ctx = canvas . getContext ( '2d' ) ;
113
108
114
- video . width = videoWidth ;
115
- video . height = videoHeight ;
116
-
117
109
ctx . clearRect ( 0 , 0 , videoWidth , videoHeight ) ;
118
110
ctx . strokeStyle = 'red' ;
119
111
ctx . fillStyle = 'red' ;
@@ -135,7 +127,12 @@ const landmarksRealTime = async (video) => {
135
127
const predictions = await model . estimateHands ( video ) ;
136
128
if ( predictions . length > 0 ) {
137
129
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 ) ;
139
136
}
140
137
requestAnimationFrame ( frameLandmarks ) ;
141
138
} ;
0 commit comments