Ubuntu 18.04 机器上,我试图在 gstreamer 1.14.5 管道中使用 opencv 4.1.2 facedetect,但是不幸的是未安装该插件。

我下载了gstreamer bad plugin code并尝试使用介子进行构建
这样创建的so文件的大小看起来不正确。

如何安装opencv插件?

(cv) roy@hp:~$ cat /proc/version
Linux version 5.0.0-36-generic (buildd@lgw01-amd64-060) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019

(cv) roy@hp:~$ which gst-inspect-1.0
/usr/bin/gst-inspect-1.0

(cv) roy@hp:~$ gst-inspect-1.0 --version
gst-inspect-1.0 version 1.14.5
GStreamer 1.14.5
https://launchpad.net/distros/ubuntu/+source/gstreamer1.0

(cv) roy@hp:~$ gst-inspect-1.0 facedetect
No such element or plugin 'facedetect'

(cv) roy@hp:~$ python
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
4.1.2
>>> exit()

(cv) roy@hp:~$ ls -l /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopen*
-rw-r--r-- 1 root root  39752 Jul  4 02:16 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenal.so
-rw-r--r-- 1 root root  23376 Jul  4 02:16 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenexr.so
-rw-r--r-- 1 root root  81896 Jul  4 02:16 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenglmixers.so
-rw-r--r-- 1 root root 253048 Jul  3 09:19 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopengl.so
-rw-r--r-- 1 root root  48328 Jul  4 02:16 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenjpeg.so
-rw-r--r-- 1 root root  27368 Jul  4 02:16 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstopenmpt.so

(cv) roy@hp:~$ ls -l gst-plugins-bad-1.14.5/gst-libs/gst/opencv/
total 84
-rw-r--r-- 1 roy roy  6395 Mar 23  2018 gstopencvutils.cpp
-rw-r--r-- 1 roy roy  1700 Mar 23  2018 gstopencvutils.h
-rw-r--r-- 1 roy roy  8871 Mar 23  2018 gstopencvvideofilter.cpp
-rw-r--r-- 1 roy roy  4559 Mar 23  2018 gstopencvvideofilter.h
-rw-r--r-- 1 roy roy   746 Mar 23  2018 Makefile.am
-rw-r--r-- 1 roy roy 38511 May 29  2019 Makefile.in
-rw-r--r-- 1 roy roy   775 Mar 23  2018 meson.build
-rw-r--r-- 1 roy roy  1082 Mar 23  2018 opencv-prelude.h

(cv) roy@hp:~$ ls -l gst-plugins-bad-1.14.5/build/gst-libs/gst/opencv/
total 0
lrwxrwxrwx 1 roy roy 21 Nov 30 08:50 libgstopencv-1.0.so -> libgstopencv-1.0.so.0
lrwxrwxrwx 1 roy roy 28 Nov 30 08:50 libgstopencv-1.0.so.0 -> libgstopencv-1.0.so.0.1405.0

(cv) roy@hp:~$

最佳答案

请不要弄脏您的Ubuntu。最好使用您喜欢的Ubuntu中的任何软件包管理器。如果您使用apt,只需为您安装就绪的可用软件包:

sudo apt install libgstreamer-plugins-bad1.0-dev

关于python - 如何为OpenCV安装gstreamer 1.0 badplugin?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59118639/

10-10 18:21
查看更多