2

I have tried building the openCV lib from source so I can utilize cpp for a project I am planning instead of python. Before I had it installed using pip and decided to wipe all of the files related to the lib from my machine for a fresh install. Here are the steps I followed to build the project from source and am having some issues with openCV recognizing FFMPEG, GStreamer, QT, and GTK despite them all being installed.

# Clone the repository
$ git clone git@github.com:opencv/opencv.git

$ cd opencv

# create build dir and enter
$ mkdir build && cd build

# Configure
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D PYTHON_EXECUTABLE=$(which python2) \
-D BUILD_opencv_python2=OFF \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D WITH_GSTREAMER=ON \
-D WITH_FFMPEG=ON \
-D HAVE_FFMPEG=ON \
-D WITH_GTK=ON \
-D BUILD_SHARED_LIBS=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D BUILD_TIFF=ON \
 ..

I don't get to make the project because I notice that GStreamer, FFMPEG, as well as GTK and QT are disabled still despite my cmake flags. build attempt

I have been scratching my head at this searching up and down stackoverflow and github issues trying to find a proper way to build openCV from source and cannot find a definitive solution or a fix to my issues. Is there a way to install the package without building from source and being able to utilize the lib with c++ instead of or in addition to python?

aaries
  • 111
  • 1
  • 6
  • 1
    I don't know about gstreamer, but failure to find FFMPEG is known issue in OpenCV. I remember that with older versions 3.* I was compiling ffmpeg from source, then OpenCV detected it correctly. I also see [this topic](https://stackoverflow.com/questions/69029560/when-i-build-opencv-it-does-not-recognise-my-installed-ffmpeg) where it is suggested to install pkg-config before installing ffmpeg. – pptaszni Sep 23 '22 at 10:49

0 Answers0