by _Microft · 5y ago · 0 comments
https://en.wikipedia.org/wiki/Bayer_filter
If you have a device that can output RAWs, you can look at a RAW image using the FOSS photo development program "Darktable". Choose "photosite color" as the "demosaic" filter to show the individual color channel values (and thereby the Bayer pattern of your camera).
But yes, after removing the filter, you have three times the number of pixels but you lost color information.
Nowadays they classical algorithms are being replaced by convnets that are trained on different BFA/image pairs and can get very good results -- at the cost of placing a convnet in the middle (so much higher computational cost, which can be offloaded to a GPU/AI accelerator if available).
If you want to see what a "pixel perfect" camera gives you, there are the Sigma cameras with Foveon sensors[0] or you can check the cameras that have a sensor-shift superresolution approach (some pro Olympus and Hasselblad models have this feature). Sensor-shift SR has the problem that it works best on static scenes, because it takes several images which are then later combined on a single picture, and if there's movement between the images it may introduce a few artifacts.
[0] which do full color data for every pixel, as they use silicon depth to filter wavelenth
https://www.dpreview.com/reviews/image-comparison/fullscreen...
It also makes it harder to undo the effects of the demosaicking algorithm, which may be important if you're doing things like subpixel superresolution.
All in all, the BFA is "good enough" most of the times. For the use cases where it isn't, you're either:
* Budget constrained and can't really afford not using BFA
* Able to (pay for and) use either a color wheel in front of your sensor, or go with prism + triple sensor.
* Bite the bullet and go with a "strange" color array. You'll probably need to work on the software side for demosaicing to get proper support and fix eventual artifacts.
[0] even more green! 20/36 photosites are green, 8 red 8 blue
[1] with W being white, meaning no color filter or "panchromatic cell". In theory this helps on dim light conditions.
More importantly, green is close to what your eyes perceive as luminance. This is important because you can perceive a lot more luma detail than chroma detail. This is why things like 4:2:2 sampling work.
If you read Bayer's original patent, he proposed using Y Cr Cb (luminance, colour part red, colour part blue) instead of GBR filters[0]. This would people optimal from a computer science perspective. Sadly it doesn't work physically. Sensing negative-blue and negative-red can't really be done with a simple filter.
I'm not exactly sure how the edge pixels are treated, but the difference in number between pixels and photosites should be on the order of a few thousand at most.
It is quite common to have more than the "nominal" number of pixels in a sensor array. So there are extra pixels for the edges.
This is obviously capturing less information than if you had a completely separate set of photosites for each pixel, but the megapixel count of cameras is nevertheless accurate.
Modern cameras sometimes come with a "pixel shift" function, which uses the image stabilization system to take 4 images each shifted one photosite from the others to construct an image where each pixel contains the information of 4 independent photosites with no sharing between the pixels.
The resolution of the final image is the same as a normal image, but the result is much clearer, and far less likely to suffer from blue/red moire.