Google Chomre 自帶人臉檢測API嚐鮮
核心API
faceDetector
.detect(img)
.then(faces =>
faces.forEach(face => {
const { height, width, top, left } = face.boundingBox;
frameRef.current.style.cssText = `
display: inline-block;
height: ${height * scale}px;
width: ${width * scale}px;
transform: translate(${left * scale}px, ${top * scale}px);
`;
})
)
.catch(error => {});