出现这个问题的原因在于寻找到的 OpenCV模块是不支持 OpenGL的,于是需要在OpenCV模块下的CMakeLists文件中打开对OpenGL的支持。具体操作请参考链接:https://blog.csdn.net/weixin_40198941/article/details/97523485
--需要重新编译Opencv,带OpenGL. 可是编译时带了这个选项的。。。。
测试结果
Scanning dependencies of target pyopenpose
[100%] Building CXX object python/openpose/CMakeFiles/pyopenpose.dir/openpose_python.cpp.o
[100%] Linking CXX shared module pyopenpose.cpython-38-x86_64-linux-gnu.so
[100%] Built target pyopenpose
执行make install 后,我们可以看到有那些.so文件被生成,放在什么目录
/usr/local/lib/libopenpose_calibration.so
4、测试
视频:
./build/examples/openpose/openpose.bin --video examples/media/video.avi # With face and hands ./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
图像:
./build/examples/openpose/openpose.bin --image_dir examples/media/
# With face and hands ./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand
# Running on Video
# Ubuntu and Mac
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# With face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
# Running on Webcam
# Ubuntu and Mac
./build/examples/openpose/openpose.bin
# With face and hands
./build/examples/openpose/openpose.bin --face --hand
# Running on Images
# Ubuntu and Mac
./build/examples/openpose/openpose.bin --image_dir examples/media/
# With face and hands
./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand
其他参考链接
https://blog.csdn.net/weixin_42770591/article/details/81869688
采用QT实现Openpose的编程
单纯测试是无法满足开发Openpose应用的需求,这里需要将Openpose能单独合入到QT的编译器里面。我们也可以使用CmakeList.txt来实现编译,总的来看,还是QT比较合适(提供了很多c++库)。奉劝大家不要用windows的库,毕竟是微软不是吃素的。
本人环境中使用的.pro文件,里面写了注释,也是根据我有限的水平写的,希望能帮助到看这篇文章的人:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 3): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# for OpenCV 这些是从opencv.pc里面抄写出来的列表。根据自己的opencv的安全情况,找到对应的opencv.pc
LIBS += -L/usr/local/lib -lopencv_gapi -lopencv_stitching \
-lopencv_alphamat -lopencv_aruco -lopencv_bgsegm \
-lopencv_bioinspired -lopencv_ccalib -lopencv_cudabgsegm \
-lopencv_cudafeatures2d -lopencv_cudaobjdetect -lopencv_cudastereo \
-lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm \
-lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy \
-lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform \
-lopencv_line_descriptor -lopencv_quality -lopencv_rapid -lopencv_reg \
-lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light \
-lopencv_phase_unwrapping -lopencv_superres -lopencv_cudacodec -lopencv_surface_matching \
-lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab \
-lopencv_cudaoptflow -lopencv_optflow -lopencv_cudalegacy -lopencv_videoio -lopencv_cudawarping \
-lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect \
-lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann \
-lopencv_xphoto -lopencv_photo -lopencv_cudaimgproc \
-lopencv_cudafilters -lopencv_imgproc -lopencv_cudaarithm -lopencv_core -lopencv_cudev
#这个也来自Opencv.pc的列表。
INCLUDEPATH += /usr/local/include/opencv4/
#OpenPose 的配置
#INCLUDEPATH += /usr/include #这个需要注释掉,否则会出现 "can\'t find stdlib.h"
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/cuda-11.0/include
INCLUDEPATH += /home/edward/software/openpose/include
INCLUDEPATH += /home/edward/software/openpose/3rdparty/caffe/include
LIBS += -L/usr/lib/
LIBS += -L/usr/local/lib/
#下面这个也需要注释掉,因为这个会使用老版本的qt
#LIBS += -L/usr/lib/x86_64-linux-gnu/
# 这个是本人自己编译安装的QT,
LIBS += -L/home/edward/software/qt5.13.2/5.13.2/gcc_64/lib
LIBS += -L/usr/local/cuda-11.0/lib64/
LIBS += -L/usr/local/cuda/lib64/
#下面这个是从晚上抄下来的,不知道有什么用。先放着。现在开始不喜欢Nvidia了,什么是否有机会,采用华为的GPU。希望有这个机会
LIBS += -L/usr/lib/nvidia/