如何在 p5.js 中打开相机并检测鼻子

How to open the camera and dectect the nose in p5.js

let video;
let nose;
let poseNet;
let ml5;

function setup(){
  createCanvas (680,480);
  video = createCapture (VIDEO);
  video.hide();
  nose = createVector (width/2,height/2);
  poseNet = ml5.poseNet (video, modelReady);
  poseNet.org ('pose', getposes);
}
function getPoses (pose, gotPoses) {
  if (poses.length > 0 ) {
    let PoseNose = poses [0].pose.net;
    nose.x = poseNose.x;
    nose.y = poseNose.y;
  }
}
function modelRedy (){
  console.log ("Model loade, finally!")
  
  }
function draw (){
  background (250);
  image (video,0,0);
  fill (255,255,0);
  circle (nose.x,nose.y,20);
}

上面,我已经写了我的代码,我想要那个摄像头应该打开并且它应该检测到我的鼻子?但它不起作用。我正在 p5.js

中编写这段代码

我找到了答案。抱歉,我没有定义 index.html.

的 src 地址