|
1 |
| -opencv4nodejs |
| 1 | +opencv4nodejs-prebuilt |
2 | 2 | =============
|
3 | 3 |
|
4 |
| - |
5 |
| - |
6 |
| -[](http://travis-ci.org/justadudewhohacks/opencv4nodejs) |
7 |
| -[](https://ci.appveyor.com/project/justadudewhohacks/opencv4nodejs/branch/master) |
8 |
| -[](https://codecov.io/gh/justadudewhohacks/opencv4nodejs) |
9 |
| -[](https://www.npmjs.com/package/opencv4nodejs) |
10 |
| -[](http://nodejs.org/download/) |
11 |
| -[](https://slack.bri.im/) |
12 |
| - |
13 |
| -**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.** |
14 |
| - |
15 |
| -**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"><b>contribution guide</b>.** |
16 |
| - |
17 |
| -* **[Examples](#examples)** |
18 |
| -* **[How to install](#how-to-install)** |
19 |
| -* **[Usage with Docker](#usage-with-docker)** |
20 |
| -* **[Usage with Electron](#usage-with-electron)** |
21 |
| -* **[Usage with NW.js](#usage-with-nwjs)** |
22 |
| -* **[Quick Start](#quick-start)** |
23 |
| -* **[Async API](#async-api)** |
24 |
| -* **[With TypeScript](#with-typescript)** |
25 |
| -* **[External Memory Tracking (v4.0.0)](#external-mem-tracking)** |
26 |
| - |
27 |
| -<a name="examples"></a> |
28 |
| - |
29 |
| -# Examples |
30 |
| - |
31 |
| -See <a href="https://github.com/justadudewhohacks/opencv4nodejs/tree/master/examples"><b>examples</b></a> for implementation. |
32 |
| - |
33 |
| -### Face Detection |
34 |
| - |
35 |
| - |
36 |
| - |
37 |
| - |
38 |
| -### Face Recognition with the OpenCV face module |
39 |
| - |
40 |
| -Check out <a href="https://medium.com/@muehler.v/node-js-opencv-for-face-recognition-37fa7cb860e8"><b>Node.js + OpenCV for Face Recognition</b></a>. |
41 |
| - |
42 |
| - |
43 |
| - |
44 |
| -### Face Landmarks with the OpenCV face module |
45 |
| - |
46 |
| - |
47 |
| - |
48 |
| -### Face Recognition with <a href="https://github.com/justadudewhohacks/face-recognition.js"><b>face-recognition.js</b></a> |
49 |
| - |
50 |
| -Check out <a href="https://medium.com/@muehler.v/node-js-face-recognition-js-simple-and-robust-face-recognition-using-deep-learning-ea5ba8e852"><b>Node.js + face-recognition.js : Simple and Robust Face Recognition using Deep Learning</b></a>. |
51 |
| - |
52 |
| -[](https://www.youtube.com/watch?v=ArcFHpX-usQ "Nodejs Face Recognition using face-recognition.js and opencv4nodejs") |
53 |
| - |
54 |
| -### Hand Gesture Recognition |
55 |
| -Check out <a href="https://medium.com/@muehler.v/simple-hand-gesture-recognition-using-opencv-and-javascript-eb3d6ced28a0"><b>Simple Hand Gesture Recognition using OpenCV and JavaScript</b></a>. |
56 |
| - |
57 |
| - |
58 |
| - |
59 |
| -### Object Recognition with Deep Neural Networks |
60 |
| -Check out <a href="https://medium.com/@muehler.v/node-js-meets-opencvs-deep-neural-networks-fun-with-tensorflow-and-caffe-ff8d52a0f072"><b>Node.js meets OpenCV’s Deep Neural Networks — Fun with Tensorflow and Caffe</b></a>. |
61 |
| - |
62 |
| -#### Tensorflow Inception |
63 |
| - |
64 |
| - |
65 |
| - |
66 |
| - |
67 |
| - |
68 |
| - |
69 |
| -#### Single Shot Multibox Detector with COCO |
70 |
| - |
71 |
| - |
72 |
| - |
73 |
| - |
74 |
| -### Machine Learning |
75 |
| -Check out <a href="https://medium.com/@muehler.v/machine-learning-with-opencv-and-javascript-part-1-recognizing-handwritten-letters-using-hog-and-88719b70efaa"><b>Machine Learning with OpenCV and JavaScript: Recognizing Handwritten Letters using HOG and SVM</b></a>. |
76 |
| - |
77 |
| - |
78 |
| - |
79 |
| -### Object Tracking |
80 |
| - |
81 |
| - |
82 |
| - |
83 |
| - |
84 |
| -### Feature Matching |
85 |
| - |
86 |
| - |
87 |
| - |
88 |
| -### Image Histogram |
89 |
| - |
90 |
| - |
91 |
| - |
92 |
| - |
93 |
| -<a name="how-to-install"></a> |
94 |
| - |
95 |
| -# How to install |
96 |
| - |
97 |
| -``` bash |
98 |
| -npm install --save opencv4nodejs |
99 |
| -``` |
100 |
| - |
101 |
| -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. |
102 |
| - |
103 |
| -**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'"!** |
104 |
| - |
105 |
| -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: |
106 |
| - |
107 |
| -``` bash |
108 |
| -npm install --global windows-build-tools |
109 |
| -``` |
110 |
| - |
111 |
| -## Installing OpenCV Manually |
112 |
| - |
113 |
| -Setting up OpenCV on your own will require you to set an environment variable to prevent the auto build script to run: |
114 |
| - |
115 |
| -``` bash |
116 |
| -# linux and osx: |
117 |
| -export OPENCV4NODEJS_DISABLE_AUTOBUILD=1 |
118 |
| -# on windows: |
119 |
| -set OPENCV4NODEJS_DISABLE_AUTOBUILD=1 |
120 |
| -``` |
121 |
| - |
122 |
| -### Windows |
123 |
| - |
124 |
| -You can install any of the OpenCV 3 or OpenCV 4 <a href="https://github.com/opencv/opencv/releases/"><b>releases</b></a> manually or via the [Chocolatey](https://chocolatey.org/) package manager: |
125 |
| - |
126 |
| -``` bash |
127 |
| -# to install OpenCV 4.1.0 |
128 |
| -choco install OpenCV -y -version 4.1.0 |
129 |
| -``` |
130 |
| - |
131 |
| -Note, this will come without contrib modules. To install OpenCV under windows with contrib modules you have to build the library from source or you can use the auto build script. |
132 |
| - |
133 |
| -Before installing opencv4nodejs with an own installation of OpenCV you need to expose the following environment variables: |
134 |
| -- *OPENCV_INCLUDE_DIR* pointing to the directory with the subfolder *opencv2* containing the header files |
135 |
| -- *OPENCV_LIB_DIR* pointing to the lib directory containing the OpenCV .lib files |
136 |
| - |
137 |
| -Also you will need to add the OpenCV binaries to your system path: |
138 |
| -- add an environment variable *OPENCV_BIN_DIR* pointing to the binary directory containing the OpenCV .dll files |
139 |
| -- append `;%OPENCV_BIN_DIR%;` to your system path variable |
140 |
| - |
141 |
| -Note: Restart your current console session after making changes to your environment. |
142 |
| - |
143 |
| -### MacOSX |
144 |
| - |
145 |
| -Under OSX we can simply install OpenCV via brew: |
146 |
| - |
147 |
| -``` bash |
148 |
| -brew update |
149 |
| -brew install opencv@4 |
150 |
| -brew link --force opencv@4 |
151 |
| -``` |
152 |
| - |
153 |
| -### Linux |
154 |
| - |
155 |
| -Under Linux we have to build OpenCV from source manually or using the auto build script. |
156 |
| - |
157 |
| -## Installing OpenCV via Auto Build Script |
158 |
| - |
159 |
| -The auto build script comes in form of the [opencv-build](https://github.com/justadudewhohacks/npm-opencv-build) npm package, which will run by default when installing opencv4nodejs. The script requires you to have git and a recent version of cmake installed. |
160 |
| - |
161 |
| -### Auto Build Flags |
162 |
| - |
163 |
| -You can customize the autobuild flags using *OPENCV4NODEJS_AUTOBUILD_FLAGS=<flags>*. |
164 |
| -Flags must be space-separated. |
165 |
| - |
166 |
| -This is an advanced customization and you should have knowledge regarding the OpenCV compilation flags. Flags added by default are listed [here](https://github.com/justadudewhohacks/npm-opencv-build/blob/master/src/constants.ts#L44-L82). |
167 |
| - |
168 |
| -### Installing a Specific Version of OpenCV |
169 |
| - |
170 |
| -You can specify the Version of OpenCV you want to install via the script by setting an environment variable: |
171 |
| -`export OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION=4.1.0` |
172 |
| - |
173 |
| -### Installing only a Subset of OpenCV modules |
174 |
| - |
175 |
| -If you only want to build a subset of the OpenCV modules you can pass the *-DBUILD_LIST* cmake flag via the *OPENCV4NODEJS_AUTOBUILD_FLAGS* environment variable. For example `export OPENCV4NODEJS_AUTOBUILD_FLAGS=-DBUILD_LIST=dnn` will build only modules required for `dnn` and reduces the size and compilation time of the OpenCV package. |
176 |
| - |
177 |
| -## Configuring Environments via package.json |
178 |
| - |
179 |
| -It's possible to specify build environment variables by inserting them into the `package.json` as follows: |
180 |
| - |
181 |
| -```json |
182 |
| -{ |
183 |
| - "name": "my-project", |
184 |
| - "version": "0.0.0", |
185 |
| - "dependencies": { |
186 |
| - "opencv4nodejs": "^X.X.X" |
187 |
| - }, |
188 |
| - "opencv4nodejs": { |
189 |
| - "disableAutoBuild": 1, |
190 |
| - "opencvIncludeDir": "C:\\tools\\opencv\\build\\include", |
191 |
| - "opencvLibDir": "C:\\tools\\opencv\\build\\x64\\vc14\\lib", |
192 |
| - "opencvBinDir": "C:\\tools\\opencv\\build\\x64\\vc14\\bin" |
193 |
| - } |
194 |
| -} |
195 |
| -``` |
196 |
| - |
197 |
| -The following environment variables can be passed: |
198 |
| - |
199 |
| -- autoBuildBuildCuda |
200 |
| -- autoBuildFlags |
201 |
| -- autoBuildOpencvVersion |
202 |
| -- autoBuildWithoutContrib |
203 |
| -- disableAutoBuild |
204 |
| -- opencvIncludeDir |
205 |
| -- opencvLibDir |
206 |
| -- opencvBinDir |
207 |
| - |
208 |
| -## Disabeling installation of prebuilt OpenCV |
209 |
| - |
210 |
| -By default opencv4nodejs-prebuilt will install a prebuilt version of OpenCV for the current platform via @nut-tree/opencv-build-(win32/linux/darwin). |
211 |
| -If you want to disable this behaviour (to e.g. provide your own OpenCV build), set the following environment variable: |
212 |
| - |
213 |
| -``` bash |
214 |
| -# linux and osx: |
215 |
| -export OPENCV4NODEJS_PREBUILT_SKIP_DEPENDENCIES=1 |
216 |
| -# on windows: |
217 |
| -set OPENCV4NODEJS_PREBUILT_SKIP_DEPENDENCIES=1 |
218 |
| -``` |
| 4 | +**opencv4nodejs-prebuilt ships opinionated, pre-compiled bindings for OpenCV** |
0 commit comments