What an unprocessed photo looks like

https://news.ycombinator.com/rss Hits: 23
Summary

What an unprocessed photo looks like: Dec 27, 2025 (Photography) Here鈥檚 a photo of a Christmas tree, as my camera鈥檚 sensor sees it: Sensor data with the 14 bit ADC values mapped to 0-255 RGB. It鈥檚 not even black-and-white, it鈥檚 gray-and-gray. This is becuase while the ADC鈥檚 output can theoretically go from 0 to 16382, the actual data doesn鈥檛 cover that whole range: Histogram of raw image The real range of ADC values is ~2110 to ~136000. Let鈥檚 set those values as the white and black in the image: Vnew = (Vold - Black)/(White - Black) Progress Much better, but it鈥檚 still more monochromatic then I remember the tree being. Camera sensors aren鈥檛 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鈥檚 color each pixel the same as the filter it鈥檚 looking through: Bayer matrix overlay This version is more colorful, but each pixel only has one third of it鈥檚 RGB color. To fix this, I just averaged the values each pixel with it鈥檚 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鈥檛 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鈥檚 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