justadudewhohacks/opencv4nodejs

SIFT has been moved to features2d

Peddle opened this issue · 2 comments

I'm not a cpp programmer so I'm not sure what the correct change is here but the SIFT algorithm has been moved from xfeatures2d to features2d (patent expired a few months back).

I had to comment out lines 6 and 10 in the file below to get opencv4nodejs to compile.

#include "SIFTDetector.h"

SIFTDetector::Init(target);

EDIT: I was able to get it to build once making this change but haven't been able to reproduce. The change was likely not enough

In OpenCV 4.4, Replace all "cv::xfeatures2D::SIFT" with CV ::SIFT.

I would like to add on this that module installation still succeeds even after this build error happens, which then prevents it from being loaded later:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node@12/12.20.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/Cellar/node@12/12.20.0/bin/node" "/usr/local/Cellar/node@12/12.20.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd /usr/local/lib/node_modules/opencv4nodejs
gyp ERR! node -v v12.20.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
 
+ opencv4nodejs@5.6.0
added 30 packages from 61 contributors in 217.167s

and then

require require path is /usr/local/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs
require failed to require cv with exception: Error: Cannot find module '/usr/local/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
Require stack:
- /usr/local/lib/node_modules/opencv4nodejs/lib/cv.js
- /usr/local/lib/node_modules/opencv4nodejs/lib/opencv4nodejs.js
- /Users/elf/code/appium-support/build/lib/image-util.js
- /Users/elf/code/appium-support/build/test/image-util-e2e-specs.js
- /Users/elf/code/appium-support/node_modules/gulp-mocha/node_modules/mocha/lib/mocha.js
- /Users/elf/code/appium-support/node_modules/gulp-mocha/node_modules/mocha/lib/cli/one-and-dones.js
- /Users/elf/code/appium-support/node_modules/gulp-mocha/node_modules/mocha/lib/cli/options.js
- /Users/elf/code/appium-support/node_modules/gulp-mocha/node_modules/mocha/bin/mocha
require attempting to add opencv binaries to path
require there is no path environment variable, skipping...