cv2 looks like it is reading but always returns black screen, have confirmed the webcam is working, with other software.

asked 2017-05-20 12:54:45 -0500

import cv2 import numpy as np

cap = cv2.VideoCapture(0) ret, frame =

print ('isOpened(),',cap.isOpened()) """ prints as True """

cv2.imshow('frame',frame) cv2.waitKey(0)

cap.release() cv2.destroyAllWindows()

edit retag flag offensive close merge delete


I don't know python but can you check image size ? If size is ok try to change gain and brightness of your camera using set : CV_CAP_PROP_EXPOSURE CV_CAP_PROP_GAIN...

LBerger gravatar imageLBerger ( 2017-05-20 13:04:33 -0500 )edit