2

我正在尝试使用 gstreamer 管道在 OpenCV 中打开 IP 摄像机。我可以在终端中使用 Gstreamer 打开 IPcamera,使用:

gst-launch-1.0 -v rtspsrc location="rtsp://192.168.0.220:554/user=admin&password=admin&channel=1&stream=0.sdp?real_stream--rtp-caching=10" latency=10 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! xvimagesink

现在有了这个,我如何在 OpenCV 中打开同一个相机videoCapture()

任何帮助表示赞赏。

4

1 回答 1

4

您可以复制相同的管道并在 VideoCapture 中使用它(如果您使用 gstreamer 模块构建 OpenCV)。

重要的一点是你需要用一个appsink元素来完成管道。

const char* pipe =  "rtspsrc location=\"rtsp://192.168.0.220:554/user=admin&password=admin&channel=1&stream=0.sdp?real_stream--rtp-caching=10\" latency=10 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! appsink";
VideoCapture cap(pipe);
于 2017-04-04T12:07:52.580 回答