justadudewhohacks / justadudewhohacks/opencv4nodejs
Electron rebuild with own version of OpenCV
- Dominant language
- C++
- Stars
- 5.1k
- Forks
- 826
- PR merge metrics
- No merged PRs in 30d
Description
OpenCV version:: 4.1.2
OpenCV-contrib : No
Nodejs version: 14.15.3
OS: Windows 10
I have been struggling to add opencv4nodejs to my electron app for days now with no success so i gave up and decided to ask what am i doing wrong? I have installed windows-build-tools using the following command
`npm install --global windows-build-tools`
My dependencies in my package.json look like this :
```
"dependencies": {
"electron": "^10.2.0",
"opencv4nodejs": "^5.6.0"
},
"devDependencies": {
"electron-rebuild": "^2.3.4"
},
"opencv4nodejs": {
"disableAutoBuild": 1,
"opencvIncludeDir": "C:\\tools\\opencv\\build\\include",
"opencvLibDir": "C:\\tools\\opencv\\build\\x64\\vc15\\lib",
"opencvBinDir": "C:\\tools\\opencv\\build\\x64\\vc15\\bin"
}
```
I have installed OpenCV version 4.1.2 with the following command
`choco install OpenCV -y -version 4.1.2`
My environmental variables look like this
```
OPENCV_INCLUDE_DIR = C:\tools\opencv\build\include
OPENCV_LIB_DIR = C:\tools\opencv\build\x64\vc15\lib
OPENCV_BIN_DIR = C:\tools\opencv\build\x64\vc15\bin
```
and i have appended %OPENCV_BIN_DIR% to Path My npm install passes successfully, and the issues come when i try to run electron rebuild with the following script
"electron-rebuild": "electron-rebuild -w opencv4nodejs" Initially i had the error that it cound not find opencv2/core.hpp but i have fixed that by adding the following lines to the binding.gyp file located in node_modules/opencv4nodejs
```
"include_dirs" : [
"C:\\tools\\opencv\\build\\include"
"
Contributor guide
Assessment
This issue has not been assessed yet.