Sign in to follow this  
Endemoniada

Gamma Midpoint/Offset ?

Recommended Posts

Endemoniada    430

Hi guys,

 

I'm trying to implement a Levels algorithm like Photoshop. I think I have it all figured out except for one thing.

 

If the black and white points are 0.0 and 1.0 the midpoint is 0.5 and the gamma at that point in 1.0. The problem I'm having is if the midpoint is at (say) 0.375, how do I make it so that midpoint has a gamma of 1.0 ?

 

I'm doing it like this:

 

v=pixelValue // (0...1)
if(v < a)
 v=a;
else if(v > b)
 v=b;
else
 v=gamma(v); // the midpoint between a and b has a gamma of 1.0

 

Thank you.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this