本文介绍了来自连接到远程计算机的摄像机的Opencv流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用python开发一个wx应用程序,用于流式传输和显示来自两个不同网络摄像头的视频.这可以正常工作,但是现在我需要在另一种情况下执行此操作,在这种情况下,两个摄像机连接在通过网络连接的Windows上运行的单独计算机中.我的应用程序将在计算机1上运行.可以使用opencv获取来自摄像机1的视频,并将其显示在面板上.我也想从连接到机器2的摄像机2提取视频,并将其显示在应用程序中.

I am developing a wx application in python for streaming and displaying video from two different webcams. This works fine, but now I need to do this in a different scenario in which the two cameras are connected in separate machine running on Windows connected over a network. My application will run on machine 1. The video from the camera 1 can be fetched using opencv and display on a panel. And also I want to fetch video from camera 2 connected to machine 2, and display it in the application.

有什么办法吗?

推荐答案

VLC可以通过RTSP流式传输捕获设备的图像,请参见 VLC的"Streaming HowTo"一章中的使用GUI进行流传输" .

VLC can stream the image of a capture device's over RTSP, see the "Streaming using the GUI" chapter of VLC's "Streaming HowTo".

然后,OpenCV的 VideoCapture 可以从RTSP流中抓取帧,例如:

Then OpenCV's VideoCapture can grab frames from RTSP stream such as:

std::string address = "rtsp://<username:password>@<ip_address>:<port>";
cv::VideoCapture cap;

if(!cap.open(address))
{
    std::cout << "Error opening video stream: " << address << std::endl;
    return -1;
}

其中 address 类似于 rtsp://127.0.0.1:554 rtsp://username:password@127.0.0.1:554 如果受密码保护.

Where address is something like rtsp://127.0.0.1:554 or rtsp://username:password@127.0.0.1:554 if it is password protected.

这篇关于来自连接到远程计算机的摄像机的Opencv流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:27
查看更多