[Python] How do I tell if an image is gamma encoded when imported to numpy?

Discussão em 'Python' iniciado por Stack, Fevereiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am a bit confused about when an image is gamma encoded/decoded and when I need to raise it to a gamma function.

    Given an image 'boat.jpg' where the colour representation is labeled 'sRGB'. My assumption is that the pixel values are encoded in the file by raising the arrays to ^(1/2.2) during the save process.

    When I import the image into numpy using scikit-image or opencv I end up with a 3-dim array of uint8 values. Do these values need to be raised to ^2.2 in order to generate a histogram of the values, or when I apply the imread function, does that map the image into linear space in the array?

    from skimage import data,io
    boat = io.imread('boat.jpg')

    Continue reading...

Compartilhe esta Página