Opencv stream from a camera connected to a remote machine

2024/9/20 20:34:02

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.

Is there any way to do this?

Answer

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

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;
}

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

https://en.xdnf.cn/q/72131.html

Related Q&A

Is there a callable equivalent to f-string syntax?

Everybody loves Python 3.6s new f-strings:In [33]: foo = {blah: bang}In [34]: bar = blahIn [35]: f{foo[bar]} Out[35]: bangHowever, while functionally very similar, they dont have the exact same semanti…

Python: list comprehension based on previous value? [duplicate]

This question already has answers here:Python list comprehension - access last created element(9 answers)Closed 10 months ago.Say I want to create a list using list comprehension like:l = [100., 50., 2…

How to run a coroutine inside a context?

In the Python docs about Context Vars a Context::run method is described to enable executing a callable inside a context so changes that the callable perform to the context are contained inside the cop…

Random Forest interpretation in scikit-learn

I am using scikit-learns Random Forest Regressor to fit a random forest regressor on a dataset. Is it possible to interpret the output in a format where I can then implement the model fit without using…

Why are three apostrophes needed for print in Python?

Im making this Pythagoras Theorem Calculator in Python 3.3.2.I made print over several lines so that I could make a diagram:print("Welcome to the Pythagoras Theorem Calculator, powered by Python!&…

Downloading files from public Google Drive in python: scoping issues?

Using my answer to my question on how to download files from a public Google drive I managed in the past to download images using their IDs from a python script and Google API v3 from a public drive us…

Change locale for django-admin-tools

In my settings.py file I have:LANGUAGE_CODE = ru-RUalso, I have installed and working django-admin-tools. But admin language still english. What Im doing wrong?PS.$ cat settings.py | grep USE | grep -…

Container localhost does not exist error when using Keras + Flask Blueprints

I am trying to serve a machine learning model via an API using Flasks Blueprints, here is my flask __init__.py filefrom flask import Flaskdef create_app(test_config=None):app = Flask(__name__)@app.rout…

Serving static files with WSGI and Python 3

What is the simplest way to serve static files with WSGI and Python 3.2? There are some WSGI apps for PEP 333 and Python 2 for this purpose - but was is about PEP 3333 and Python 3? I want to use wsg…

Force INNER JOIN for Django Query

Here is my schema:City PhotographerIm trying to get a list of cities that have at least one photographer, and return the photographer count for the cities.Here is the queryset Im working with:City.obj…