简介
本文描述树莓派 4B Raspberry Pi OS(64位)完成启动后,进行的第一个编译安装任务:Qt5 + GStreamer,同时也是OpenCV编译安装前的准备工作,因此:启动 -> Qt5 + GStreamer -> OpenCV 顺序不能错。
-
安装Qt5
sudo apt-get update sudo apt-get upgrade sudo apt-get install clang qtbase5-dev qtchooser sudo apt-get install qt5-qmake qtbase5-dev-tools sudo apt-get install qtcreator sudo apt-get install qtdeclarative5-dev
如果一切顺利,在启动Qt Creator时,应该会看到以下欢迎屏幕。
-
安装GStreamer
-
安装依赖
sudo apt-get install libx264-dev libjpeg-dev
-
安装剩余的插件
sudo apt-get install libgstreamer1.0-dev \libgstreamer-plugins-base1.0-dev \libgstreamer-plugins-bad1.0-dev \gstreamer1.0-plugins-ugly \gstreamer1.0-tools \gstreamer1.0-gl \gstreamer1.0-gtk3 # 如果安装了Qt5的话,安装接下来这个 sudo apt-get install gstreamer1.0-qt5 # 如果您想要使用音频,请安装 sudo apt-get install gstreamer1.0-pulseaudio
-
连接摄像头测试一下
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
gst-launch-1.0 libcamerasrc ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! autovideosink
-
测试都成功了就可以进行下一步:编译安装OpenCV