google / butteraugli

butteraugli estimates the psychovisual difference between two images
Apache License 2.0
1.96k stars 137 forks source link

Clarification needed on the input RGB format #53

Closed zorrozork closed 5 years ago

zorrozork commented 5 years ago

The butteraugli.h header contains this comment:

// Value of pixels of images rgb0 and rgb1 need to be represented as raw // intensity. Most image formats store gamma corrected intensity in pixel // values. This gamma correction has to be removed, by applying the following // function: // butteraugli_val = 255.0 * pow(png_val / 255.0, gamma); // A typical value of gamma is 2.2. It is usually stored in the image header. // Take care not to confuse that value with its inverse. The gamma value should // be always greater than one. // Butteraugli does not work as intended if the caller does not perform // gamma correction.

Is this correct and a conversion to "raw intensity" is needed for the input images? And if so is the result of the above mentioned gamma correction that the input is in linear RGB? So for example when applied to standard definition video with matrix '601' the frames should be converted to linear RGB before applying Butteraugli? Thanks!

jyrkialakuijala commented 5 years ago

On Sun, Feb 24, 2019 at 2:03 PM zorrozork notifications@github.com wrote:

Is this correct and a conversion to "raw intensity" is needed for the input images?

Yes.

And if so is the result of the above mentioned gamma correction that the input is in linear RGB? So for example when applied to standard definition video with matrix '601' the frames should be converted to linear RGB before applying Butteraugli? Thanks!

You need to convert into linear RGB light where RGB are sRGB. These values may be (slightly) negative for wide gamut use. The normalization value of 255 corresponds roughly to 120-200 nits.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/butteraugli/issues/53, or mute the thread https://github.com/notifications/unsubscribe-auth/AIqkTAcxOsAwhM0gz3NVXDlu_Dis685Vks5vQwwngaJpZM4bOzOY .

zorrozork commented 5 years ago

Thanks for the clarification, it's all clear now.