OpenCV version: 4.3.0 Python version: 3.6
sudo apt-get update
sudo apt-get install curl libssl-dev
sudo apt-get install ffmpeg
#From opencv documentation
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python3-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
#I recommand install numpy via pip
python -m pip install numpy
#For scipy pip installation
sudo apt-get install python-dev python3-dev
python -m pip install scipy
sudo apt-get install libopenblas-base libopenblas-dev libatlas-base-dev libatlas3-base liblapack-dev liblapack3 liblapacke-dev
Openblas
If you're not on aarch64, please use sudo find / -name openblas
to find your openblas and change accordingly*
Open opencv/cmake/OpenCVFindOpenBLAS.cmake
, find SET(Open_BLAS_INCLUDE_SEARCH_PATHS
, add
/usr/include/aarch64-linux-gnu
/usr/include/aarch64-linux-gnu/openblas
find SET(Open_BLAS_LIB_SEARCH_PATHS
, add
/usr/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu/openblas
Atlas
Open opencv/cmake/OpenCVFindAtlas.cmake
, find set(Atlas_INCLUDE_SEARCH_PATHS
and set(Atlas_LIB_SEARCH_PATHS
, add /usr/include/aarch64-linux-gnu/atlas
/usr/lib/aarch64-linux-gnu/atlas
accordingly.
Lapack will be automatically found if you configured openblas and atlas correctly (because in ubuntu distribution, openblas contains lapack header)
First, install nvidia video codec sdk: https://developer.nvidia.com/nvidia-video-codec-sdk/download
Copy the library files to /usr/local/cuda/targets/aarch64-linux/lib
, header files to /usr/local/cuda/targets/aarch64-linux/include
.
Before installing, download opencv and opencv-contrib from github, and put opencv-contrib inside opencv folder
cd opencv-4.3.0
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_NVCUVID=ON \
-D WITH_CUBLAS=ON \
-D WITH_V4L=ON \
-D WITH_OPENGL=ON \
-D WITH_QT=ON \
-D WITH_GSTREAMER=ON \
-D BUILD_opencv_cudacodec=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.3.0/modules/ \
-D PYTHON_DEFAULT_EXECUTABLE=$(which python3) \
-D ENABLE_CXX11=ON \
..
sudo make -j7
sudo make install
This error happens in opencv-4.1.1, in 4.3.0 it works fine.
In /home/nvidia/opencv-4.1.1/modules/core/include/opencv2/core/private.hpp
,
edit the line #include <Eigen/Core>
into #include <eigen3/Eigen/Core>
This error happens in opencv-4.1.1, in 4.3.0 it works fine.
Relink the file
sudo rm /usr/lib/aarch64-linux-gnu/libGL.so
sudo ln -s /usr/lib/aarch64-linux-gnu/libGL.so.1 /usr/lib/aarch64-linux-gnu/libGL.so
When you compile OpenCV, first make sure that -D OPENCV_GENERATE_PKGCONFIG=YES
is included. To confirm it, run pkg-config --cflags --libs opencv
and pkg-config --cflags --libs opencv4
and compare. The latter should definitely have normal result if you're using OpenCV 4 (the former will have normal result as well if you have installed any libopencv package from apt-get)
In your project's Makefile, there should be a line like
g++ -o a a.cpp `pkg-config --cflags --libs opencv`
use opencv4
instead of opencv
This error happens in opencv-4.1.1, in 4.3.0 it works fine.
change ../src/cap_ffmpeg_api.hpp
with ../src/cap_ffmpeg_legacy_api.hpp