Comments (13)
from opencv4nodejs.
Indeed that was the problem. As mentioned in my first post reporting this issue, let me quote myself:
"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
As you can see this is wrong what is in PATH. To access the opencv_world331.dll, I need to have:
C:\tools\opencv\build\x64\vc14\bin in PATH. As well as to access the opencv_world331.lib, I need to have, C:\tools\opencv\build\x64\vc14\lib in PATH.
Having:
%OPENCV_DIR%\lib
%OPENCV_DIR%\bin
won't do it. So I added explicitly the ......\bin and ....\lib paths in PATH. And the error disappeared.
Thanks for your patience with this siliness of mine :)
You can close this issue.
from opencv4nodejs.
follow the steps-
1)install windows-build-tools first-> for this run the command prompt as a administrator otherwise it won't install windows-build-tools
"npm install --global --production windows-build-tools"
this will install the above package (and python version 2.7.13 at location C:\Users<your username>.windows-build-tools\python27)
2)then install node-gyp ->
"npm install -g node-gyp"
then run this command
npm config set python C:\Users<your username>.windows-build-tools\python27
3)set following 3 variables->
OPENCV_DIR->C:\opencv\sources
OPENCV_INCLUDE_DIR->C:\opencv\build\include
OPENCV_LIB_DIR->C:\opencv\build\x64\vc14\lib
as you have changed location of opencv, therefore above variable path will change according to your installation path of opencv
4)Final step->
type command-
npm install -g opencv4nodejs
I hope, my solution works for you.
Enter those commands without double quotes.
from opencv4nodejs.
It looks like the linker has some wrong method signatures for some lib files. Did you build opencv3.3.1 yourself from source or did you download one of the releases? The problem is probably that there is a mismatc between header files and lib files that you linked. Did you build opencv in debug mode maybe?
from opencv4nodejs.
Are you referring to the opencv-express example? Could you give some more information about the environment, do you run this in a docker container or just on your local machine with express? If you try to require opencv4nodejs from a simple node script does it throw this error as well or is that working?
from opencv4nodejs.
The express server is my code on WIN 10 install (no docker yet), that used to work with previously with:
https://github.com/peterbraden/node-opencv
server.js (express server) -> routes/face-controller.js -> services/face-service.js
(here I have require('opencv4nodejs') statement) previously it was require('opencv')
the error seems to be related to the path:
error: uncaughtException: The specified module could not be found.
\?\C:\Dev\xplorify\xplorify-hello\server\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
For some reason it is prefixing the path with \?\ ... it should be
C:\Dev\xplorify\xplorify-hello\server\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
I placed several console.log statements and it fails inside:
node_modules/opencv4nodejs/lib/opencv4nodejs.js
in the line:
cv = require('../build/Release/opencv4nodejs');
from opencv4nodejs.
As specified here:
https://stackoverflow.com/questions/41253450/error-the-specified-module-could-not-be-found
I used:
http://www.dependencywalker.com/
and opened:
opencv4nodejs.node
And the tool found many unresolved dependencies (see attachment - save export from the tool):
Not sure if this is related to the node version I'm using (9.2)
from opencv4nodejs.
I also tried your electron example:
- git clone https://github.com/justadudewhohacks/opencv-electron.git
- cd opencv-electron
- npm i
- npm start
The app start and when I browe a photo (any PNG or JPG) in the developer tools I can see this error:
C:\Dev\opencv-electron\node_modules\electron\dist\resources\electron.asar\renderer\api\remote.js:234 Uncaught Error: The specified module could not be found.
\?\C:\Dev\opencv-electron\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
Error: The specified module could not be found.
\?\C:\Dev\opencv-electron\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
So ti seems that some referenced lib is missing. But can't figure out which one...
from opencv4nodejs.
If dependency walker tells you about unresolved dependencies, then odds are that the binaries are not found in your path. Did you change your system path to point to the new opencv binary path, e.g. the directory containing the dlls?
Maybe also node9 related, I didn't test with node version 9 yet.
Edit: Could also be that the '../' in the require statement causes issues on win10, maybe youd could try cv = require(path.resolve('../build/Release/opencv4nodejs'));
instead.
from opencv4nodejs.
did you have installed windows-build-tools?
from opencv4nodejs.
@justadudewhohacks I tried require(path.resolve('../build/Release/opencv4nodejs')); and the only diff is in the error message:
error: uncaughtException: Cannot find module 'C:\Dev\xplorify\xplorify-hello\build\Release\opencv4nodejs'
instead of (previously):
error: uncaughtException: The specified module could not be found.
\\?\C:\Dev\xplorify\xplorify-hello\server\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
@akkishay
I do have 'windows-build-tools' installed.
Previously had python via chocolatey installed:
https://chocolatey.org/packages/python2
but I have uninstalled it and did:
"npm install --global --production windows-build-tools"
"npm install -g node-gyp"
However, this didn't make any difference.
The compilation process of opencv4nodejs works or at least doesn't throw any errors. So when I install it with:
npm i opencv4nodejs --save
in my project, the process finishes with these messages:
Finished generating code
opencv4nodejs.vcxproj -> C:\Dev\xplorify\xplorify-hello\server\node_modules\opencv4nodejs\build\Release\\opencv4nodejs.node
opencv4nodejs.vcxproj -> C:\Dev\xplorify\xplorify-hello\server\node_modules\opencv4nodejs\build\Release\opencv4nodejs.pdb (Full PDB)
+ [email protected]
added 3 packages in 205.005s
I also compiled opencv including contrib, following these tutorials:
- https://perso.uclouvain.be/allan.barrea/opencv/cmake_config.html
- https://www.learnopencv.com/install-opencv3-on-windows/
and added the output .dlls in the system PATH.
But no difference.
The only suspcios to me is the fact that Dependency Walker shows OPENCV_WORLD331.DLL is missing (see attachment), besides the KERNELL32 and NODE.EXE missing entries, but for them:
https://stackoverflow.com/questions/36240215/dependency-walker-missing-dlls
says it's normal these are missing as the tool stopped being developed in 2005.
from opencv4nodejs.
This infact is very suspicious to me. And you are absolutely sure that the path to world331.dll is in your system path and that there are no other references to old opencv binaries dangling around in your system path? Dependency walker should not show you that it cant find opencvworld dll.
Edit: If you have Visual Studio set up you can also easily check whether opencv is properly installed independently from nodejs. Simply write a main that includes an opencv header and try to run it.
from opencv4nodejs.
Nice. Thats what I am here for, no problem :D
from opencv4nodejs.
Related Issues (20)
- Cannot find module 'C:\Users\pierr\Desktop\onnxjs\node_modules\opencv4nodejs\build\Release\opencv4nodejs' HOT 2
- Imencode - OpenCV Error: (!image.empty()) in imencode, in file... RPI4 HOT 1
- Correct the state of the `opencv4nodejs` package on the NPM. HOT 5
- canot load opencv4nodejs after install HOT 1
- Cannot find module 'D:\Web\opencv\node_modules\opencv4nodejs\build\Release\opencv4nodejs' HOT 2
- Error: CalcHist - object has no property: ranges HOT 1
- Can't resolve '../build/Release/opencv4nodejs.node' HOT 1
- Cannot find module /node_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs'
- why no cv.compare or mat.compare function?
- how to catch mouse event on imshow
- ar
- Type error with mat.drawCountours()
- Unable to install opencv4nodejs HOT 1
- Unable to install in Ubuntu 22.05
- Ssim library
- Issues with node-gyp
- Issue with cv.Mat
- Issue with importing cv
- I think that typescript-eslint and eslint should be moved in the dev-dependencies. HOT 1
- warpPerspective does not seem to do anything HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv4nodejs.