Closed jasonpolites closed 4 years ago
Doc did say that, but the remarks was removed at commit aaece6921d7368577511f06c94c99dd4e9653563
"-You'll need OpenCV 2.3.1 or newer installed before installing node-opencv. Note -that OpenCV 3.x is not yet fully supported."
PR would be welcome to add opencv4 support to find-opencv.js
Things may break - I assume we'll need macros to change header files across the library.
Hi, I also just tried to get opencv running and stumbled across the same issue (of course trying latest and greatest OpenCV 4.0.1). I would propose to simply update the readme telling which versions are precisely supported. This could save a lot of time and frustration when trying to get started :-) Thanks!
FWIW I gave up on 4.x. This is the Dockerfile I ultimately used (also has ffmpeg, but you can ignore that)
# Use the official Node.js 10 image.
# https://hub.docker.com/_/node
FROM node:10
# Install open cv and ffmpeg
# opencv install taken from https://docs.opencv.org/3.4/d7/d9f/tutorial_linux_install.html
RUN apt-get update && apt-get install -y \
ffmpeg \
cmake \
git \
libgtk2.0-dev \
pkg-config \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
imagemagick
# Create and change to the app directory.
WORKDIR /usr/src/app
# build & install open cv
# taken from https://docs.opencv.org/3.4/d7/d9f/tutorial_linux_install.html
RUN git clone --progress --verbose https://github.com/opencv/opencv.git
WORKDIR /usr/src/app/opencv/
# node-opencv only works with 2.x or 3.x
RUN git checkout tags/3.4.5
WORKDIR /usr/src/app/opencv/build
# Make sure to generate a pkg-config so node-opencv can find us
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=ON -D BUILD_EXAMPLES=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..
RUN make install
# Move back to workdir
WORKDIR /usr/src/app
# Ensure library references are updated
# (https://stackoverflow.com/questions/55267662/error-libopencv-dnn-so-3-4-cannot-open-shared-object-file-when-using-node-open)
RUN ldconfig -v
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./
# Install production dependencies.
RUN npm install --only=production
# Copy local code to the container image.
COPY . .
# Ensure there's an output folder for video extraction
RUN mkdir /tmp
# Service must listen to $PORT environment variable.
# This default value facilitates local development.
ENV PORT 8080
# Run the web service on container startup.
CMD [ "npm", "start" ]
@peterbraden: do you plan to release a new node-opencv compatible with last opencv ?
Hopefully works now?
Sadly, it doesn't. At least, on Mac. Works only with 2.x.
The "Porting to OpenCV4" issue has been merged. Is this working now?
It doesn't seem to work.
Describe the bug Documentation suggests "You'll need OpenCV 2.3.1 or newer installed before installing node-opencv" but find-opencv.js fails with opencv4 installed.
The following error emerges during npm install
To Reproduce Steps to reproduce the behavior:
I am building open CV from source on linux:
(the following is from a Docker file, but could be turned to shell commands)
Manually running pkg-config yields:
Expected behavior node-opencv should work with opencv 4 (feature request), or perhaps the docs should state that it only works up to 3.x (bug)
OS / Libraries Ubuntu 10.04 OpenCV 4.0.1