juangallostra / augmented-reality

Augmented reality proof of concept project with Python and OpenCV
MIT License
335 stars 118 forks source link

Hi, getting error of being unable to capture video #3

Closed the-xperimentalist closed 6 years ago

the-xperimentalist commented 6 years ago

I am getting the error - Unable to capture video. Although, I have the opencv built with FFMPEG support as I checked my opencv build info. Will be great if you could help

juangallostra commented 6 years ago

Hi @prasoonmayank, could you please tell which versions of Python and OpenCV are you using?

the-xperimentalist commented 6 years ago

I am using python 2.7 and opencv 3.4.3 Although, now it has suddenly started working. But I am getting a completely blank frame output.

juangallostra commented 6 years ago

@prasoonmayank the program assumes that the computer where the program is running is equipped with a webcam. Is this the case?

If it is, it will be useful to check that OpenCV is able to read frames from it. Try to execute the following script to check it:

import cv2
cap = cv2.VideoCapture(0)

while(True):
    ret, frame = cap.read()
    rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)

    cv2.imshow('frame', rgb)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        out = cv2.imwrite('capture.jpg', frame)
        break

cap.release()
cv2.destroyAllWindows()
juangallostra commented 6 years ago

@prasoonmayank closing for inactivity. Will re-open if required.