GithubHelp home page GithubHelp logo

justadudewhohacks / opencv4nodejs Goto Github PK

View Code? Open in Web Editor NEW
4.9K 136.0 806.0 35.91 MB

Nodejs bindings to OpenCV 3 and OpenCV 4

License: MIT License

Python 0.41% C++ 57.50% JavaScript 32.97% Shell 0.11% TypeScript 8.72% Dockerfile 0.06% C 0.23%
nodejs opencv face-detection javascript async node cv typescript

opencv4nodejs's People

Contributors

asilvas avatar bookjan avatar btsimonh avatar dennisssdev avatar dependabot[bot] avatar developer239 avatar dsanders11 avatar dusterthefirst avatar eek avatar foxxyz avatar garfonso avatar glentiki avatar grassias avatar justadudewhohacks avatar legraphista avatar leon-sam avatar lolikung avatar lummish avatar mischa1610 avatar mstallmo avatar mstegmann-avarteq avatar nicholasc avatar oyyd avatar pchmelar avatar piercus avatar plarsson avatar raphaelbarreto avatar skellla avatar smithpeder avatar tylee-binaryvr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencv4nodejs's Issues

Doesn't gyp build with yarn

A yarn build with gyp doesn't work with this package. It works with npm however. I've replaced my home dir in traceback with /project/path below:

error /project/path/node_modules/opencv4nodejs: Command failed.
Exit code: 7
Command: node-gyp rebuild
Arguments: 
Directory: /project/path/node_modules/opencv4nodejs
Output:
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: Cannot find module 'har-validator'
gyp ERR! stack     at Function.Module._resolveFilename (module.js:489:15)
gyp ERR! stack     at Function.Module._load (module.js:439:25)
gyp ERR! stack     at Module.require (module.js:517:17)
gyp ERR! stack     at require (internal/module.js:11:18)
gyp ERR! stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/lib/har.js:5:16)
gyp ERR! stack     at Module._compile (module.js:573:30)
gyp ERR! stack     at Object.Module._extensions..js (module.js:584:10)
gyp ERR! stack     at Module.load (module.js:507:32)
gyp ERR! stack     at tryModuleLoad (module.js:470:12)
gyp ERR! stack     at Function.Module._load (module.js:462:3)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /project/path/node_modules/opencv4nodejs
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2

Build error

Hi there,
on WIN10, I've installed OpenCV 3.3.1 in:

"C:\tools\opencv"

Thus I have:

  • OPENCV_DIR=C:\tools\opencv\build
  • OPENCV_INCLUDE_DIR=C:\tools\opencv\build\include
  • OPENCV_LIB_DIR=C:\tools\opencv\build\x64\vc14\lib

as well in PATH:

  • %OPENCV_DIR%\lib
  • %OPENCV_DIR%\bin

when compiling from source:

I get this error:

imgproc.obj : error LNK2001: unresolved external symbol "void __cdecl cv::Canny(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,double,double,bool)" (?Canny@cv@@YAXAEBV_InputArray@1@0AEBV_OutputArray@1@NN_N@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
SVM.obj : error LNK2001: unresolved external symbol "public: static struct cv::Ptr cdecl cv::ml::SVM::load(class cv::String const &)" (?load@SVM@ml@cv@@sa?AU?$Ptr@VSVM@ml@cv@@@3@AEBVString@3@@z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "class cv::Mat cdecl cv::dnn::experimental_dnn_v2::blobFromImages(class std::vector<class cv::Mat,class std::allocator > const &,double,class cv::Size,class cv::Scalar const &,bool,bool)" (?blobFromImages@experimental_dnn_v2@dnn@cv@@ya?AVMat@3@AEBV?$vector@VMat@cv@@v?$allocator@VMat@cv@@@std@@@std@@NV?$Size
@h@3@AEBV?$Scalar
@n@3@_N3@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "class cv::dnn::experimental_dnn_v2::Net __cdecl cv::dnn::experimental_dnn_v2::readNetFromTensorflow(class cv::String const &,class cv::String const &)" (?readNetFromTensorflow@experimental_dnn_v2@dnn@cv@@ya?AVNet@123@AEBVString@3@0@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "public: bool __cdecl cv::dnn::experimental_dnn_v2::Net::empty(void)const " (?empty@Net@experimental_dnn_v2@dnn@cv@@QEBA_NXZ) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::dnn::experimental_dnn_v2::Net::~Net(void)" (??1Net@experimental_dnn_v2@dnn@cv@@qeaa@XZ) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "public: cdecl cv::dnn::experimental_dnn_v2::Net::Net(void)" (??0Net@experimental_dnn_v2@dnn@cv@@qeaa@XZ) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "class cv::Mat cdecl cv::dnn::experimental_dnn_v2::blobFromImage(class cv::Mat const &,double,class cv::Size const &,class cv::Scalar const &,bool,bool)" (?blobFromImage@experimental_dnn_v2@dnn@cv@@ya?AVMat@3@AEBV43@NAEBV?$Size
@h@3@AEBV?$Scalar
@n@3@_N3@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
dnn.obj : error LNK2001: unresolved external symbol "class cv::dnn::experimental_dnn_v2::Net __cdecl cv::dnn::experimental_dnn_v2::readNetFromCaffe(class cv::String const &,class cv::String const &)" (?readNetFromCaffe@experimental_dnn_v2@dnn@cv@@ya?AVNet@123@AEBVString@3@0@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
Net.obj : error LNK2001: unresolved external symbol "public: void __cdecl cv::dnn::experimental_dnn_v2::Net::setInput(class cv::Mat const &,class cv::String const &)" (?setInput@Net@experimental_dnn_v2@dnn@cv@@QEAAXAEBVMat@4@AEBVString@4@@z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
Net.obj : error LNK2001: unresolved external symbol "public: class cv::Mat __cdecl cv::dnn::experimental_dnn_v2::Net::forward(class cv::String const &)" (?forward@Net@experimental_dnn_v2@dnn@cv@@qeaa?AVMat@4@AEBVString@4@@z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
descriptorMatching.obj : error LNK2001: unresolved external symbol "public: static struct cv::Ptr __cdecl cv::DescriptorMatcher::create(int)" (?create@DescriptorMatcher@cv@@sa?AU?$Ptr@VDescriptorMatcher@cv@@@2@H@Z) [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
C:\Dev\opencv4nodejs\build\Release\opencv4nodejs.node : fatal error LNK1120: 12 unresolved externals [C:\Dev\opencv4nodejs\build\opencv4nodejs.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)

Do you know why this is the case?
Your help is highly appreciated.

Thanks

SimpleBlobDetector

It would be awesome to have bindings for SimpleBlobDetector. This is the kind of higher level object that allows a variety of opportunities.

Thanks for your great work!

Performance issues

I'm using opencv4nodejs to perform face detection in a webcam feed. My early tests show rather poor performance. I'm getting 6-7 frames per second.

I was hoping that, by using OpenCV, I would get much better performance than JavaScript-based solutions such as clmtracker. It turns out that clmtracker is much faster (but not as accurate).

I looked at Chrome's performance monitor and I can see that OpenCV is taking anywhere between 100ms to 150ms to perform detection. This does not seem right. As a comparison, when I run FaceOSC on the same computer, I get a steady 60FPS.

Obviously, my code is not optimized but, as the performance monitor tells me, the bottleneck is outside JavaScript's purview.

Should I be expecting better performance? If not, I'll have to turn to another solution.

Failed to locate: "CL.exe"

Sorry to bother you again, but now I've installed the Windows 8.1 (and 10) SDK and now I get this error:
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\Garfield100\AppData\Roaming\npm\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
Do I need to install something else too?

imread vs fs.readFile + new cv.Mat(buffer..

Hi, could you please direct me, how to determine correct constant to use in Mat constructor?

In readme there is an example:

const matFromArray = new cv.Mat(new Buffer.from(charData), rows, cols, cv.CV_8UC3);

in my case I has a buffer with PNG, but I don't know its parameters, only size.

When I save it to the file with fs.writeFile and then read it into matrix with imread, everything is ok.
(I am doing 'norm' with another Mat and it works)

But I cant put this buffer directly into matrix correctly, if I do
new cv.Mat(buffer, rows, cols);
without third parameter, I cant later use it in norm, getting this error

OpenCV Error: Assertion failed (_src1.sameSize(_src2) && _src1.type() == _src2.type()) in norm, file /home/gor/opencv-master/modules/core/src/stat.cpp, line 3628

I used to get this error before in node-opencv + OpenCV v2.4.9
but it happened in both cases, with cv.readImage(path) and cv.readImage(buffer)

With your module imread works fine.
Is there any way to extract from imread and reuse its PNG channels and type detector?
I cant perform excessive read/write operations to file system, because it's too slow in my case
(I generate and compare millions of PNG buffers runtime)

I found no implementation for OpenCV Mat methods such as size(), type(), channels(), depth() in your module, is there some way to use them?
I suspect there is no good way to determine a constant I am looking for without this methods?

Using minimum or maximum size with detectMultiScale() causes crash

I'm trying to define minimum and maximum sizes to use with detectMultiScale() but as soon as I do, I get a crash.

This works:

const faceClassifier = new cv.CascadeClassifier(cv.HAAR_FRONTALFACE_DEFAULT);
faceClassifier.detectMultiScale(frame);

This does not:

const faceClassifier = new cv.CascadeClassifier(cv.HAAR_FRONTALFACE_DEFAULT);
faceClassifier.detectMultiScale(frame, 1.1, 3, 0, new Size(100, 100));

Support for OSX

It would be nice to be able to npm install on a Mac. Currently when I try I get this error:

node_modules/opencv4nodejs/lib/utils.js:91

...

Error: no valid '.so' files found in in OPENCV_LIB_DIR ('/usr/local/lib')

in looking at the code it's due to libSuffix not recognizing the .dylib file extension of OSX:

const libSuffix = process.platform === 'win32' ? '.lib' : '.so';

A issue about resize method

I resized a image with code:

image = image.resize(92, 122);
console.log(image.rows, image.cols);

But what I got is:

92 92

installation issue

Hello there.
I am getting below issue while installing opencv4nodejs
I have installed node-gyp and windows-build-tools and I have set the env variables too.
the issue is->

C:\Windows\System32>npm install opencv4nodejs

[email protected] install C:\Windows\System32\node_modules\opencv4nodejs
node-gyp rebuild

C:\Windows\System32\node_modules\opencv4nodejs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp: binding.gyp not found (cwd: C:\Windows\System32\node_modules\opencv4nodejs) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\System32\node_modules\opencv4nodejs
gyp ERR! node -v v6.11.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
npm WARN System32 No description
npm WARN System32 No repository field.
npm WARN System32 No README data
npm WARN System32 No license field.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "opencv4nodejs"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the opencv4nodejs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs opencv4nodejs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls opencv4nodejs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\System32\npm-debug.log

C:\Windows\System32>

Read image from base64 buffer

Hi,
is there an API to read an image from a base64 buffer instead of a file path?

e.g.

cv.readImage(new Buffer(data, 'base64'), (err, img) => { })

NPM install scripts can't handle spaces in folder names on MacOS

Hi,

Been trying to install this NPM package for the last day and was struggling. Build kept failing with reference to a missing folder for "macro-inferno". Eventually moved the project to a path without spaces and now it works. Suggest either adding support for spaces or added a note in the readme.

Cheers,
Luke

Face recognizer

Hello justadudewhohacks,

I am using this library for quite some time now. First of all thanks for setting this up and for all the work you have put into this, this is a very great project! It is nice to see, that there are constantly new features implemented here.

I would like to suggest the face recognition module (Facerecognizers Eigen, Fisher and LBPH), which are available in opencv contrib.

Thanks alot!

cv.MultiTracker is not a constructor

I am getting the following error when trying to use the MultiTracker

const trackers = new cv.MultiTracker();
                 ^
TypeError: cv.MultiTracker is not a constructor

I am on Node 8.4.0, with OpenCV 3.3.1. If I do cv.version inside Node I get:

{ "major": 3, "minor": 3 }

So it looks like it is picking up the correct version etc...

Looking at the unit tests etc... this is the correct way to do things, but I can't see what I'm doing wrong?!

edit: it just dawned on me to run the tests. It says compiled without tracking next to the tracking tests - how do I compile with tracking?!

build link error

os: win10 x64
node version: node 7.9.0 x64
opencv version: 3.3.1 x64

opencv4nodejs.obj : error LNK2001: unresolved external symbol "public: static void __cdecl Dnn::Init(class v8::Local)" (?Init@Dnn@@saxv?$Local@VObject@v8@@@v8@@@z) [C:\Users\Phil\WebstormProjects\untitled1\node_modules\ope
ncv4nodejs\build\opencv4nodejs.vcxproj]
C:\Users\Phil\WebstormProjects\untitled1\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node : fatal error LNK11
20: 1 unresolved externals [C:\Users\Phil\WebstormProjects\untitled1\node_modules\opencv4nodejs\build\opencv4nodejs.vcxp
roj]

Project insight!

Hey yo! I've been looking into several libraries to go for my next project, and I believe this one should do the trick. But I'm new in opencv and computer vision in general, so it would be awesome to get some advice if you don't mind.

I'm looking to detect the result of a roulette using video. Determining what number did the ball fell. I've been looking into your examples to build upon them, but it would be great to get some insight from you if you don't mind.

Thanks!

"npm run electron-rebuild" has errors.

I already installed opencv3.3.0_3

npm install --save electron-rebuild

this command has no errors.

but when I run the

npm run electron-rebuild

I got this error.

npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "electron-rebuild"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0

npm ERR! missing script: electron-rebuild
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/user/.npm/_logs/2017-09-08T19_20_49_789Z-debug.log
users-iMac-5:opencv4nodejs user$ npm run electron-rebuild
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "electron-rebuild"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0

npm ERR! missing script: electron-rebuild
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/user/.npm/_logs/2017-09-08T19_21_16_440Z-debug.log

HOGDescriptor::detectMultiScale

It would be terrific to have bindings for HOGDescriptor::setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()) and HOGDescriptor::detectMultiScale. This is awesome for pedestrian detection.

Many thanks for your great work!

imwriteAsync : callback error seems not working...

Hi
I'm not absolutely sure but it seems that Error null is returned even if there is a writing issue (I've tested by trying to write an image in a non existant folder).
Thanks again for you great work!

Installation: staticlib folder not found

So I've set up the environment variables and all but now I get another error:

Error: ENOENT: no such file or directory, scandir 'D:\opencv\build\x64\vc14\staticlib'

I've googled a bit and it seems like version 3.3.0 of opencv (the one I have) comes without said folder.
I've seen people talking about recompiling and static linkage stuff but I have no idea what that means or how to use c++. What should I do?

VideoWriter

Will there be a wrapper for cv::VideoWriter?

can you enable parallel build?

I think when compile the package will take at least 1-3 minutes. hope could find some way to accelerate the compilation process.

installation issue from manual build of opencv

hello there.
I have manually build the opencv from source.
the build went successfully

I installed windows-build-tools which also installed python with itself

then I installed node-gyp

all installation were successful

i set all variable for python and opencv

and I am getting problem while installing the opencv4nodejs
as following

C:\Users\advik>npm install -g opencv4nodejs

[email protected] install C:\Users\advik\AppData\Roaming\npm\node_modules\opencv4nodejs
node-gyp rebuild

C:\Users\advik\AppData\Roaming\npm\node_modules\opencv4nodejs>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\advik.windows-build-tools\python27", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\advik\AppData\Roaming\npm\node_modules\opencv4nodejs
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\advik\AppData\Roaming\npm-cache_logs\2017-12-02T08_55_47_024Z-debug.log

C:\Users\advik>

[Windows 10] Unable to require opencv4nodejs - Error: The specified module could not be found.

OS: Windows 10
NodeJS: v9.2.0
NPM: 5.5.1
node-gyp: [email protected]
[email protected]
OpenCV: opencv-3.3.1-vc14

The Build was done, with some warnings, but the following error was thrown when I tried to run the examples or when I tried to do a require:

const cv = require('opencv4nodejs');

$ node index.js
module.js:670
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Users\myUser\opencv4nodejs\build\Release\opencv4nodejs.node
    at Object.Module._extensions..node (module.js:670:18)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\muUser\opencv4nodejs\index.js:1:74)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)

Opencv4nodejs compiled without face module

Hi again,
I've been trying out the face recognition examples, but I get this error.

Opencv4nodejs compiled without face module

I have compiled manually OpenCV 3.3.1 including OpenCV Contrib 3 and the compilation was successful.

I've the follwoing system environment varibales:
OPENCV_DIR=C:\tools\opencv\build\bin\Release - Contains all dlls including opencv_face331.dll
OPENCV_LIB_DIR=C:\tools\opencv\build\lib\Release - Contains all libs including opencv_face331.lib
OPENCV_INCLUDE_DIR=C:\tools\opencv\build\include - Origingal includes folder from the downloaded OpenCV zip. It doesn't contain face subfolder.

I must admit I don't quite understand the purpose of the include dir and I assume the problem lies in that.

For example, the folder (1) C:\tools\opencv\build\modules contains all cpp files including the face subfolder and it's cpp files. The folder (2) C:\tools\opencv_contrib-3.3.1\modules contains all contrib cpp files. Both (1) and (2) were used during my manual compilation. But as I said, I'm not sure what is the purpose of the include folder.

Anyways, do you know if this error is related to the INCLUDE folder or why the face module is not included?

Error installing on MacOS 10.12.6

Made a new folder, open in terminal, run npm install opencv4nodejs and throw all this and at the end exit code 1.

This is the output from terminal.

A lot of errors like this ⬇️
../cc/modules/tracking/MultiTracker.cc:82:20: warning: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
for (int i = 0; i < rects.size(); i++) {
~ ^ ~~~~~~~~~~~~
In file included from ../cc/modules/tracking/MultiTracker.cc:3:
In file included from ../cc/modules/tracking/MultiTracker.h:2:
In file included from /usr/local/include/opencv2/tracking.hpp:304:
In file included from /usr/local/include/opencv2/tracking/tracker.hpp:45:
In file included from /usr/local/include/opencv2/core.hpp:54:
In file included from /usr/local/include/opencv2/core/base.hpp:58:
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1037:
/usr/local/include/opencv2/core/ptr.inl.hpp:121:5: error: cannot initialize a member subobject of type 'cv::Tracker *' with an lvalue of type 'const char *'
stored(p)
^ ~
../cc/modules/tracking/MultiTracker.cc:37:63: note: in instantiation of function template specialization 'cv::Ptrcv::Tracker::Ptr' requested here
bool ret = FF_UNWRAP(info.This(), MultiTracker)->tracker.add("MIL", image, boundingBox);
^
3 warnings and 1 error generated.
make: *** [Release/obj.target/opencv4nodejs/cc/modules/tracking/MultiTracker.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/carlos/node_modules/opencv4nodejs
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Users/carlos/package.json'
npm WARN carlos No description
npm WARN carlos No repository field.
npm WARN carlos No README data
npm WARN carlos No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/carlos/.npm/_logs/2017-10-24T16_15_13_304Z-debug.log

This is the output in log file.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'opencv4nodejs' ]
2 info using [email protected]
3 info using [email protected]
4 verbose config Skipping project config: /Users/carlos/.npmrc. (matches userconfig)
5 verbose npm-session da2d7100235fd4e3
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 http fetch GET 200 https://registry.npmjs.org/opencv4nodejs 3889ms
9 silly pacote tag manifest for opencv4nodejs@latest fetched in 3929ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly install loadAllDepsIntoIdealTree
14 silly resolveWithNewModule [email protected] checking installable status
15 http fetch GET 304 https://registry.npmjs.org/macro-inferno 692ms (from cache)
16 silly pacote range manifest for macro-inferno@^0.2.1 fetched in 696ms
17 silly resolveWithNewModule [email protected] checking installable status
18 http fetch GET 200 https://registry.npmjs.org/nan 1955ms
19 silly pacote range manifest for nan@^2.7.0 fetched in 1958ms
20 silly resolveWithNewModule [email protected] checking installable status
21 silly currentTree carlos
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├─┬ [email protected]
21 silly currentTree │ └── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree ├── [email protected]
21 silly currentTree └── [email protected]
22 silly idealTree carlos
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├─┬ [email protected]
22 silly idealTree │ └── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree ├── [email protected]
22 silly idealTree └── [email protected]
23 silly install generateActionsToTake
24 silly diffTrees action count 3
25 silly diffTrees add [email protected]
26 silly diffTrees add [email protected]
27 silly diffTrees add [email protected]
28 silly decomposeActions action count 24
29 silly decomposeActions fetch [email protected]
30 silly decomposeActions extract [email protected]
31 silly decomposeActions preinstall [email protected]
32 silly decomposeActions build [email protected]
33 silly decomposeActions install [email protected]
34 silly decomposeActions postinstall [email protected]
35 silly decomposeActions finalize [email protected]
36 silly decomposeActions refresh-package-json [email protected]
37 silly decomposeActions fetch [email protected]
38 silly decomposeActions extract [email protected]
39 silly decomposeActions preinstall [email protected]
40 silly decomposeActions build [email protected]
41 silly decomposeActions install [email protected]
42 silly decomposeActions postinstall [email protected]
43 silly decomposeActions finalize [email protected]
44 silly decomposeActions refresh-package-json [email protected]
45 silly decomposeActions fetch [email protected]
46 silly decomposeActions extract [email protected]
47 silly decomposeActions preinstall [email protected]
48 silly decomposeActions build [email protected]
49 silly decomposeActions install [email protected]
50 silly decomposeActions postinstall [email protected]
51 silly decomposeActions finalize [email protected]
52 silly decomposeActions refresh-package-json [email protected]
53 silly install executeActions
54 silly doSerial global-install 24
55 verbose correctMkdir /Users/carlos/.npm/_locks correctMkdir not in flight; initializing
56 verbose lock using /Users/carlos/.npm/_locks/staging-301e76cb75dfd0b8.lock for /Users/carlos/node_modules/.staging
57 silly doParallel extract 24
58 silly extract [email protected]
59 silly extract [email protected]
60 silly extract [email protected]
61 silly doReverseSerial unbuild 24
62 silly doSerial remove 24
63 silly doSerial move 24
64 silly doSerial finalize 24
65 silly finalize /Users/carlos/node_modules/nan
66 silly finalize /Users/carlos/node_modules/macro-inferno
67 silly finalize /Users/carlos/node_modules/opencv4nodejs
68 silly doParallel refresh-package-json 24
69 silly refresh-package-json /Users/carlos/node_modules/nan
70 silly refresh-package-json /Users/carlos/node_modules/macro-inferno
71 silly refresh-package-json /Users/carlos/node_modules/opencv4nodejs
72 silly doParallel preinstall 24
73 silly preinstall [email protected]
74 info lifecycle [email protected]preinstall: [email protected]
75 silly preinstall [email protected]
76 info lifecycle [email protected]
preinstall: [email protected]
77 silly preinstall [email protected]
78 info lifecycle [email protected]preinstall: [email protected]
79 silly doSerial build 24
80 silly build [email protected]
81 info linkStuff [email protected]
82 silly linkStuff [email protected] has /Users/carlos/node_modules as its parent node_modules
83 verbose linkBins [email protected]
84 verbose linkMans [email protected]
85 silly build [email protected]
86 info linkStuff [email protected]
87 silly linkStuff [email protected] has /Users/carlos/node_modules as its parent node_modules
88 verbose linkBins [email protected]
89 verbose linkMans [email protected]
90 silly build [email protected]
91 info linkStuff [email protected]
92 silly linkStuff [email protected] has /Users/carlos/node_modules as its parent node_modules
93 verbose linkBins [email protected]
94 verbose linkMans [email protected]
95 silly doSerial global-link 24
96 silly doParallel update-linked 24
97 silly doSerial install 24
98 silly install [email protected]
99 info lifecycle [email protected]
install: [email protected]
100 silly install [email protected]
101 info lifecycle [email protected]install: [email protected]
102 silly install [email protected]
103 info lifecycle [email protected]
install: [email protected]
104 verbose lifecycle [email protected]install: unsafe-perm in lifecycle true
105 verbose lifecycle [email protected]
install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/carlos/node_modules/opencv4nodejs/node_modules/.bin:/Users/carlos/node_modules/.bin:/usr/local/ant/bin:/usr/local/apache-ant/bin:/Users/carlos/.rvm/gems/ruby-2.4.1/bin:/Users/carlos/.rvm/gems/ruby-2.4.1@global/bin:/Users/carlos/.rvm/rubies/ruby-2.4.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/carlos/.nexustools:/Users/carlos/.rvm/bin:/Users/carlos/.rvm/bin
106 verbose lifecycle [email protected]install: CWD: /Users/carlos/node_modules/opencv4nodejs
107 silly lifecycle [email protected]
install: Args: [ '-c', 'node-gyp rebuild' ]
108 silly lifecycle [email protected]install: Returned: code: 1 signal: null
109 info lifecycle [email protected]
install: Failed to exec install script
110 verbose unlock done using /Users/carlos/.npm/_locks/staging-301e76cb75dfd0b8.lock for /Users/carlos/node_modules/.staging
111 warn enoent ENOENT: no such file or directory, open '/Users/carlos/package.json'
112 verbose enoent This is related to npm not being able to find a file.
113 warn carlos No description
114 warn carlos No repository field.
115 warn carlos No README data
116 warn carlos No license field.
117 verbose stack Error: [email protected] install: node-gyp rebuild
117 verbose stack Exit status 1
117 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
117 verbose stack at emitTwo (events.js:106:13)
117 verbose stack at EventEmitter.emit (events.js:191:7)
117 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
117 verbose stack at emitTwo (events.js:106:13)
117 verbose stack at ChildProcess.emit (events.js:191:7)
117 verbose stack at maybeClose (internal/child_process.js:886:16)
117 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
118 verbose pkgid [email protected]
119 verbose cwd /Users/carlos/Downloads/opencv4nodejs1
120 verbose Darwin 16.7.0
121 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "opencv4nodejs"
122 verbose node v6.10.3
123 verbose npm v5.4.2
124 error code ELIFECYCLE
125 error errno 1
126 error [email protected] install: node-gyp rebuild
126 error Exit status 1
127 error Failed at the [email protected] install script.
127 error This is probably not a problem with npm. There is likely additional logging output above.
128 verbose exit [ 1, true ]

Hope you can help, you have made a great job here and i want to try it.

getAffineTransform support?

Hey there,

It would be really nice if there was built in support for getAffineTransform (which doesn't seem to exist atm) to be used inside the warpAffine method. I will try to fork this project and see if I can add this support myself if I have time, but if anyone can beat me to it, I'd really appreciate it.

If there is already a way to easily do this, let me know.

Thanks!

Where is flip() ?

I can see a transpose() method inside the Mat object but I cannot find the flip() method. It does not seem to be inside the cv object either. Am I looking at the wrong places or is it not implemented?

face module

does this package come with face module or do we have to compile from contrib packages?

facerecogniton fails

hi justdude,
I have tried using your face recognition example1 and worked on face recognition using images from my mobile. i trained facerecognizer with three images for each person and gave a persons image in order to predict , but it fails most of the time predicting wrong person . can u help me out??

How to make min and max (mat) on nodejs

I have an example of a Python
I can not understand how to write it on a nodejs

I wrote a part of the example, but I'm not sure if this is correct

Python

gradX = cv2.Sobel(blackhat, ddepth=cv2.CV_32F, dx=1, dy=0, ksize=-1)
gradX = np.absolute(gradX)
(minVal, maxVal) = (np.min(gradX), np.max(gradX))
gradX = (255 * ((gradX - minVal) / (maxVal - minVal))).astype("uint8")

Nodejs

let gradX = blackhat.sobel(cv.CV_32F,1,0,-1);
gradX = gradX.abs();
let minVal = **???**
let maxVal = **???**

let v1 = gradX.sub(minVal);
let v2 = maxVal.sub(minVal);
let v3 = v1.hDiv(v2);
gradX = v3.mul(255);

warnings during installations

I am getting some warnings while doing a fresh install of opencv4nodejs as following-

c:\users\advik\appdata\roaming\npm\node_modules\opencv4nodejs\cc\ArrayConverters.h(41): warning C4018: '<': signed/unsigned mismatch (compiling source file ..\cc\modules\features2d\detectors\SimpleBlobDetector.cc) [C:\Users\advik\AppData
Roaming\npm\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]

c:\users\advik\appdata\roaming\npm\node_modules\opencv4nodejs\cc\core\Vec.h(44): warning C4018: '<': signed/unsigned mismatch (compiling source file ..\cc\modules\features2d\detectors\SimpleBlobDetector.cc) [C:\Users\advik\AppData\Roaming
\npm\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]

  1. c:\users\advik\appdata\roaming\npm\node_modules\opencv4nodejs\cc\modules\imgproc\contour.cc(159): warning C4700: uninitialized local variable 'parameter' used [C:\Users\advik\AppData\Roaming\npm\node_modules\opencv4nodejs\build\opencv4nod
    ejs.vcxproj]

are those negligible?

getRegion and copyTo issues

i get a frame with videoCapture.

this is my code

let addMat = cv.imread(__dirname + '/assets/images/1_4.png', cv.IMREAD_UNCHANGED);
let mask = cv.imread(__dirname + '/assets/images/1_4.png', 0);
let newFrame = frame.getRegion(new cv.Rect(400, 0, 480, 720)).copy();
let imageROI = newFrame.cvtColor(cv.COLOR_BGR2RGBA).getRegion(new cv.Rect(0, 0, addMat.cols, addMat.rows));
let cpTo = addMat.copyTo(imageROI, mask);

newFrame did not change anything

process.dlopen(...) - Error: The specified module could not be found.

The Error:

module.js:597
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Users\me\Downloads\opencv_test\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\me\Downloads\opencv_test\node_modules\opencv4nodejs\lib\opencv4nodejs.js:7:8)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

The Code I'm trying to execute:

const cv = require('opencv4nodejs');
const template = cv.imread('image.png');

Versions etc ...

node -v
v6.11.4

npm list -g -depth 0
C:\Users\me\AppData\Roaming\npm
`-- [email protected]

npm list -depth 0
C:\Users\me\Downloads\opencv_test
`-- [email protected]

echo %OPENCV_DIR%
C:\opencv

echo %OPENCV_LIB_DIR%
C:\opencv\build\x64\vc14\lib

echo %OPENCV_INCLUDE_DIR%
C:\opencv\build\include

Tried with: opencv-3.3.1-vc14.exe

I tried to npm rebuild already, also I tried to install completly new with the same outcome.
Install looked good to me.

Thanks for any help!

How about the Scene Text Recognition library?

Hi,

Thanks for this library :)

Do you know if you're going to support the Scene Text Recognition any time soon? We need to extract and decode text (or hex numbers) from a webcam picture.

Continuous Face Detection Crash

[Thanks for your awesome work on this library.]

I'm using VideoCapture to detect faces in a webcam feed. If I perform detection a single time, it works fine. However, if I try to call my detectFaces() function in a loop (with setInterval), it crashes my host environment (NW.js, similar to Electron).

Do I need to do any sort of cleanup after each round of detection? Here is the code I'm using:

detectFaces() {

  if (!this.vCap) this.vCap = new cv.VideoCapture(0);

  // Grab frame and perform detection
  const frame = this.vCap.read().bgrToGray();
  const faceClassifier = new cv.CascadeClassifier(cv.HAAR_FRONTALFACE_DEFAULT);
  const faceResult = faceClassifier.detectMultiScale(frame);

  if (!faceResult.objects.length) return;

  const sortByNumDetections = result => result.numDetections
    .map((num, idx) => ({ num, idx }))
    .sort(((n0, n1) => n1.num - n0.num))
    .map(({ idx }) => idx);

  // get best result
  const faceRect = faceResult.objects[sortByNumDetections(faceResult)[0]];

  // draw face detection
  const blue = new cv.Vec(255, 0, 0);
  const thickness = 2;
  frame.drawRectangle(
    new cv.Point(faceRect.x, faceRect.y),
    new cv.Point(faceRect.x + faceRect.width, faceRect.y + faceRect.height),
    blue,
    cv.LINE_8,
    thickness
  );

  // create new ImageData from raw mat data
  const imgData = new ImageData(
    new Uint8ClampedArray(frame.cvtColor(cv.COLOR_GRAY2RGBA).getData()),
    frame.cols,
    frame.rows
  );

  // set canvas dimensions
  const canvas = document.getElementById('capture');
  canvas.height = frame.rows;
  canvas.width = frame.cols;

  // set image data
  canvas.getContext('2d').putImageData(imgData, 0, 0);

}

Obviously, this is not optimized code but I just want to get things rolling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.