Skip to content

Instantly share code, notes, and snippets.

@p01
Last active August 25, 2022 18:57
Show Gist options
  • Save p01/8a690f100259844fe28c3e10f9d2818a to your computer and use it in GitHub Desktop.
Save p01/8a690f100259844fe28c3e10f9d2818a to your computer and use it in GitHub Desktop.
Face detection in 280 bytes

Face detection in 280 bytes by p01

Tweet sized version of https://xem.github.io/miniFaceDetection/

Requires Chrome + chrome://flags/#enable-experimental-web-platform-features To enable fast mode / multiple faces: FaceDetector({fastMode: true, maxDetectedFaces: 2})

For more Audio Visual projects, check www.p01.org

<canvas id=a><video id=v><svg onload="navigator.getUserMedia({video:1},n=m=>{v.src=top.URL.createObjectURL(m);setInterval(async(c=a.getContext`2d`)=>{c.drawImage(v,0,0,208,150);for(i of await new FaceDetector().detect(a))with(i.boundingBox)c.strokeRect(x,y,width,height)},9)},n)">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment