Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌈 New npm-opencv-build + opencv4nodejs refreshed fork. #836

Open
UrielCh opened this issue Dec 28, 2021 · 10 comments
Open

🌈 New npm-opencv-build + opencv4nodejs refreshed fork. #836

UrielCh opened this issue Dec 28, 2021 · 10 comments

Comments

@UrielCh
Copy link
Contributor

UrielCh commented Dec 28, 2021

Hi,

I have just done making my opencv4nodejs fork works.

UrielCh/opencv4nodejs NPM Version

UrielCh/npm-opencv-build NPM Version

Main changes:

  • Tested and work and used on Debian/ Windows 10 / Raspberry pi / MacOs X (M1).
  • Cache versioned builds files.
  • Full Typescript.
  • No more auto-build during npm install.
  • The build-opencv (alias for install/install.js) must be call once to build everything ex: build-opencv --version 3.4.6 rebuild.
  • Works on electron
@UrielCh UrielCh changed the title New npm-opencv-build + opencv4nodejs refreshed fork. 🌈 New npm-opencv-build + opencv4nodejs refreshed fork. Dec 30, 2021
@zcmgyu
Copy link

zcmgyu commented Jan 20, 2022

Thanks. I appreciate it if it could support Electron as well. Could you give me the point to make it work with ElectronJS?

@UrielCh
Copy link
Contributor Author

UrielCh commented Jan 20, 2022

I will support Electron and maybe global setup in the same time (npm -g) the changes are in the same file.

@zcmgyu
Copy link

zcmgyu commented Jan 21, 2022

@UrielCh Hi, I would like to join to contribute as well. Do you have any suggestions to do that? Thank you in advance. 🙇

@UrielCh
Copy link
Contributor Author

UrielCh commented Jan 21, 2022

Electron build pass.

If you want to add some more code samples, you are well come.

If I found time I will release a sample electron project that uses the webcam and apply a Yolo CNN. dans display data on the side.
then the other one that read QR code, so I can attach actions to each QR-code, I would like to play some music based on a QR-Code, I will print some QR-Code for my kids, so they will be able to play music by themselves.

See opencv-electron

@zcmgyu
Copy link

zcmgyu commented Jan 21, 2022

@UrielCh Thanks. I've just viewed your opencv-electron repo on mobile. It is running on electron version 1.8.4. This electron version worked fine with legacy opencv4nodejs, when upgrading it to the latest electron, something went wrong. I will deep dive into this repo and give you feedback. Thank you for your contribution.

@UrielCh
Copy link
Contributor Author

UrielCh commented Jan 21, 2022

My first deep dive is done, please continue this discussion here: UrielCh#4

@UrielCh
Copy link
Contributor Author

UrielCh commented Jan 26, 2022

Version 6.0.10 is out Electron v16 works.

@zcmgyu
Copy link

zcmgyu commented Jan 27, 2022

Great fork 🔥🔥🔥

Hope you guys carry on this library on this forked repository.
https://github.com/UrielCh/opencv4nodejs

@UrielCh
Copy link
Contributor Author

UrielCh commented Aug 30, 2022

Hi,
Great news for those people that do not want to build their OpenCV:
I published @u4/opencv4nodejs V 6.2.4 today,

This version autodetects the common setup path for Brew on Mac, Chocolatey on Windows, and Apt on Linux.

  • Windows:

choco install opencv

  • Mac:

brew install opencv

  • debian:

apt -y install libopencv-contrib-dev libopencv-dev

just define environment variable: OPENCV4NODEJS_DISABLE_AUTOBUILD=1

And your prebuild OpenCV will be used.

You may need to call:
npx build-opencv rebuild
or
npx build-opencv --nobuild rebuild (if you do not define OPENCV4NODEJS_DISABLE_AUTOBUILD variable)

@baditaflorin
Copy link

@UrielCh when trying this on macos Ventura 13.1 I get


^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/softfloat.cpp.o
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_xml.cpp:211:25: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
                        sprintf( data, "#x%02x", (uchar)c );
                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_xml.cpp:312:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
            sprintf( ptr, "<!-- %s -->", comment );
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_xml.cpp:347:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
            sprintf( ptr, "-->" );
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/split.dispatch.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat.dispatch.cpp.o
3 warnings generated.
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat_c.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stl.cpp.o
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_yml.cpp:43:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
            sprintf(buf, "!!binary |");
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_yml.cpp:52:17: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
                sprintf( buf, "!!%s %c", type_name, c );
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_yml.cpp:62:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
            sprintf( buf, "!!%s", type_name );
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/persistence_yml.cpp:155:25: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
                        sprintf( data, "x%02x", c );
                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
4 warnings generated.
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/sum.dispatch.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/tables.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/trace.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/types.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.o
[ 39%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/datafile.cpp.o
9 warnings generated.
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/filesystem.cpp.o
3 warnings generated.
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/logtagconfigparser.cpp.o
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/logtagmanager.cpp.o
/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv/modules/core/src/system.cpp:1381:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(buf, "Unknown %s code %d", status >= 0 ? "status":"error", status);
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/utils/samples.cpp.o
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.o
[ 40%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/va_intel.cpp.o
1 warning generated.
[ 40%] Linking CXX shared library ../../lib/libopencv_core.dylib
[ 40%] Built target opencv_core
make: *** [all] Error 2
ERR! build Compilation failed, previous calls:
ERR! build rimraf /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv_contrib
ERR! build mkdir -p /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build
ERR! build cd /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea
ERR! build git clone --quiet -b 4.6.0 --single-branch --depth 1 --progress https://github.com/opencv/opencv_contrib.git /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv_contrib
ERR! build git clone --quiet -b 4.6.0 --single-branch --depth 1 --progress https://github.com/opencv/opencv.git /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv
ERR! build export OPENCV_BIN_DIR=/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build/bin
ERR! build export OPENCV_INCLUDE_DIR=
ERR! build export OPENCV_LIB_DIR=/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build/lib
ERR! build cd /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build
ERR! build cmake /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv -DCMAKE_INSTALL_PREFIX=/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPES=Release -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_TESTS=OFF -DBUILD_opencv_dnn=ON -DENABLE_FAST_MATH=ON -DBUILD_PERF_TESTS=OFF -DBUILD_JAVA=OFF -DBUILD_ZLIB=OFF -DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr -DWITH_VTK=OFF -DOPENCV_ENABLE_NONFREE=ON -DOPENCV_EXTRA_MODULES_PATH=/Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/opencv_contrib/modules -DBUILD_opencv_apps=OFF -DBUILD_opencv_aruco=OFF -DBUILD_opencv_bgsegm=OFF -DBUILD_opencv_bindings_generator=OFF -DBUILD_opencv_bioinspired=OFF -DBUILD_opencv_calib3d=ON -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_core=ON -DBUILD_opencv_datasets=OFF -DBUILD_opencv_dnn=ON -DBUILD_opencv_dnn_objdetect=OFF -DBUILD_opencv_dpm=OFF -DBUILD_opencv_face=ON -DBUILD_opencv_features2d=ON -DBUILD_opencv_flann=ON -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_gapi=ON -DBUILD_opencv_hfs=OFF -DBUILD_opencv_highgui=ON -DBUILD_opencv_img_hash=ON -DBUILD_opencv_imgcodecs=ON -DBUILD_opencv_imgproc=ON -DBUILD_opencv_java_bindings_generator=OFF -DBUILD_opencv_js=OFF -DBUILD_opencv_line_descriptor=OFF -DBUILD_opencv_ml=ON -DBUILD_opencv_objc_bindings_generator=OFF -DBUILD_opencv_objdetect=ON -DBUILD_opencv_optflow=OFF -DBUILD_opencv_phase_unwrapping=OFF -DBUILD_opencv_photo=ON -DBUILD_opencv_python3=OFF -DBUILD_opencv_python_bindings_generator=OFF -DBUILD_opencv_python_tests=ON -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stereo=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_structured_light=OFF -DBUILD_opencv_superres=OFF -DBUILD_opencv_surface_matching=OFF -DBUILD_opencv_text=ON -DBUILD_opencv_tracking=ON -DBUILD_opencv_ts=OFF -DBUILD_opencv_video=ON -DBUILD_opencv_videoio=ON -DBUILD_opencv_videostab=ON -DBUILD_opencv_wechat_qrcode=OFF -DBUILD_opencv_world=OFF -DBUILD_opencv_xfeatures2d=ON -DBUILD_opencv_ximgproc=ON -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=OFF
ERR! build cd /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build
ERR! build make install -j10
ERR! install running: make install -j10
ERR! install in /Users/florin/Documents/GITHUB_PROJECTS/scrape_hub/src/node/node_modules/@u4/opencv-build/dist/opencv-4.6.0-8b1ea/build exited with code 2 (for more info, set '--loglevel silly')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants