RaspberryPi + OpenCV + Webcam : VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

RaspberryPi + OpenCV + Webcam : VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

Ajouter :

import cv2


def show_webcam():
    cam = cv2.VideoCapture(0)
    while True:
        ret_val, img = cam.read()
        cv2.imshow('my webcam', img)
        if cv2.waitKey(1) == 27: 
            break  # esc to quit
    cv2.destroyAllWindows()


def main():
    show_webcam()


if __name__ == '__main__':
    main()

Erreur :

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

Solution :

LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l2convert.so python3 ./webcam01.py