gpt4 book ai didi

python - 从无人机Parrot 2.0流式传输视频。 Python + cv2

转载 作者:行者123 更新时间:2023-12-02 17:45:04 26 4
gpt4 key购买 nike

我试图访问无人机摄像头的信息流。

这是我的代码:

import cv2
import numpy
import libardrone

drone = libardrone.ARDrone()
cap = drone.image

while(True):
cap = drone.image
if not cap:
continue
ret, frame = convert
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break

cap.release()
cv2.destroyAllWindows()

这没用。它没有打开任何框,我可以在其中看到无人机摄像头的流视频。
怎么了?你有什么建议吗?

谢谢!

最佳答案

import cv2
cam = cv2.VideoCapture('tcp://192.168.1.1:5555')
running = True
while running:
# get current frame of video
running, frame = cam.read()
if running:
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == 27:
# escape key pressed
running = False
else:
# error reading frame
print 'error reading video feed'
cam.release()
cv2.destroyAllWindows()

试试这个代码...这对我有用。

关于python - 从无人机Parrot 2.0流式传输视频。 Python + cv2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37713155/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com