Is it possible to use OpenCV or similar library in Javascript?

JavascriptHtmlOpencvArtificial IntelligenceFace Detection

Javascript Problem Overview


Can we use OpenCV from Javascript? Is there such implementation?

Is there any JS libraries that can be used for detecting face elements in the picture or video?

Javascript Solutions


Solution 1 - Javascript

OpenCV has never been ported to JavaScript in its entirety, but individual parts and algorithms have:

  • For face and face element detection (and other parts / objects), you could use js-objectdetect or HAAR.js which are ports of the OpenCV Object Detection based on Haar Feature Cascades.

  • The very first face detection algorithm on the web found in ccv also deserves a mention. Its classifier seems to be less reliable than the one provided by OpenCV though.

  • The headtrackr library used for facetracking might also be of interest since it implements the camshift algorithm also found in OpenCV.

Solution 2 - Javascript

I recommend OpenCVjs. This is javascript OpenCV library.

Solution 3 - Javascript

I don't think there is any way of using openCV in JS other than communicating with a server with openCV on it and doing the processing there.

There is one Face detection algo in JS that I know of: http://badassjs.com/post/1461943420/face-detection-in-javascript-via-html5-canvas

Solution 4 - Javascript

I do not know of a full implementation of OpenCV in Javascript, however a good number of the algorithms from it are implemented in JSFeat which is a Computer Vision library in Javascript.

I believe that it might be possible to compile bits of OpenCV with emscripten, but as far as I know, nobody has done that.

Solution 5 - Javascript

Porting OpenCV to Javascript should be doable using asm.js which can compile C or C++ to Javascript

Another take: OpenCV is ported to Chrome Native Client: http://opencv.org/opencv-ported-to-google-chrome-nacl-and-pnacl.html

Solution 6 - Javascript

Excellent repo for that here: https://github.com/peterbraden/node-opencv Doesn't seem to have full opencv functionality, but has face detection and great support for image streams coming from sources like an ar-drone.

Solution 7 - Javascript

This seems to be very good. http://trackingjs.com/ Have a look.

Solution 8 - Javascript

Concerning your second question clmtrackr looks very promising. It ...

> ... is a javascript library for fitting facial models to faces in videos or images. It currently is an implementation of constrained local models fitted by regularized landmark mean-shift, as described in Jason M. Saragih's paper. clmtrackr tracks a face and outputs the coordinate positions of the face model as an array.

Try out this example to have a look at their model.

Solution 9 - Javascript

In addition to those mentioned, there is another repo for "opencvjs"

https://github.com/blittle/opencvjs

It's a little unclear which of them (if any) are supposed to be canonical

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBohdanView Question on Stackoverflow
Solution 1 - Javascriptle_mView Answer on Stackoverflow
Solution 2 - JavascriptamrocsView Answer on Stackoverflow
Solution 3 - JavascriptcrazyjoeView Answer on Stackoverflow
Solution 4 - JavascriptkybernetikosView Answer on Stackoverflow
Solution 5 - JavascriptMaciej JankowskiView Answer on Stackoverflow
Solution 6 - JavascriptHarrisonView Answer on Stackoverflow
Solution 7 - JavascriptarpoView Answer on Stackoverflow
Solution 8 - JavascriptChristophView Answer on Stackoverflow
Solution 9 - JavascriptcavalcadeView Answer on Stackoverflow