'How to install gstreamer 1.0 badplugin for opencv?
On a Ubuntu 18.04 machine I am trying to use opencv 4.1.2 facedetect in a gstreamer 1.14.5 pipeline but unfortunately the plugin is not installed.
I downloaded the gstreamer bad plugin code and tried to build using meson The size of the so files created does not look right.
How do I install the opencv plugin?
(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:~$
Solution 1:[1]
Please don't dirty your Ubuntu. Prefer using any package manager in Ubuntu, that you like. If you use apt
, just install ready and available package for you:
sudo apt install libgstreamer-plugins-bad1.0-dev
Solution 2:[2]
I had the same problem, and my solution is if you want to use the GStreamer OpenCV Plugins described here and here you need to do:
sudo apt install gstreamer1.0-opencv
as explained here, then:
gst-launch-1.0 autovideosrc ! video/x-raw,width=640,height=480 ! videoconvert ! facedetect min-size-width=60 min-size-height=60 profile=/usr/share/opencv4/haarcascades/haarcascade_frontalface_default.xml ! videoconvert ! xvimagesink
Worked successfully in my NVIDIA® Jetson Nano™ Developer Kit.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | 273K |
Solution 2 | Andrews Cordolino Sobral |