[Python] opencv- I can't convert image to grayscale

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    I'm fetching a frame correctly from webcam:

    success, image = self.video.read()


    But when I try to change the mode of my frame to grayscale using the following code:

    gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)


    I get the following error:

    im = im[..., ::-1].transpose((0, 3, 1, 2)) # BGR to RGB, BHWC to BCHW, (n, 3, h, w)
    ValueError: axes don't match array


    What seems to be the problem ?

    Continue reading...

Compartilhe esta Página