[Python] OpenCV show err.message at camera launch

Discussão em 'Python' iniciado por Stack, Agosto 23, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to launch a usb-camera at my raspberry pi, but when I try to start python code (opencv), it shows this message and stop a launch

    ASSERT: "false" in file qasciikey.cpp, line 501
    Aborted


    Can someone please explain me, what error is this? It doesnt work even with another codes as well... But camera works fine, when I open it in programs like Camorama webcam viewer. I read that this part makes a problem

    cv2.waitKey(20)


    So it makes in another code (when i uncomment it, it launch the code but dont show camera output) But in this code, even if I uncomment it, the code themself doesn't work: show upper error message

    Here is the code


    import numpy as np
    import cv2

    cap = cv2.VideoCapture(0)

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

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',frame)
    cv2.imshow('gray',gray)
    if cv2.waitKey(20) & 0xFF == ord('q'): # HERE
    break

    # When everything done, release the capture
    cap.release()
    cv2.destroyAllWindows()

    Continue reading...

Compartilhe esta Página