Jump to content
  • Advertisement
Sign in to follow this  
Mike.Popoloski

Photoshop Levels Command

This topic is 4520 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how to perform the photoshop levels command in C++? I looked but although I could find other filters I could not find this one. Unless it is a combination of brightness / contrast? Any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
The "Auto levels" command in photoshop adjusts the image's dynamic range by finding the black and white spots (darkest and brightest areas, respectively) of an image and scales the brightness of the pixels so that the full dynamic range of brightness gets used.

To perform this in c++, first find the minimum and maximum brightness values of the image (weighted with wavelength coefficients for best results), and move and scale the original colors to this range by using a simple matrix.

Share this post


Link to post
Share on other sites
Thank you very much! One more question, what about the normal levels command, that allows you to adjust them manually? Does this just let you set the maximum and minimum brightness yourself, without extracting them from the image?

Share this post


Link to post
Share on other sites
Quote:
Original post by ussnewjersey4
Thank you very much! One more question, what about the normal levels command, that allows you to adjust them manually? Does this just let you set the maximum and minimum brightness yourself, without extracting them from the image?


Yes, and you can also set the midpoint value, effectively adjusting the gamma of the dynamic range. In addition, the manual command lets you perform color equalizing by compensating against the colors that you designate as the reference points. You can access this functionality thru the option dialog inside the tool.

The manual tool does have an "auto" button which sets the black and white point to match those that the auto levels command will find.

Share this post


Link to post
Share on other sites
Thank you. Ratings++. OK, one more question again :) I was doing some googling on the gaussian noise filter, and I came up with the following equation:

Being a non-math genious, I was wondering if you could explain to me how to use this to add gaussian noise to my image.

Share this post


Link to post
Share on other sites
I'mn not an expert in classical mathematical notation either, but this is an one-dimensional function that, when given z, returns a scalar representing the inverse variance of a data set raised to an inverse power as defined in the upper right corner of the equation.

I don't remember all the symbol's meanings, as I learned math by programming. It may be wise to ask in the math forum about this [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!