Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How many usb camera do you have? If it is one usb camera. Then it could be zero. Change this:

cap = cv2.VideoCapture(1)

to

cap = cv2.VideoCapture(0)

Also typo error too: change this:

cv2.imgshow('frame', gray) #Display it
to 
cv2.imshow('frame', gray) #Display it

How many usb camera do you have? If it There is one usb camera. Then it could be zero. Change this:

cap = cv2.VideoCapture(1)

to

cap = cv2.VideoCapture(0)

nothing wrong with ur code. I tested raspberry pi 3B+ using linux. Also typo error too: change this:

cv2.imgshow('frame', gray) #Display it
to 
cv2.imshow('frame', gray) #Display it