Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





Pages (2): [1] 2 »   Last Thread  Next Thread
Author
Thread Post New Thread   

Exposure and histogram stretching
 

Don




quote this post edit post

IP Loged report this post

Old Post  05-27-04 - 12:14 AM  
PS 6. Somewhat theoretical questions but I hope someone responds.

Using Photoshop, how do I emulate image (histogram) changes resulting
from scanner exposure boost? This is not as simple as it may appear:

I ran some tests with my film scanner by increasing exposure by a
fixed amount (0.1 ev increments). I then plotted the pixel value
increase against ev increments and the result, instead of a straight
line, was a slightly upward sloping curve. In other words the
histogram did not just move to the right from scan to scan but was
actually "stretched" (as expected). Pixels on the left "moved" more
slowly than pixels on the right i.e. the distance between darkest and
brightest pixels increased with exposure boost (more dynamic range).

Taking the baseline scan (before exposure increases) and applying
brightness to it in Photoshop resulted in a different histogram. This
time the whole histogram just shifted to the right, but the distance
between the darkest and brightest pixels remained the same (same
dynamic range).

So, how do I emulate this non-linear exposure histogram "stretching"
in PS? I know, "use curves", but how exactly?

And while we're at it, given an arbitrary starting pixel value and a
specific EV exposure increase applied to it, does anyone happen to
know the formula to calculate the resulting pixel value?

Don.


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Xalinai




quote this post edit post

IP Loged report this post

Old Post  05-27-04 - 12:14 PM  
On Wed, 26 May 2004 18:47:11 GMT, phoney.email@yahoo.com (Don) wrote:

>PS 6. Somewhat theoretical questions but I hope someone responds.
>
>Using Photoshop, how do I emulate image (histogram) changes resulting
>from scanner exposure boost? This is not as simple as it may appear:
>
>I ran some tests with my film scanner by increasing exposure by a
>fixed amount (0.1 ev increments). I then plotted the pixel value
>increase against ev increments and the result, instead of a straight
>line, was a slightly upward sloping curve. In other words the
>histogram did not just move to the right from scan to scan but was
>actually "stretched" (as expected). Pixels on the left "moved" more
>slowly than pixels on the right i.e. the distance between darkest and
>brightest pixels increased with exposure boost (more dynamic range).
>
>Taking the baseline scan (before exposure increases) and applying
>brightness to it in Photoshop resulted in a different histogram. This
>time the whole histogram just shifted to the right, but the distance
>between the darkest and brightest pixels remained the same (same
>dynamic range).
>
>So, how do I emulate this non-linear exposure histogram "stretching"
>in PS? I know, "use curves", but how exactly?

If there is room on the brighter side then brightness will do what you
have seen - move the whole structure to the right.

To expand the dynamic range try "levels": The darkest point in your
image may be RGB (15,15,15), the brightest RGB (200,200,200) then the
186 intensities you have are spread over the full 256 value range
(this might lead to banding if there are too few intensities used).

Michael


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Don




quote this post edit post

IP Loged report this post

Old Post  05-27-04 - 05:14 PM  
On Thu, 27 May 2004 07:35:13 GMT, xalinai_Two@xalinai.de (Xalinai)
wrote:
 
...
>To expand the dynamic range try "levels": The darkest point in your
>image may be RGB (15,15,15), the brightest RGB (200,200,200) then the
>186 intensities you have are spread over the full 256 value range
>(this might lead to banding if there are too few intensities used).

The problem is this will be done in a linear fashion i.e. the inserted
"holes" will appear at regular intervals.

This is quite different to what happens when the scanner exposure is
boosted. There are more "new values" in the highlights than in the
shadows.

This is much easier to explain with a picture. Legend:
o=original pixel,
.=holes/new values.
The corresponding histograms after a boost would therefore look
something like this:

Levels histogram stretching:
o.o.o.o.o.o.o.o.o.o.o

Scanner exposure boost histogram stretching:
o.o..o...o....o.....o........o

What I want to know is how to perform the exposure type changes to the
histogram in Photoshop (v 6 here).

Don.


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Xalinai




quote this post edit post

IP Loged report this post

Old Post  05-27-04 - 05:14 PM  
On Thu, 27 May 2004 12:40:18 GMT, phoney.email@yahoo.com (Don) wrote:

>On Thu, 27 May 2004 07:35:13 GMT, xalinai_Two@xalinai.de (Xalinai)
>wrote:
> 
>... 
>
>The problem is this will be done in a linear fashion i.e. the inserted
>"holes" will appear at regular intervals.

If all your original intensities fit in the range of 15 to 200 then
your image only _has_ a maximum of 186 different intensities.

You see, if your image had exactly 186 pixels, each having one value
in the given range, then using the full dynamic range would leave some
values unused.

You can try and scan at twice the resolution needed and resample to
50% after using levels - that gives a fine homogenuous histogram as
each new pixel value is calculated from four pixels in the original
image. The more intelligent approach is to do it right.

>This is quite different to what happens when the scanner exposure is
>boosted. There are more "new values" in the highlights than in the
>shadows.

Have you noticed that there is a midpoint setting in levels? This
controls the distribution curve. Play with it for a while.

If you want to do it right, then correct the setting in the scanner
software while you are in the deeper color range of the scanner.
The function you need there is not exposure but setting of black and
white points, even gamma correction might help.

If you start correcting in the 8bit area in PS you are already lost.

Michael




Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Gernot Hoffmann




quote this post edit post

IP Loged report this post

Old Post  05-28-04 - 12:14 AM  
phoney.email@yahoo.com (Don) wrote in message news:<40b4e56c.5547930@news.individual.net>..
.
> PS 6. Somewhat theoretical questions but I hope someone responds.
>
> Using Photoshop, how do I emulate image (histogram) changes resulting
> from scanner exposure boost? This is not as simple as it may appear:
>
> I ran some tests with my film scanner by increasing exposure by a
> fixed amount (0.1 ev increments). I then plotted the pixel value
> increase against ev increments and the result, instead of a straight
> line, was a slightly upward sloping curve. In other words the
> histogram did not just move to the right from scan to scan but was
> actually "stretched" (as expected). Pixels on the left "moved" more
> slowly than pixels on the right i.e. the distance between darkest and
> brightest pixels increased with exposure boost (more dynamic range).
>
> Taking the baseline scan (before exposure increases) and applying
> brightness to it in Photoshop resulted in a different histogram. This
> time the whole histogram just shifted to the right, but the distance
> between the darkest and brightest pixels remained the same (same
> dynamic range).
>
> So, how do I emulate this non-linear exposure histogram "stretching"
> in PS? I know, "use curves", but how exactly?
>
> And while we're at it, given an arbitrary starting pixel value and a
> specific EV exposure increase applied to it, does anyone happen to
> know the formula to calculate the resulting pixel value?
>
> Don.


Don,

I can only comment your last question, but not by "exposure":

x1  old left  end of histogram
x2  old right end of histogram
u1  new left  end
u2  new right end
x   input
y   old output
v   new output

Old: y = x

New: v = x1 +(x-u1)*(x2-x1))/(u2-u1)

Test:
x=u1: v=x1
x=u2: v=x2

Two test points are sufficient, because itīs a linear function.
Can you replace (u2-u1)/(x2-x1) by "exposure" ?

A drawing would show:
Old: straight line through y(x1)=x1 and y(x2)=x2
New: straight line through v(u1)=x1 and v(u2)=x2

Best regards --Gernot Hoffmann


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Don




quote this post edit post

IP Loged report this post

Old Post  05-28-04 - 04:14 AM  
On Thu, 27 May 2004 14:15:18 GMT, xalinai_Two@xalinai.de (Xalinai)
wrote:
 
>
>If all your original intensities fit in the range of 15 to 200 then
>your image only _has_ a maximum of 186 different intensities.
>
>You see, if your image had exactly 186 pixels, each having one value
>in the given range, then using the full dynamic range would leave some
>values unused.
>
>You can try and scan at twice the resolution needed and resample to
>50% after using levels - that gives a fine homogenuous histogram as
>each new pixel value is calculated from four pixels in the original
>image. The more intelligent approach is to do it right.

We're moving somewhat off topic because my question was not really
about dynamic range (I only used dynamic range as an illustration to
demonstrate pixel "movement"). What I really I wanted to know was
about the laws governing pixel values after a certain exposure is
applied.
 
>
>Have you noticed that there is a midpoint setting in levels? This
>controls the distribution curve. Play with it for a while.
>
>If you want to do it right, then correct the setting in the scanner
>software while you are in the deeper color range of the scanner.
>The function you need there is not exposure but setting of black and
>white points, even gamma correction might help.
>
>If you start correcting in the 8bit area in PS you are already lost.

All that is very good advice but my question was really about theory
behind scanner exposure.

Anyway, Mike Russell gave a general explanation over in
"alt.graphics.photoshop". If anyone is interested I can repost it
here.

Thanks Michael!

Don.


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Don




quote this post edit post

IP Loged report this post

Old Post  05-28-04 - 04:14 AM  
On 27 May 2004 11:41:09 -0700, hoffmann@fho-emden.de (Gernot Hoffmann)
wrote:

>phoney.email@yahoo.com (Don) wrote in message news:<40b4e56c.5547930@news.individua
l.net>...
... 
>
>
>Don,
>
>I can only comment your last question, but not by "exposure":
>
>x1  old left  end of histogram
>x2  old right end of histogram
>u1  new left  end
>u2  new right end
>x   input
>y   old output
>v   new output
>
>Old: y = x
>
>New: v = x1 +(x-u1)*(x2-x1))/(u2-u1)
>
>Test:
>x=u1: v=x1
>x=u2: v=x2
>
>Two test points are sufficient, because itīs a linear function.
>Can you replace (u2-u1)/(x2-x1) by "exposure" ?
>
>A drawing would show:
>Old: straight line through y(x1)=x1 and y(x2)=x2
>New: straight line through v(u1)=x1 and v(u2)=x2
>
>Best regards --Gernot Hoffmann

Hi Gernot,

I'm afraid I don't follow completely. Can you please explain what do
you mean by input (x), old output (y) and new output (v)?

To explain it another way I was expecting the formula to look
something like:

u1 = x1 + offset1
u2 = x2 + offset2

or in a general form:

new pixel value = old pixel value + offset

where "offset" is a function of both exposure and of old pixel value.

My tests show that "offset" is directly proportional to both the
exposure and the starting (old) pixel value. So:
The larger the initial (old) pixel value, the larger the offset.
The larger the exposure, the larger the offset.

Also, I just learned elsewhere that gamma plays an important part in
all this and since I work in gamma 2.2 this may account for non-linear
pixel value progression.

Don.


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Gernot Hoffmann




quote this post edit post

IP Loged report this post

Old Post  05-28-04 - 09:14 AM  
phoney.email@yahoo.com (Don) wrote in message news:<40b66caa.8126420@news.individual.net>..
.
> Hi Gernot,
>
> I'm afraid I don't follow completely. Can you please explain what do
> you mean by input (x), old output (y) and new output (v)?
>
> To explain it another way I was expecting the formula to look
> something like:
>
> 	u1 = x1 + offset1
> 	u2 = x2 + offset2
>
> or in a general form:
>
> 	new pixel value = old pixel value + offset
>
> where "offset" is a function of both exposure and of old pixel value.
>
> My tests show that "offset" is directly proportional to both the
> exposure and the starting (old) pixel value. So:
> The larger the initial (old) pixel value, the larger the offset.
> The larger the exposure, the larger the offset.
>
> Also, I just learned elsewhere that gamma plays an important part in
> all this and since I work in gamma 2.2 this may account for non-linear
> pixel value progression.
>
> Don.

Don,

my previous suggestion was a stretching but not the expected one.
A new attempt:

The darkest entry in a histogram is at x1, the lightest at x2.
x1 should be mapped to u1, e.g. to u1=0.
x2 should be mapped to u2, e.g. to u2=1 (normalized instead of 255).

In a linear space this is a linear function:
v(x) = a + b*x

x is the input and v(x) the modified output.
We know two points:

a + b*x1 = u1
a + b*x2 = u2

The linear equations can be solved by Cramerīs rule.

v(x) = a + x*b = (u1*x2-u2*x1)/(x2-x1) + x*(u2-u1)/(x2-x1)

Special case: u1=0, u2=1
v(x) = (x-x1)/(x2-x1)
v(x1)=0 and v(x2)=1 as expected.

Application for Gamma encoded values
Input  x=0..255
Output v=0..255
Replace x by (x/255)^G
Replace v by Round(255*v^(1/G))

Best regards --Gernot Hoffmann


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Don




quote this post edit post

IP Loged report this post

Old Post  05-28-04 - 05:14 PM  
On 28 May 2004 00:17:12 -0700, hoffmann@fho-emden.de (Gernot Hoffmann)
wrote:

>Don,
>
>my previous suggestion was a stretching but not the expected one.
>A new attempt:
>
>The darkest entry in a histogram is at x1, the lightest at x2.
>x1 should be mapped to u1, e.g. to u1=0.
>x2 should be mapped to u2, e.g. to u2=1 (normalized instead of 255).
>
>In a linear space this is a linear function:
>v(x) = a + b*x
>
>x is the input and v(x) the modified output.
>We know two points:
>
>a + b*x1 = u1
>a + b*x2 = u2
>
>The linear equations can be solved by Cramerīs rule.
>
>v(x) = a + x*b = (u1*x2-u2*x1)/(x2-x1) + x*(u2-u1)/(x2-x1)
>
>Special case: u1=0, u2=1
>v(x) = (x-x1)/(x2-x1)
>v(x1)=0 and v(x2)=1 as expected.
>
>Application for Gamma encoded values
>Input  x=0..255
>Output v=0..255
>Replace x by (x/255)^G
>Replace v by Round(255*v^(1/G))
>
>Best regards --Gernot Hoffmann

Hi Gernot,

OK, that makes sense now!

I still have to chase up "Cramerīs rule" on the Net, but at least I
have to enough to get going.

Thanks very much, as always.

Don.


Post Follow-Up to this message ]
Re: Exposure and histogram stretching
 

Gernot Hoffmann




quote this post edit post

IP Loged report this post

Old Post  05-29-04 - 12:14 AM  
phoney.email@yahoo.com (Don) wrote in message news:<40b74a90.549634@news.individual.net>...

> On 28 May 2004 00:17:12 -0700, hoffmann@fho-emden.de (Gernot Hoffmann)
> wrote:
> 
>
> Hi Gernot,
>
> OK, that makes sense now!
>
> I still have to chase up "Cramerīs rule" on the Net, but at least I
> have to enough to get going.
>
> Thanks very much, as always.
>
> Don.


Don,

thanks for your friendly feedback.

My Google access is always delayed. Therefore this:

--------

Don,

I hope my idea is correct. Probably you will understand
that these contributions are always "under pressure".

Cramerīs rule says: a system of (here) two linear equations

a11*x1 + a12*x2=y1
a21*x1 + a22*x2=y2

is easily solved by determinants:

D  = ! a11 a12 ! = a11*a22-a12*a21
! a21 a22 !

D1 = ! y1  a12 ! = y1*a22 - y2*a12
! y2  a22 !

D2 = ! a11 y1  ! = y2*a11 - y1*a21
! a21 y2  !

x1 = D1/D

x2 = D2/D

Best regards --Gernot Hoffmann


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 04:07 AM. Post New Thread   
Pages (2): [1] 2 »   Previous Last Thread   Next Thread next
Computer Graphics with Photoshop archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top