Estoy tratando de ocultar el video (webcam en este caso) pero mantengo los puntos detectados de la mano. He probado diferentes métodos, pero hasta ahora no he tenido éxito. Agradezco la ayuda.
El código principal (abajo) de ml5.js se puede encontrar y probar en vivo aquí: https://editor.p5js.org/ml5/sketches/Handpose_Webcam
let handpose; let video; let predictions = []; function setup() { createCanvas(640, 480); video = createCapture(VIDEO); video.size(width, height); handpose = ml5.handpose(video, modelReady); // This sets up an event that fills the global variable "predictions" // with an array every time new hand poses are detected handpose.on("predict", results => { predictions = results; }); // Hide the video element, and just show the canvas video.hide(); } function modelReady() { console.log("Model ready!"); } function draw() { image(video, 0, 0, width, height); // We can call both functions to draw all keypoints and the skeletons drawKeypoints(); } // A function to draw ellipses over the detected keypoints function drawKeypoints() { for (let i = 0; i < predictions.length; i += 1) { const prediction = predictions[i]; for (let j = 0; j < prediction.landmarks.length; j += 1) { const keypoint = prediction.landmarks[j]; fill(0, 255, 0); noStroke(); ellipse(keypoint[0], keypoint[1], 10, 10); } } }Sí, simplemente deje de dibujarlo en el lienzo y agregue una llamada al background para llenar el lienzo.
function draw() { // image(video, 0, 0, width, height); // <- just delete this line background(255); // We can call both functions to draw all keypoints and the skeletons drawKeypoints(); }