Open cthompto opened 3 years ago
you'll need to pass in options. Here's a start:
function getFaceDetectorOptions() {
if (selected_face_detector == "tiny_face_detector") {
return new self.faceapi.TinyFaceDetectorOptions({
inputSize,
scoreThreshold,
drawLines: true,
drawPoints: false
});
}
}
and then
result = await self.faceapi
.detectSingleFace(imgCanvas, detector_options)
.withFaceLandmarks(true);
In case somebody will need to adjust lines and dots in FaceLandmarks this is how to do it:
const faceLandmarksConfig = new DrawFaceLandmarksOptions({
drawPoints: false,
pointSize: 2,
pointColor: '#fff',
drawLines: true,
lineColor: '#fff',
lineWidth: 2
})
new DrawFaceLandmarks(resizeResults.landmarks, faceLandmarksConfig).draw(canvasElem)
Looking for clear documentation on how to change the point and line color for landmarks being draw onto a live webcam feed, using the following is unsuccessful:
const options = { lineColor: "#FFFFFF" }
const detections = await faceapi.detectSingleFace(video, new faceapi.TinyFaceDetectorOptions()).withFaceLandmarks().withFaceExpressions()
const resizedDetections = faceapi.resizeResults(detections, displaySize)
canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height)
faceapi.draw.drawFaceLandmarks(canvas, resizedDetections, options)
faceapi.draw.drawFaceExpressions(canvas, resizedDetections)