Logitech c270
camera not taking pictures on linux(ubuntu)
with open-cv python. I have also tried adding delays, installing drivers in the terminal, and almost everything but still takes a blacked-out picture.
*also with index(0)
it takes photo within like 1 sec but with index(3)
i.e my logitech camera it takes the blacked-out photo in milliseconds!
import cv2
cap = cv2.VideoCapture(3)
if not cap.isOpened():
print("Cannot open camera")
exit()
# Read a frame from the camera
ret, frame = cap.read()
if ret:
cv2.imwrite("photo.jpg", frame)
# Release the camera and close all windows
cap.release()
cv2.destroyAllWindows()
- I tried an older camera same model like 2 months old code works there, I have bought two new ones but it occurs in both of them.
- I tried on C920 logitech the code works there also.
- I have 4 of them C270, opened two both had the fault, I think all of them would have it, so I can't risk opening all.
- I have also tried adding delays, installing drivers in the terminal, and almost everything but still takes blacked-out picture.
- *also with index (0) it takes a photo within like 1 sec but with index (3) i.e my logitech camera it takes the blacked-out photo in milliseconds!