← all repositories
mtschirs/js-objectdetect

Haar cascades in a browser tab: object detection without the server round-trip

A pure-JavaScript port of OpenCV's classic object detection, so your webcam stays local.

1.2k stars JavaScript Computer Vision
js-objectdetect
Not currently ranked — collecting fresh signals.
star history

What it does

js-objectdetect runs Viola-Jones object detection entirely in the browser using HTML5 getUserMedia. It detects faces, eyes, mouths, and upper bodies from webcam streams or static images without sending frames to a server. The API wraps a canvas element and returns bounding boxes you can draw over the video feed.

The interesting bit

This is a hand-port of OpenCV’s C++ Haar cascade classifier to JavaScript — not a wrapper around WebAssembly or a cloud API. The README notes it “reimplements” the algorithm, which in 2013 meant wrestling with typed arrays and avoiding the still-nascent WebAssembly path entirely. That choice aged strangely: fast for its era, now likely outpaced by TensorFlow.js or native MediaPipe, but with zero dependencies and no build step required.

Key highlights

  • Ships with pre-trained OpenCV cascades (face, eye, mouth, upper body)
  • Works on static images, video elements, or live webcam streams
  • No server required; frames never leave the browser
  • ~1200 stars suggests it solved a real need in the pre-WebAssembly era
  • Single-file include: <script src="js/objectdetect.js"></script> and go

Caveats

  • Repository appears unmaintained; last meaningful activity looks to be 2013–2014 based on the README’s browser compatibility notes (“works in all modern browsers”)
  • No mention of performance benchmarks or frame rates; “real-time” is claimed but not quantified
  • Haar cascades are generally less accurate than modern deep-learning approaches; the README doesn’t compare accuracy or discuss false positive rates

Verdict

Grab this if you need a zero-dependency, no-build object detection snippet for a quick prototype or an air-gapped environment. Skip it if you want state-of-the-art accuracy or a maintained codebase — MediaPipe and TensorFlow.js have eaten this lunch, and they brought GPU acceleration.

Frequently asked

What is mtschirs/js-objectdetect?
A pure-JavaScript port of OpenCV's classic object detection, so your webcam stays local.
Is js-objectdetect open source?
Yes — mtschirs/js-objectdetect is an open-source project tracked on heatdrop.
What language is js-objectdetect written in?
mtschirs/js-objectdetect is primarily written in JavaScript.
How popular is js-objectdetect?
mtschirs/js-objectdetect has 1.2k stars on GitHub.
Where can I find js-objectdetect?
mtschirs/js-objectdetect is on GitHub at https://github.com/mtschirs/js-objectdetect.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.