[Python] I am reading an image with cv2.imread(), and converting it to grayscale. However why...

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

  1. Stack

    Stack Membro Participativo

    I went to read up the syntax of cv2.imread() method and it says that specifying the flag=0 will load the image in grayscale.

    The original image is this:

    Original Image

    And I executed the following code with the following libs, no errors.


    import cv2 import pytesseract import matplotlib import image
    ​

    img=cv2.imread("C:/Users/HP_Demo/Desktop/cv2/sample02.png",0)

    plt.imshow(img)

    plt.show()

    The result is this: Result image

    Continue reading...

Compartilhe esta Página