Reputation: 51
I have a setup of web application and Hardware(which has camera integrated), My job is to
1.Check cam in hardware is capturing video(when a video call is initiated from the web application to Hardware). 2.Check cam in my laptop is capturing video(when a video call is initiated from hardware to web application).
I don't want to capture video from Cam, All I need to check the status of Camera(whether it is capturing video or not).Is there any way to check this scenario using python?
Thanks in advance.
Upvotes: 2
Views: 5111
Reputation: 607
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
if cap.isOpened():
print("Webcam online.")
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
Upvotes: 2