[Python] Accessing camera on Chromebook

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024.

  1. Stack

    Stack Membro Participativo

    Recently purchased a chromebook. I'm trying to use openCV in IDLE to access my camera however I am unable to get any video.

    Cheese on linux cannot access my camera either.

    The built in camera app on the chromebook works fine.

    I used this code along with others of similar nature and none could access my camera

    import cv2

    cap = cv2.VideoCapture(0)

    if not cap.isOpened():
    print("Error: Could not open video.")
    exit()

    while True:
    # Capture frame-by-frame
    ret, frame = cap.read()

    if not ret:
    print("Error: Could not read frame.")
    break

    # Display the resulting frame
    cv2.imshow('Camera Feed', frame)

    # Press 'q' to exit the loop
    if cv2.waitKey(1) == ord('q'):
    break

    cap.release()
    cv2.destroyAllWindows()

    Continue reading...

Compartilhe esta Página