()
| 13 | } |
| 14 | |
| 15 | const detectFaces = async () => { |
| 16 | const prediction = await model.estimateFaces(video, false); |
| 17 | ctx.drawImage(video, 0, 0, 600, 400) |
| 18 | prediction.forEach((e) => { |
| 19 | ctx.beginPath(); |
| 20 | ctx.lineWidth = "4"; |
| 21 | ctx.strokeStyle = "purple" |
| 22 | ctx.rect( |
| 23 | e.topLeft[0], |
| 24 | e.topLeft[1], |
| 25 | e.bottomRight[0] - e.topLeft[0], |
| 26 | e.bottomRight[1] - e.topLeft[1] |
| 27 | |
| 28 | ); |
| 29 | ctx.stroke(); |
| 30 | ctx.fillStyle = "#d24"; |
| 31 | e.landmarks.forEach((landmark) => { |
| 32 | ctx.fillRect(landmark[0], landmark[1], 5, 5); |
| 33 | } |
| 34 | ); |
| 35 | }) |
| 36 | } |
| 37 | document.getElementById("btn").addEventListener("click", () => { |
| 38 | if (document.getElementById("btn").innerHTML == "Close Webcam") { |
| 39 | canvas.style.display = "none"; |
nothing calls this directly
no outgoing calls
no test coverage detected