"Inverse" contrast masking

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

I recently discovered digital contrast masking but now I want to do
the reverse. The story so far...

I use contrast masking when an image has a wider dynamic range than
the scanner is capable of. This means the scanned image either has
dark shadows or burnt out highlights. Contrast masking "shrinks" the
image's dynamic range to that of the scanner so both shadows and
highlights are properly exposed.

In practice, this is done by scanning twice, once for shadows, and
once for highlights. By layering the dark image on top, and then
applying to it a layer mask created from the light image on the bottom
plus some Gaussian blur, the resulting image is the best of both
worlds.

However, what when an image has a narrower dynamic range than that of
the scanner? Sure, I can just use Levels but that doesn't do anything
to actually extend the dynamic range. So, I've been playing with
contrast masking and I came up with two methods:

1. Put dark image on top, light on the bottom. Apply *inverse* layer
mask to top image created from the light image on the bottom.

2. Put light image on top, the dark one on the bottom. Apply layer
mask to top image created from the dark image on the bottom.

I take it this is a known procedure - I doubt I invented something
new... ;-) So, what is the canonical way of doing this? Which of the
above two methods is "better"? Thanks!

Don.
 
However, what when an image has a narrower dynamic range than that of
the scanner? Sure, I can just use Levels but that doesn't do anything
to actually extend the dynamic range. So, I've been playing with
contrast masking and I came up with two methods:

1. Put dark image on top, light on the bottom. Apply *inverse* layer
mask to top image created from the light image on the bottom.

2. Put light image on top, the dark one on the bottom. Apply layer
mask to top image created from the dark image on the bottom.

I take it this is a known procedure - I doubt I invented something
new... ;-) So, what is the canonical way of doing this? Which of the
above two methods is "better"? Thanks!


Interesting. I've never heard of this being done,
or read about it in my Photoshop books. What
is the advantage over using Levels or Curves?

I can certainly see the need in the case where the
image DR exceeds the scanner's (and have used
this method on many occasions.) But not the other
way around.

Maybe your idea *is* original. Can you post
examples showing the advantages or benefits?


rafe b.
http://www.terrapinphoto.com
 
Don said:
I recently discovered digital contrast masking but now I want to do
the reverse. The story so far...

I use contrast masking when an image has a wider dynamic range than
the scanner is capable of. This means the scanned image either has
dark shadows or burnt out highlights. Contrast masking "shrinks" the
image's dynamic range to that of the scanner so both shadows and
highlights are properly exposed.

In practice, this is done by scanning twice, once for shadows, and
once for highlights. By layering the dark image on top, and then
applying to it a layer mask created from the light image on the bottom
plus some Gaussian blur, the resulting image is the best of both
worlds.

However, what when an image has a narrower dynamic range than that of
the scanner? Sure, I can just use Levels but that doesn't do anything
to actually extend the dynamic range. So, I've been playing with
contrast masking and I came up with two methods:

1. Put dark image on top, light on the bottom. Apply *inverse* layer
mask to top image created from the light image on the bottom.

2. Put light image on top, the dark one on the bottom. Apply layer
mask to top image created from the dark image on the bottom.

I take it this is a known procedure - I doubt I invented something
new... ;-) So, what is the canonical way of doing this? Which of the
above two methods is "better"? Thanks!

Don.


Hello

Try the layer options sliders in Photoshop.Double clich the layer. Use
the ALT key to separate the pointers.
That should work as well.

Mike Engles
 
SNIP
In practice, this is done by scanning twice, once for shadows,
and once for highlights.

This is only going to help for scanners that have a limited dynamic range.
If the scanner has at least 12 *clean* bits per channel coming out of the
ADC, it will be capable of capturing a density range of 3.6. This means that
the scanner ADC would probably need to provide 14-b/c data, of which 2-b/c
is noise.
By layering the dark image on top, and then applying to it a layer
mask created from the light image on the bottom plus some
Gaussian blur, the resulting image is the best of both worlds.

Assuming you scan a single frame with a density range of less than 4.5, it
is possible to store that data in a single 15-bit (Photoshop works with
15-b/c) image (2 layers).
If you make sure your two images are linear gamma (Raw), and you divide the
long exposure dark-end scan by the scan exposure increase it received
relative to the bright-end scan, their densities should connect pretty well,
even without masking. If you feed a flattened version of such a montage as
Raw TIFF file to VueScan, you can even benefit of it's color balancing and
tonescaling
functionality. Photoshop doesn't have true Gamma correction capability
unless you use a pre-calculated Curve map.
However, what when an image has a narrower dynamic range than
that of the scanner? Sure, I can just use Levels but that doesn't do
anything to actually extend the dynamic range.

I don't follow what you mean. If the film dynamic range fits withing the
scanner capabilities, what's the problem? Or are you trying to tonescale the
image, by selectively boosting the shadows?
So, I've been playing with contrast masking and I came up with two
methods:

1. Put dark image on top, light on the bottom. Apply *inverse* layer
mask to top image created from the light image on the bottom.

2. Put light image on top, the dark one on the bottom. Apply layer
mask to top image created from the dark image on the bottom.

I take it this is a known procedure - I doubt I invented something
new... ;-) So, what is the canonical way of doing this? Which of the
above two methods is "better"? Thanks!

You are going to have to choose depending on image content, and you can also
include layer blending options in the top layer (the blend being gradually
dependent on the luminance of the bottom layer).
The problem is that the output RGB values after Gamma correction (e.g. 2.20)
are not related to the input luminances any longer so all sure bets are off.

I have already suggested a more automatic tonescaling option to Ed Hamrick,
based on the method used in the Radiance software package by Greg Ward
Larson. It involves adaptive histogram equalization, or histogram adjustment
as Greg calls it in
http://radsite.lbl.gov/radiance/papers/lbnl39882/tonemap.pdf (includes some
pseudocode). If the original link doesn't work, you can try this mirror
http://www.bwk.tue.nl/fago/radiance/papers/lbnl3988/tonemap.pdf. The
original method is based on adaptive equalization of scene luminances, by
restricting high gradients in the cumulative histogram with a maximum
increment. A similar approach can be easily applied to the Raw data.

And as for your question, because the wheel has been reinvented before ;-),
see
http://www.erik-krause.de/blending/ for an approach that works reasonably
well, and he has made a Photoshop action to automate the task.

Bart
 
Interesting.

Yeah, I do that... ;o)
I've never heard of this being done,
or read about it in my Photoshop books.

And there's probably a very good reason why not, which I'll find out
soon, I expect... :-)
What
is the advantage over using Levels or Curves?

This is my thinking (do feel free to shoot holes):

Levels are a blunt instrument. All they do is shuffle "empty" pixels
around. You're still left with the same amount of *distinct* values
i.e., the same dynamic range, only these values are moved to a
different place.

Here's a specific example:

Scan 1 at Analog Gain = 0.0 results in pixel range: 0 - 201.
Scan 2 at Analog Gain = 1.0 results in pixel range: 20 - 255.

Taking Scan 2 and using Levels will still result in only 236 distinct
values. By "inverse" contrast masking the two scans I get an image
occupying the full dynamic range 0-255 with no "holes" i.e. 256
distinct values.

The above image is actually not a very good example but that's what I
used for testing. Other images with an even narrower range should
benefit considerably more.
Maybe your idea *is* original. Can you post
examples showing the advantages or benefits?

It's early days but I do see increase in contrast without loss of
detail as well as no sight of "choppy" gradients (!) which Levels tend
to show in extreme cases. Still have to do more testing with different
images, but I just thought I ask and not re-invent the wheel.

On the other hand, if I did invent the wheel, the name to be used for
future credit is: Maple, Don Maple... ;o)

Don.
 
This is only going to help for scanners that have a limited dynamic range.

fx: Raises hand vigorously and shouting "Pick me, pick me"... ;-)

Seriously though, LS-30 here. Read: 10 bits internal, but only 8 bits
available externally. So I need every little bit (sic) I can get.
I don't follow what you mean. If the film dynamic range fits withing the
scanner capabilities, what's the problem? Or are you trying to tonescale the
image, by selectively boosting the shadows?

Yes, but not only shadows (please see explanation in my response to
Rafe).
The problem is that the output RGB values after Gamma correction (e.g. 2.20)
are not related to the input luminances any longer so all sure bets are off.

I am, indeed, doing it with Gamma corrected images (2.2) at this time.

Speaking of Luminance, I find composite RGB histogram much better for
contrast masking. Due to Luminance relying on assigning different
weights to individual RGB channels relying on Luminance histogram
resulted in clipping. I started with Luminance but switched to
composite RGB histogram after studying the actual numerical pixel
counts obtained from the Wide Histogram PS plug-in.
And as for your question, because the wheel has been reinvented before ;-),
see
http://www.erik-krause.de/blending/ for an approach that works reasonably
well, and he has made a Photoshop action to automate the task.

Yes, I'm aware of that and it was one of my sources for learning
digital image blending (I think it was actually you who suggested it
last time) but that deals with "regular" contrast masking and not the
"inverse" kind I have been playing with.

Don.
 
Try the layer options sliders in Photoshop.Double clich the layer. Use
the ALT key to separate the pointers.
That should work as well.

I didn't know that! It's a very good tip. Thanks, Mike!

Don.
 
Back
Top