Increase bit depth with multiple scans

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Flaver-D
Posts: 19
Joined: 2015-05-21T12:27:39-07:00
Authentication code: 6789

Increase bit depth with multiple scans

Post by Flaver-D »

Hi!
I'm starting to work on yet another project and still have no idea where to begin.
I'm thinking of building a special film scanner using a RaspberryPi to capture the images and then send them to my PC for processing.
I want to get some tiffs at 16 bit per pixel, but the device I plan on using will only record 8 bit per pixel (problem).
So, I'm planning on having it take a sequence of 3 identical images with a different exposure and combine them together to increase the bit depth.
Now, how would I go about doing something like that?
currently running ImageMagick 6.9.2-10 Q16 x64 2015-12-20 on Windows 10
François
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Increase bit depth with multiple scans

Post by fmw42 »

I am no expert on this, but I do not think you can go from 8-bits to 16-bits with multiple exposures. You can add detail, but not bit depth. See https://luminous-landscape.com/digital-blending
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Increase bit depth with multiple scans

Post by snibgo »

Going from multiple exposures of 8 bits, to a single image of 16 bits, is possible. But you need 256 8-bit exposures (fairly obviously).

If the scanner is exactly linear, combining the scans is easy.

But the scanner probably isn't exactly linear, so combining is difficult.

EDIT: Put another way: the scanner needs to be linear (and consistent) within 1 part in 65536 for this method to work. But if it was that good, it would be a 16-bit scanner. An 8-bit scanner is unlikely to be good enough.
snibgo's IM pages: im.snibgo.com
Flaver-D
Posts: 19
Joined: 2015-05-21T12:27:39-07:00
Authentication code: 6789

Re: Increase bit depth with multiple scans

Post by Flaver-D »

The main problem is that I plan on doing this with a raspberry pi... it's pretty limited on the hardware side.

I'm going to have to experiment a bit.
I did come across this late last night
convert *.tif -evaluate-sequence mean test.tif
I think I'm going to go from there and see how far I can push the hardware.

Thanks
François
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Increase bit depth with multiple scans

Post by snibgo »

Yes, experiment and see what happens.

If you have two inputs (at different exposures), at best this will double the amount of information, which adds one bit. Instead of 256 values, you have 512 values.

If you have four inputs, you might get two extra bits. And so on.
snibgo's IM pages: im.snibgo.com
Flaver-D
Posts: 19
Joined: 2015-05-21T12:27:39-07:00
Authentication code: 6789

Re: Increase bit depth with multiple scans

Post by Flaver-D »

I'm going at it from a photographic standpoint.
I know the digital sensor has at best a 3 f/stop range from highlight to shadow.
I also know that a B&W film can record a maximum of 9 f/stops (being very optimistic here).
So, if I take 3 scans of the negative at different shutter speeds, I should be able to get all 9 f/stops in... I think.
But will averaging the values give me a better result... I don't know
François
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Increase bit depth with multiple scans

Post by snibgo »

The f-stops of the original scene are not relevant.

Assuming your scanner uses light transmitted through the film, the important number is the ratio of the light transmitted by clear film (unexposed) and transmitted by maximum dark film (fully exposed). These are usually expressed as logs, so they are subtracted. See Dmax and Dmin, and Drange.
snibgo's IM pages: im.snibgo.com
Post Reply