loading...

Compile OpenCV4

lucifer1004 profile image Gabriel Wu ・Updated on ・1 min read

Since OpenCV4 does not generata .pc file by default, we need to compile it from source and turn on the OPENCV_GENERATE_PKGCONFIG option if other programs need the pkg-config file.

Another problem I encountered is a number of errors similar to undefined reference to TIFFReadRGBAStrip@LIBTIFF_4.0. To solve that, the BUILD_TIFF option needs to be turned on.

And following is the script for compilation and installation.

wget https://github.com/opencv/opencv/archive/4.1.0.zip
unzip opencv-4.1.0.zip
cd opencv-4.1.0
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON
sudo make -j`nproc`
sudo make install

Discussion

pic
Editor guide