What an unprocessed photo looks like: Dec 27, 2025 (Photography) Here’s a photo of a Christmas tree, as my camera’s sensor sees it: Sensor data with the 14 bit ADC values mapped to 0-255 RGB. It’s not even black-and-white, it’s gray-and-gray. This is becuase while the ADC’s output can theoretically go from 0 to 16382, the actual data doesn’t cover that whole range: Histogram of raw image The real range of ADC values is ~2110 to ~136000. Let’s set those values as the white and black in the image: Vnew = (Vold - Black)/(White - Black) Progress Much better, but it’s still more monochromatic then I remember the tree being. Camera sensors aren’t actually able to see color: They only measure how much light hit each pixel. In a color camera, the sensor is covered by a grid of alternating color filters: Let’s color each pixel the same as the filter it’s looking through: Bayer matrix overlay This version is more colorful, but each pixel only has one third of it’s RGB color. To fix this, I just averaged the values each pixel with it’s neighbors: Demosaicing results Applying this process to the whole photo gives the lights some color: Demosaiced tree However, the image is still very dark. This is because monitors don’t have as much dynamic range as the human eye, or a camera sensor: Even if you are using an OLED, the screen still has some ambient light reflecting off of it and limiting how black it can get. There’s also another, sneaker factor causing this: True linear gradient Our perception of brightness is non-linear. If brightness values are quantized, most of the ADC bins will be wasted on nearly identical shades of white while every other tone is crammed into the bottom. Because this is an inefficient use of memory, most color spaces assign extra bins to darker colors: sRGB gradient As a result of this, if the linear data is displayed directly, it will appear much darker then it should be. Both problems can be solved by applying a non-linear curve to each color channel t...
First seen: 2025-12-28 23:58
Last seen: 2025-12-29 22:01