Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用cv2.VideoCapture接收tello udp流_Python_Opencv - Fatal编程技术网

Python 如何使用cv2.VideoCapture接收tello udp流

Python 如何使用cv2.VideoCapture接收tello udp流,python,opencv,Python,Opencv,我尝试使用cv2.VideoCapture接收电视流,但它总是在这一步停止 capture=cv2.VideoCapture('udp:/0.0.0:11111',cv2.CAP\u FFMPEG) “udp:”后面应该有两个斜杠,而不是一个 比如:'udp://0.0.0.0:11111“检查以确保流链接有效。在VLC播放器中打开它以确保它工作。看一看,我试着使用ffplayudp://192.168.10.2:11111 你是怎么让它工作的udp://192.168.10.2:11111?

我尝试使用cv2.VideoCapture接收电视流,但它总是在这一步停止
capture=cv2.VideoCapture('udp:/0.0.0:11111',cv2.CAP\u FFMPEG)


“udp:”后面应该有两个斜杠,而不是一个


比如:'udp://0.0.0.0:11111“

检查以确保流链接有效。在VLC播放器中打开它以确保它工作。看一看,我试着使用ffplayudp://192.168.10.2:11111 你是怎么让它工作的udp://192.168.10.2:11111? udp地址不应该是udp://0.0.0.0:11111 ??
import socket
import time
import cv2

tello_ip = '192.168.10.1'
tello_port = 8889
tello_address = (tello_ip, tello_port)
mypc_address = (host, port)
socket = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
socket.bind (mypc_address)
socket.sendto ('command'.encode (' utf-8 '), tello_address)
socket.sendto ('streamon'.encode (' utf-8 '), tello_address)
print ("Start streaming")
capture = cv2.VideoCapture ('udp:/0.0.0.0:11111',cv2.CAP_FFMPEG)
if not capture.isOpened():
    capture.open('udp:/0.0.0.0:11111')

while True:
    ret, frame =capture.read()
    print(ret)
    if(ret):
        cv2.imshow('frame', frame)
    if cv2.waitKey (1)&0xFF == ord ('q'):
        break
capture.release ()
cv2.destroyAllWindows ()
socket.sendto ('streamoff'.encode (' utf-8 '), tello_address)