Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to check if camera is opened by any application

Cv2 module does not capture any image if my camera is used by other application like facebook (video chatting).

My Script:

import cv2
cam = cv2.VideoCapture(cv2.CAP_DSHOW)
ret, frame = cam.read()
cv2.imwrite('image.jpg', frame)
cam.release()
cv2.destroyAllWindows()

When I run my script then it does not throw any error instead it creates a image.jpg having size of 0 bytes.

Can't I use my camera in two or more application?