7) 5.3这个问题无法被解决,... 终究还是cuda的问题。opencv不用显卡编译,去掉use_cuda,use_cudnn这两个选项。(不就是一个显卡厂商吗,拽什么拽?尽量不用怎样?)
6)在出现不支持compute_20等错误的是否,很有可能是这个CUDA_NVCC_FLAGS参数需要修改,可以直接在makefile中删除compute_20等
set(CUDA_NVCC_FLAGS -gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-Xcudafe;--diag_suppress=cc_clobber_ignored;-Xcudafe;--diag_suppress=integer_sign_change;-Xcudafe;--diag_suppress=useless_using_declaration;-Xcudafe;--diag_suppress=set_but_not_used;-DUSE_CUDNN;-Xcompiler;-fPIC ;; )
将opencv-4.5.0改成opencv, opencv_contrib-4.5.0 改成opencv_contrib 这样方便后续的操作。 这里的build目录是建立在opencv子目录下的。
在 /path/to/opencv/build/unix-install 的目录下,有一个opencv4.pc的文件,这个文件就是在配置pkg_config时所用的.pc文件。可以将这个文件放在系统目录/usr/lib/pkgconfig目录下,就可以使用meson来配置opencv 的环境了。
"用pkg-config --modversion opencv命令查看opencv版本"
如果没有采用cmake-gui .. 编译,则采用如下OpenCV cmake的指令:红色部分需要做改动
这个是直接在opencv目录下执行。
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=http://www.likecs.com/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=http://www.likecs.com/home/edward/software/opencv/opencv_contrib/modules \
-D BUILD_TIFF=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D WITH_VTK=OFF \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_TESTS=OFF \
-D OPENCV_DNN_CUDA=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D CUDA_ARCH_BIN=8.0 \
-D WITH_CUBLAS=ON \
-D WITH_CUDNN=ON \
-D CUDNN_LIBRARY=http://www.likecs.com/usr/lib/x86_64-linux-gnu/libcudnn.so.8.0.5 \
-D CUDNN_INCLUDE_DIR=http://www.likecs.com/usr/local/cuda/include \
-D BUILD_EXAMPLES=OFF ..
没有cuda可以用下面的cmake
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=http://www.likecs.com/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D BUILD_TIFF=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D WITH_EIGEN=OFF \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D WITH_VTK=OFF \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_TESTS=OFF \
-D BUILD_EXAMPLES=OFF ..
编译安装Openpose
推荐参考:https://blog.csdn.net/ookamiww/article/details/105795786
及:https://www.it610.com/article/1279878419298926592.htm
CMakeList.txt 有1千多行,真没办法一个一个来看... CMakeList.txt为什么要写那么长???
下载版本
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
下载openpose对应的caffe并且拷入openpose中的caffe目录下
#安装caffe依赖
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev
sudo apt-get install libprotobuf-dev protobuf-compiler
sudo apt-get install libhdf5-serial-dev libleveldb-dev libsnappy-dev libatlas-base-dev
#下载caffe源码 https://github.com/BVLC/caffe
cd build
sudo cmake-gui ..
配置好caffe,opencv,然后执行:
sudo make
sudo make install
错误及解决办法
a target must be either all-keyword or all-plain.
CMake Error at src/openpose/calibration/CMakeLists.txt:18 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "openpose_calibration". All uses of target_link_libraries with
a target must be either all-keyword or all-plain.
类似的错误可以通过在
pathto/openpose/src/openpose/calibration/CMakeLists.txt:18
如下语句添加:PUBLIC
target_link_libraries(openpose_calibration PUBLIC openpose_core)
.cu找不到头文件???
edward@Server-adiAi:~/git/libs/openpose2021/build$ sudo make
[ 1%] Building NVCC (Device) object src/openpose/CMakeFiles/openpose.dir/tracking/openpose_generated_pyramidalLK.cu.o
/home/edward/git/libs/openpose2021/src/openpose/tracking/pyramidalLK.cu:1:10: fatal error: openpose_private/tracking/pyramidalLK.hpp: No such file or directory
#include <openpose_private/tracking/pyramidalLK.hpp>
通过在CmakeList.txt下添加:
get_property(dirs DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
message(">>> , include_dirs=${dirs}")
打印出: