AusDLK
Famous Photographer
for what it's worth, I had Kolari modify a Fuji X100S for "full-spectrum" and I'm 100% satisfied. Apples and oranges, I understand, but I was impressed with them.
shawn
Mentor
Full spectrum on a x100 (or any camera) is not the sensor glass cover but a filter on top of that. On the x100 it is at the rear of the lens.
Shawn
Shawn
shawn
Mentor
Awesome work Brian. Any chance of passing the filter coefficient as an argument so you don’t have to make customized versions for different cameras? Or to put it in a text file for the same reason.
Shawn
Shawn
AusDLK
Famous Photographer
Shawn --
It is my understanding that a IR filter was removed from in front of the sensor to enable the full-spectrum operation. Not a sensor replacement, I know, but still a delicate operation.
It is my understanding that a IR filter was removed from in front of the sensor to enable the full-spectrum operation. Not a sensor replacement, I know, but still a delicate operation.
Full spectrum on a x100 (or any camera) is not the sensor glass cover but a filter on top of that. On the x100 it is at the rear of the lens.
Shawn
Awesome work Brian. Any chance of passing the filter coefficient as an argument so you don’t have to make customized versions for different cameras? Or to put it in a text file for the same reason.
Shawn
I use a "INIT" file for the M Monochrom software that I wrote, easy enough to do. Requires that you create a subdirectory on a drive and store the file on it, "Badlines.txt". If the file is not there, I set a default. My "MONOFIX" program restores bad columns, does not "Just" average over them. It computes the offset introduced by the bad pixel and adds it back to the underperforming column.
I figure to do the same for this one. Luuca has Two M9's. I'm going to make him an executable for each camera. "M9GREY" and "M9BLACK" with the coefficients preset. I'll use a Fortran "Parameter" statement to set the Slope and Offset. I will make the source code available, it is compiled using the Watcom V2 Fortran Compiler. Watcom also has a compatible C/C++ compiler. No assembly required. My code that runs under Extended DOS uses a lot of assembly language. My "MONOFIX" program is also command line, set it to the correct subdirectory and it batch processes all L*.DNG files, creates new C*.DNG files. That way the originals are intact if the software needs to be changed. This is a simple command line interface, set to the subdirectory with the files on it, run the program. No input- it does a "DIR" and processes all L*.DNG files it finds. Creates a new "C*.dng" file, 1:1 for the originals. SO- if running on the SD card, only fill it halfway.
raid
Dad Photographer
Brian for President! ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
luuca
Well-known
that's... fascinating.
![](https://i.ibb.co/jDqyCx6/M9BLACK.jpg)
The uniformity of the second camera is much better than the first. Less than 2% difference. The First camera was almost 10% off. BUT- Linear, and correctable in Software.
I made two executable files, run under Windows from XP up through WIN10.
Three images- I asked for a wide range, here are three images proper exposure, +3, and -3. The corrections look good.
![](https://i.ibb.co/5xVm8TQ/CAMPLE-0.jpg)
![](https://i.ibb.co/nBtWfnn/CAMPLE-3.jpg)
![](https://i.ibb.co/Zx9FZgK/CAMPLE-3.jpg)
Again- not many choices for M9P and M Monochrom owners. MAXMAX is the only company willing to do a repair. I'm not going to guess why the uniformity error crept in- but I know other shops will not try to remove the cover glass from the M9P and M Monochrom. I'm happy that Fortran could help. Anyone that wants the source code is welcome to it. My style pushes the limit of the language. Back in the 1970s the joke going around the campus was "Real programmers write self-modifying code in Fortran". But was not necessary for this problem. And I use Wordstar to write all my code. Like that guy that does those medieval stories. I always tell my Daughter when I was young everyone used Fortran and dinosaurs roamed the Earth.
I plan on writing a calibration program where the user provides a set of images as Luuca did, minus 2, minus 1, plus 0, plus 1, and plus 2. I'm writing a calibration program to use those files, generate the slope and offset for the correction, and output the slope and intercept values to a file. The user will then run the correction program which will read the values in.
For people with more than one camera, I'll figure out something. Maybe go by the Serial Number of the camera for the filename. The SN is in the DNG files.
Once it is working- I'll post a thread in my forum with download links for the .exe files and the source code. Right now- still working mostly at home. All my lens projects including the Sonnar write-up are "on hold". This little project- gives me a good reason to use the Watcom Fortran compiler. I am slowly switching my code to this much newer (2017) compiler. I pulled in the curve fitting routines- 1988, adapted from a book written in 1969.
For people with more than one camera, I'll figure out something. Maybe go by the Serial Number of the camera for the filename. The SN is in the DNG files.
Once it is working- I'll post a thread in my forum with download links for the .exe files and the source code. Right now- still working mostly at home. All my lens projects including the Sonnar write-up are "on hold". This little project- gives me a good reason to use the Watcom Fortran compiler. I am slowly switching my code to this much newer (2017) compiler. I pulled in the curve fitting routines- 1988, adapted from a book written in 1969.
luuca
Well-known
fantastic.
I can't believe you already were in programming in the '70s... who needed software back in the '70s?? it should be the very early birth of this kind of things
I can't believe you already were in programming in the '70s... who needed software back in the '70s?? it should be the very early birth of this kind of things
I was using the Internet to "Telecommute" to work in 1980, while I was going to school.
I earned my way through college by writing Fortran code for an $8M Supercomputer- doing image processing. Ahh, Heavy Metal.
I have the first cut of the Calibration Program that automatically generates the coefficient file working. Results agree with those done manually. The user MUST name the files M2.dng, M1.dng, P0.dng, P1.dng, and P2.dng. It outputs "coeff.dat" now, but I'll probably look for the camera SN. (edit- the camera SN is stored at location '5F0'x and '860'x in the dng files. That means you can check the two locations to agree before using them for a filename. It also means the correction program can open the coefficient file based on Serial Number stored in each DNG file- assuming DNG version does not change, but I've not seen that happen)
COEFFICIENT FILE
-1.096
0.9846
Those two numbers are used to correct the image. Slope=0.9846, Offset -1.096 .
The programs will only work on uncompressed images, as stored by the camera. Opening and saving using Photoshop changes the size of the image in the DNG file. Compressed DNG- nightmare.
Not bad- I started the mod this morning to automate the calibration. My graphics code had the necessary routines, but only runs under DOS or an XP DOS window. I needed to port the fitting routines to the new compiler. They were first published over 50 years ago.
I earned my way through college by writing Fortran code for an $8M Supercomputer- doing image processing. Ahh, Heavy Metal.
I have the first cut of the Calibration Program that automatically generates the coefficient file working. Results agree with those done manually. The user MUST name the files M2.dng, M1.dng, P0.dng, P1.dng, and P2.dng. It outputs "coeff.dat" now, but I'll probably look for the camera SN. (edit- the camera SN is stored at location '5F0'x and '860'x in the dng files. That means you can check the two locations to agree before using them for a filename. It also means the correction program can open the coefficient file based on Serial Number stored in each DNG file- assuming DNG version does not change, but I've not seen that happen)
COEFFICIENT FILE
-1.096
0.9846
Those two numbers are used to correct the image. Slope=0.9846, Offset -1.096 .
The programs will only work on uncompressed images, as stored by the camera. Opening and saving using Photoshop changes the size of the image in the DNG file. Compressed DNG- nightmare.
Not bad- I started the mod this morning to automate the calibration. My graphics code had the necessary routines, but only runs under DOS or an XP DOS window. I needed to port the fitting routines to the new compiler. They were first published over 50 years ago.
Range-rover
Mentor
I think it's a shame you have to go though all this with a Leica camera, you spend
so much for the camera only to have the sensor corrode, it show's Leica really
doesn't care about their customers, it's not like the film day's when you could
get parts one two three. What Leica should of done was find better replacement
source for their sensors maybe a third party that would make the sensor, but that's
the way the Digital world is now when it breaks get a new one and throw the old
one away.
so much for the camera only to have the sensor corrode, it show's Leica really
doesn't care about their customers, it's not like the film day's when you could
get parts one two three. What Leica should of done was find better replacement
source for their sensors maybe a third party that would make the sensor, but that's
the way the Digital world is now when it breaks get a new one and throw the old
one away.
The sensor corrosion issue- that was Kodak choosing poorly. They used S8612 glass for their full-frame DSLR's, but with that camera- thick glass sandwich to protect from corrosion. Optically- S8612 glass is the most efficient IR absorber available, with high transmittance in the visible. Leica ran a program for several years to replace the sensor for free, then for about 25% of the actual cost of the sensor. CCD production ended. I'm lucky to have new sensors in my M9 and M Monochrom. My M Monochrom- bought in 2012.
I fully understand the desire to keep using the M9, M9P, and M Monochrom. They produce images like no other camera. I've used my M9 for over 10 years, see no reason to replace it.
If this problem can be solved by "just typing", after all writing Code is Just Typing, I'm happy to help. Plus my wife pointed out that I am geeking out over this. Too Much Fun.
The calibration code reads the Sn from the DNG file, creates a calibration file using the serial number if verified in both locations in the DNG file. Now all I need to do is have the correction program read the SN from the DNG file being corrected and use it to open the proper calibration file. The user will need to store the cal files in a subdirectory, like "C:\M9CAL".
I fully understand the desire to keep using the M9, M9P, and M Monochrom. They produce images like no other camera. I've used my M9 for over 10 years, see no reason to replace it.
If this problem can be solved by "just typing", after all writing Code is Just Typing, I'm happy to help. Plus my wife pointed out that I am geeking out over this. Too Much Fun.
The calibration code reads the Sn from the DNG file, creates a calibration file using the serial number if verified in both locations in the DNG file. Now all I need to do is have the correction program read the SN from the DNG file being corrected and use it to open the proper calibration file. The user will need to store the cal files in a subdirectory, like "C:\M9CAL".
luuca
Well-known
I think I will keep my m9 till the end (mine or its end
)
santino
FSU gear head
Impressive!
You rendered two bricks into useable m cameras. You are not only sonnar Brian but also fortran Brian. I think the rff community is thankful for every comment you make!
You rendered two bricks into useable m cameras. You are not only sonnar Brian but also fortran Brian. I think the rff community is thankful for every comment you make!
Thankyou.
Do you know why the Jedi Knights use Fortran?
From Yoda - "In Fortran there is no TRY, there is only DO."
Nikki took a class in Java, meaning I learned Java. It has "TRY".
Using the Serial Number stored in each DNG file works. That way someone with more than one M9 can just run the code and not worry about which calibration file is selected. Everything can run as a batch process, the program will process all DNG files, even if files from different M9 cameras are mixed together. If someone sends an M Monochrom and gets this problem- easy enough to add to the code.
I checked some of my old DNG files from 2012- Leica has not changed the file structure with the newer firmware versions, so I think it safe to assume the Serial Number of the camera is in the same place for the file. It's in two locations, the Code checks that they match. If they do: it uses the Serial Number stored in the DNG file to create the calibration file in "M9CAL" and stores it in a directory called "C:\M9CAL". The correction program uses the Serial Number of the DNG file being processed to select the correct calibration file, "M9NUC1"- which will get a new name like "M9FIX" or such.
I copied DNG files from Luuca's two cameras into the same directory and ran the code on all of them- Serial Number properly selected the calibration files on disk.
Do you know why the Jedi Knights use Fortran?
From Yoda - "In Fortran there is no TRY, there is only DO."
Nikki took a class in Java, meaning I learned Java. It has "TRY".
Awesome work Brian. Any chance of passing the filter coefficient as an argument so you don’t have to make customized versions for different cameras? Or to put it in a text file for the same reason.
Shawn
Using the Serial Number stored in each DNG file works. That way someone with more than one M9 can just run the code and not worry about which calibration file is selected. Everything can run as a batch process, the program will process all DNG files, even if files from different M9 cameras are mixed together. If someone sends an M Monochrom and gets this problem- easy enough to add to the code.
I checked some of my old DNG files from 2012- Leica has not changed the file structure with the newer firmware versions, so I think it safe to assume the Serial Number of the camera is in the same place for the file. It's in two locations, the Code checks that they match. If they do: it uses the Serial Number stored in the DNG file to create the calibration file in "M9CAL" and stores it in a directory called "C:\M9CAL". The correction program uses the Serial Number of the DNG file being processed to select the correct calibration file, "M9NUC1"- which will get a new name like "M9FIX" or such.
I copied DNG files from Luuca's two cameras into the same directory and ran the code on all of them- Serial Number properly selected the calibration files on disk.
Bill Blackwell
Leica M Shooter
This might be a stupid question, but I'm curious where you put this code. Is it downloaded into the camera's firmware somehow (if so, how), or is it added to software like PS or LR (a filter maybe) for post-processing?WRITE( *, *) 'APPLY NUC CORRECTION '
DO 10 J= 1, ROWS
DO 10 I= 1, COLUMNS/ 2
X= FLOAT( IMAGE( I, J))
Y= X* SLOPE+ OFFSET
BIGVALUE= INT( Y+ 0.5)
IF( BIGVALUE .LT. 0) BIGVALUE= 0
IF( BIGVALUE .GT. 16383) BIGVALUE= 16383
IMAGE( I, J)= VALUE( 1)
10 CONTINUE
The code for the NUC was easy.
Fixing my routine originally written to change image tags in the DNG file to "Linear DNG"... Whoops. Took longer than fixing the non uniformity problem.
Just to add- I suspect that the linear fit will not change much with the Plus 2 and Plus 3 images, but those will help to cover the full intensity range. The Plus 1 of the 18% grey card gives about 25% of saturation.
shawn
Mentor
Thankyou.
Do you know why the Jedi Knights use Fortran?
From Joda - "In Fortran there is no TRY, there is only DO."
Nikki took a class in Java, meaning I learned Java. It has "TRY".
Using the Serial Number stored in each DNG file works. That way someone with more than one M9 can just run the code and not worry about which calibration file is selected. Everything can run as a batch process, the program will process all DNG files, even if files from different M9 cameras are mixed together. If someone sends an M Monochrom and gets this problem- easy enough to add to the code.
I checked some of my old DNG files from 2012- Leica has not changed the file structure with the newer firmware versions, so I think it safe to assume the Serial Number of the camera is in the same place for the file. It's in two locations, the Code checks that they match. If they do: it uses the Serial Number stored in the DNG file to create the calibration file in "M9CAL" and stores it in a directory called "C:\M9CAL". The correction program uses the Serial Number of the DNG file being processed to select the correct calibration file, "M9NUC1"- which will get a new name like "M9FIX" or such.
I copied DNG files from Luuca's two cameras into the same directory and ran the code on all of them- Serial Number properly selected the calibration files on disk.
Nice! That is an elegant way of making it easier to work with.
Shawn
shawn
Mentor
This might be a stupid question, but I'm curious where you put this code. Is it downloaded into the camera's firmware somehow (if so, how), or is it added to software like PS or LR (a filter maybe) for post-processing?
It is part of Brian's code from his executable.
Shawn
The "code snippet" is the portion of the Source Code that actually applies the correction. Most of the source code is reading in the DNG file, parsing the file structure, processing the image data, and producing the calibration file. Many hundreds of lines of code to get it to that little loop that applies the correction. I find it easiest to run the code on the SD card pulled from the camera and placed in the computer. You can also copy the files to the computer and run the code. I'll start a thread on the codes and how to generate the calibration. The trick to getting the calibration is to take the images of the grey card and give them the proper names.
The M Monochrom DNG files have the Serial Number at offset '424'x and '688'x. The name 'M Monochrom' appears at offset '3E4'x and '3F8'x. It will be easy to add that to the code. The M9 and M Monochrom store the same sized image arrays, once you parse down to that portion of the file.
The M Monochrom DNG files have the Serial Number at offset '424'x and '688'x. The name 'M Monochrom' appears at offset '3E4'x and '3F8'x. It will be easy to add that to the code. The M9 and M Monochrom store the same sized image arrays, once you parse down to that portion of the file.
Share:
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.