In Fortran- I read the DNG file into a 1-D buffer, parse the Tags, find the image dimensions, find the start of the image- then pass that point to the processing subroutine along with the columns and rows and declare it a 2D array. I coded my first digital image processing algorithm in 1980.
I have the spectral response of the KAF-18500 sensor for the M9 and KAF-10500 for the M8. I used the Yellow Y48 filter- means the Blue pixels pick up only green. About 1/2 or so the sensitivity. Then equalize the values- so it basically gives 3 pixels of green and 1 of red for every 2x2 bayer pattern. Some improvements could be added- like a more sophisticated interpolation. I wanted to see how far a color camera could be pushed to produce monochrome. This is after buying the M Monochrom. I called Kodak when the M9 came out and asked for one. The engineer at Kodak was all for it, preaching to the choir. He said they had a meeting with Leica in a month and he would bring it up.
Using a Monochrome camera for monochrome images produces a cleaner file that requires much less post-processing. You can get good results from a modern high-pixel count camera. I had the M9, and then bought the M Monochrom- because I knew in advance what the real differences would be. No Interpolation Artifacts - that alone makes it worth while to me. I spent a lot of time writing image processing code, including what would be called "Machine Vision". Stupid artifacts. Mess up good algorithms. And I just like using the monochrome camera.
Plus, I just like writing code.
1936 Carl Zeiss Jena 5cm F1.5, wide-open with a Zeiss Medium Yellow filter. Straight exports from LR6.
cameraderie.org
The older CCD cameras can pick up bad columns, and have to be sent to Leica for "remapping". That means they just call a column dead and average over it. I fixed it in post, did an algorithm that calculates the DC offset of the bad column and adds it back in. Something similar could be done when converting a color image to monochrome, knowing the spectral response, "guessing" the color based on nearest neighbors, and restoring the offset.
I especially like that Pentax offers uncompressed DNG files. Should be able to adapt my Gamma curve to it.
These are Monochrome conversion that start with a Y48 filter on the camera, custom demosaic. This was a test of an early version of code.
View attachment 9636View attachment 9638View attachment 9635View attachment 9637