无法从Parrot AR Dron的cv2.VideoCapture获得视频

2024-05-19 23:37:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我没有从鹦鹉AR无人机cv2.VideoCapture获取视频:ret总是False

import numpy as np
import cv2

cap = cv2.VideoCapture("tcp://192.168.1.1:5555")

ret, frame = cap.read()

print ret

cap.release()
cv2.destroyAllWindows()

Tags: importnumpyfalseread视频asnpcv2
1条回答
网友
1楼 · 发布于 2024-05-19 23:37:59
I am not used to Python, but If it was in Windows I will first check whether cap is getting frames from the given IP Address using:

if(!cap.IsOpened())
{
cerr <<"No video Frames were read, please check your IP and Port" <<endl;
return -1;
}

This will easily help me know whether I am fetching from the Drone or not.

//Secondly, we have to check for the case where we are able to fetch from the drone..

while(true)
{
cap >>frame;
char c = waitkey(10);
if( c== 27) break
}

相关问题 更多 >