How to check if webcam is busy
Hello,
is there a way to check if webcam is busy before taking an image? Python.exe would crash if camera is in use and following code is running
Python code:
from cv2 import *
while True:
#need to check here if camera is busy
cam = VideoCapture(0)
s, img = cam.read()
if s: # frame captured without any errors
imwrite("filename.jpg",img) #save image