Should you normalize RGB values by 255 or 256?
5 hours ago
- #Image Processing
- #Floating-Point Conversion
- #Quantization
- The article compares two methods for converting 8-bit integer image data to floating-point: standard division by 255 and alternative division by 256 with a 0.5 bias.
- The standard approach maps integer 0 to 0.0 and 255 to 1.0, ensuring black is 0.0, but it results in stretched bins at extremes, making extreme values less frequent in output.
- The alternative approach places floating-point values midway between integers, offering exact midpoint positions and potentially better dithering, but ties logic to 8-bit dynamic range.
- From a quantization perspective, the standard method is a mid-riser quantizer with L=255, while the alternative is a mid-tread quantizer with L=256, affecting reconstruction error and bandwidth usage.
- For processing images from unknown sources, division by 255 is recommended for compatibility; division by 256 may be considered only if controlling both saving and loading, despite minimal precision gains.