Python-Projects icon indicating copy to clipboard operation
Python-Projects copied to clipboard

Camera Access Check on AI_Attendance_Program

Open Eshanshahriar1234 opened this issue 1 year ago • 3 comments

The code does not check if the camera is accessed. Possible fix could be a method to check if the webcam was properly accessed or not and return an error message if it is not accessed.

Eshanshahriar1234 avatar Sep 18 '24 15:09 Eshanshahriar1234

import cv2

cap = cv2.VideoCapture(0)

if not cap.isOpened(): print("Error: Could not access the webcam") else: while True: ret, frame = cap.read() if not ret: print("Failed to grab frame") break

    cv2.imshow('Webcam Feed', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release() cv2.destroyAllWindows()

JC230903 avatar Sep 22 '24 04:09 JC230903

Hi is this issue still open

fuadsn avatar Oct 06 '24 13:10 fuadsn

I would be glad to contribute to this, so it would be great if you could assign me this task. Thanks, Regards.

janetjoseph02 avatar Oct 07 '24 17:10 janetjoseph02