Video Capture Error A.R Drone 2.0

asked 2017-09-24 22:53:33 -0600

The following code is trying to stream a video from an A.R Drone using python. When I run the code, I receive error error reading video feed. I am using 3.3.0. Is there a way to fix this. I have talked to other people. Am I running the code on the command prompt correctly. I put drone.py in the command prompt. I also ran the code on Python shell and it does not work. It just reads my else statement.

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()
edit retag flag offensive close merge delete

Comments

os, opencv version ?

how did you install cv2 ?

(if it was via PIP or similar, it probably has neither video nor gui facilities built in. check cv2.getBuildInformation())

berak gravatar imageberak ( 2017-09-24 23:25:42 -0600 )edit

OpenCV 3.3

mikerosz gravatar imagemikerosz ( 2017-09-25 11:30:20 -0600 )edit

os, and how did you install it ?

berak gravatar imageberak ( 2017-09-25 11:38:23 -0600 )edit

windows 10. cv2 was automatically installed when I downloaded opencv.

mikerosz gravatar imagemikerosz ( 2017-09-25 12:09:42 -0600 )edit

make sure, opencv_ffmpeg.dll is on the PATH or next to where you run your script.

berak gravatar imageberak ( 2017-09-25 12:17:42 -0600 )edit

how do i check that?

mikerosz gravatar imagemikerosz ( 2017-09-26 10:56:03 -0600 )edit

try to find the dll, copy it next to your script. then try again

berak gravatar imageberak ( 2017-09-26 11:01:49 -0600 )edit

i have the cmake file. I can't find a dll file. I think

mikerosz gravatar imagemikerosz ( 2017-09-26 11:47:51 -0600 )edit

Never mind I found dll file. Where do you want me to copy the file?

mikerosz gravatar imagemikerosz ( 2017-09-26 13:31:00 -0600 )edit
1

ok it works. Now i try to detect color in real time with drone

mikerosz gravatar imagemikerosz ( 2017-09-26 14:01:09 -0600 )edit