opencv4nodejs
=============

[](http://travis-ci.org/justadudewhohacks/opencv4nodejs)
[](https://ci.appveyor.com/project/justadudewhohacks/opencv4nodejs/branch/master)
[](https://codecov.io/gh/justadudewhohacks/opencv4nodejs)
[](https://www.npmjs.com/package/opencv4nodejs)
[](http://nodejs.org/download/)
[](https://slack.bri.im/)
**opencv4nodejs allows you to use the native OpenCV library in nodejs. Besides a synchronous API the package provides an asynchronous API, which allows you to build non-blocking and multithreaded computer vision tasks. opencv4nodejs supports OpenCV 3 and OpenCV 4.**
**The ultimate goal of this project is to provide a comprehensive collection of nodejs bindings to the API of OpenCV and the OpenCV-contrib modules. To get an overview of the currently implemented bindings, have a look at the [type declarations](https://github.com/justadudewhohacks/opencv4nodejs/tree/master/lib/typings) of this package. Furthermore, contribution is highly appreciated. If you want to add missing bindings check out the <a href="https://github.com/justadudewhohacks/opencv4nodejs/tree/master/CONTRIBUTING.md" rel='nofollow' onclick='return false;'><b>contribution guide</b>.**
* **[Examples](#examples)**
* **[How to install](#how-to-install)**
* **[Usage with Docker](#usage-with-docker)**
* **[Usage with Electron](#usage-with-electron)**
* **[Usage with NW.js](#usage-with-nwjs)**
* **[Quick Start](#quick-start)**
* **[Async API](#async-api)**
* **[With TypeScript](#with-typescript)**
* **[External Memory Tracking (v4.0.0)](#external-mem-tracking)**
<a name="examples" rel='nofollow' onclick='return false;'></a>
# Examples
See <a href="https://github.com/justadudewhohacks/opencv4nodejs/tree/master/examples" rel='nofollow' onclick='return false;'><b>examples</b></a> for implementation.
### Face Detection


### Face Recognition with the OpenCV face module
Check out <a href="https://medium.com/@muehler.v/node-js-opencv-for-face-recognition-37fa7cb860e8" rel='nofollow' onclick='return false;'><b>Node.js + OpenCV for Face Recognition</b></a>.

### Face Landmarks with the OpenCV face module

### Face Recognition with <a href="https://github.com/justadudewhohacks/face-recognition.js" rel='nofollow' onclick='return false;'><b>face-recognition.js</b></a>
Check out <a href="https://medium.com/@muehler.v/node-js-face-recognition-js-simple-and-robust-face-recognition-using-deep-learning-ea5ba8e852" rel='nofollow' onclick='return false;'><b>Node.js + face-recognition.js : Simple and Robust Face Recognition using Deep Learning</b></a>.
[](https://www.youtube.com/watch?v=ArcFHpX-usQ "Nodejs Face Recognition using face-recognition.js and opencv4nodejs")
### Hand Gesture Recognition
Check out <a href="https://medium.com/@muehler.v/simple-hand-gesture-recognition-using-opencv-and-javascript-eb3d6ced28a0" rel='nofollow' onclick='return false;'><b>Simple Hand Gesture Recognition using OpenCV and JavaScript</b></a>.

### Object Recognition with Deep Neural Networks
Check out <a href="https://medium.com/@muehler.v/node-js-meets-opencvs-deep-neural-networks-fun-with-tensorflow-and-caffe-ff8d52a0f072" rel='nofollow' onclick='return false;'><b>Node.js meets OpenCV’s Deep Neural Networks — Fun with Tensorflow and Caffe</b></a>.
#### Tensorflow Inception



#### Single Shot Multibox Detector with COCO


### Machine Learning
Check out <a href="https://medium.com/@muehler.v/machine-learning-with-opencv-and-javascript-part-1-recognizing-handwritten-letters-using-hog-and-88719b70efaa" rel='nofollow' onclick='return false;'><b>Machine Learning with OpenCV and JavaScript: Recognizing Handwritten Letters using HOG and SVM</b></a>.

### Object Tracking


### Feature Matching

### Image Histogram


### Boiler plate for combination of opencv4nodejs, express and websockets.
[opencv4nodejs-express-websockets](https://github.com/Mudassir-23/opencv4nodejs-express-websockets) - Boilerplate express app for getting started on opencv with nodejs and to live stream the video through websockets.
### Automating lights by people detection through classifier
Check out <a href="https://medium.com/softway-blog/automating-lights-with-computer-vision-nodejs-fb9b614b75b2" rel='nofollow' onclick='return false;'><b>Automating lights with Computer Vision & NodeJS</b></a>.

<a name="how-to-install" rel='nofollow' onclick='return false;'></a>
# How to install
``` bash
npm install --save opencv4nodejs
```
Native node modules are built via node-gyp, which already comes with npm by default. However, node-gyp requires you to have python installed. If you are running into node-gyp specific issues have a look at known issues with [node-gyp](https://github.com/nodejs/node-gyp) first.
**Important note:** node-gyp won't handle whitespaces properly, thus make sure, that the path to your project directory does **not contain any whitespaces**. Installing opencv4nodejs under "C:\Program Files\some_dir" or similar will not work and will fail with: "fatal error C1083: Cannot open include file: 'opencv2/core.hpp'"!**
On Windows you will furthermore need Windows Build Tools to compile OpenCV and opencv4nodejs. If you don't have Visual Studio or Windows Build Tools installed, you can easily install the VS2015 build tools:
``` bash
npm install --global windows-build-tools
```
## Installing OpenCV Manually
Setting up OpenCV on your own will require you to set an environment variable to prevent the auto build script to run:
``` bash
# linux and osx:
export OPENCV4NODEJS_DISABLE_AUTOBUILD=1
# on windows:
set OPENCV4NODEJS_DISABLE_AUTOBUILD=1
```
### Windows
You can install any of the OpenCV 3 or OpenCV 4 <a href="https://github.com/opencv/opencv/releases/" rel='nofollow' onclick='return false;'><b>releases</b></a> manuall