Reputation: 73
Im using pycharm to run the following code.But Im getting a black screen with no output. cv2 version - 4.0.0 (intall by pycharm installer) Python - 3.6 windows 10 64bit
import cv2
print(cv2.__version__)
video_capture = cv2.VideoCapture(0)
while (video_capture.isOpened()):
ret, frame = video_capture.read()
if ret == True:
cv2.imshow('win', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
print(frame)
I just printed the frame and I got following output with lot of zeros. Note that I have used the same webcam in same machine with Opencv and Java and it works fine.
[[[ 80 1 9]
[114 120 1]
[ 0 0 176]
...
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]]
Please see the blank output screenshot hear
Upvotes: 1
Views: 1833
Reputation: 73
Found the issues, It was my Kaspersky Virus scanner which was blocking it. This is really strange since it light up the Webcam so I never thought it was blocked. Once I disabled virus scanner it worked like a charm
Upvotes: 4