Increase/decrease contrast

PM
Posted By
Princess Morgiah
May 29, 2004
Views
400
Replies
5
Status
Closed
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

RF
Robert Feinman
May 29, 2004
In article <eJ%tc.137183$>,
says…
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah
Values greater than a certain value (lets say 127, for example) are made higher, so 200 might go to 220. Values lower than the threshold are made lower so 50 might go to 30. The amount of change, the pivot value and limits to which the changes are applied (clipping) are all variables that can be adjusted.
In addition there are techniques that examine adjacent areas to see if the specific value should be changed or not. The unsharp mask works this way.

Robert D Feinman
Landscapes, Cityscapes and Panoramic Photographs
http://robertdfeinman.com
mail:
MR
Mike Russell
May 30, 2004
Princess Morgiah wrote:
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah

Contrast refers to multiplying all the pixel values by a constant. If the constant is less than 1.0, contrast is reduced. If it’s greater than 1.0, contrast is increased.

Contrast’s partner, Brightness, adds a constant value to each pixel. Contrast and Brightness together allow many changes to be made to the image, but they all involve clipping the upper and/or lower ranges of pixel values.

There are better ways to manipulate the brightness of pixels, notably curves, where a curve is used to define an arbitrary function for modifying pixel values.


Mike Russell
www.geigy.2y.net
PM
Princess Morgiah
May 31, 2004
"Mike Russell" wrote in message
Princess Morgiah wrote:
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah

Contrast refers to multiplying all the pixel values by a constant. If the constant is less than 1.0, contrast is reduced. If it’s greater than 1.0, contrast is increased.

Contrast’s partner, Brightness, adds a constant value to each pixel. Contrast and Brightness together allow many changes to be made to the
image,
but they all involve clipping the upper and/or lower ranges of pixel
values.
There are better ways to manipulate the brightness of pixels, notably curves, where a curve is used to define an arbitrary function for
modifying
pixel values.

Mike, Robert,

Thank you both for your explanation. I get it now, although I’m not sure how to implement a test to recognize images that were altered this way.

Another day, another challenge 🙂

Thanks again,

Princess Morgiah
N
nomail
May 31, 2004
Mike Russell wrote:

Princess Morgiah wrote:
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah

Contrast refers to multiplying all the pixel values by a constant. If the constant is less than 1.0, contrast is reduced. If it’s greater than 1.0, contrast is increased.

I don’t think this is correct. If you multiply each pixel with a constant, you do indeed change the contrast, but you also change the brightness. *ALL* pixels in the histogram move to the right or to the left.

If you do not want the brightness to change, the histogram needs to be stretched or compressed around the middle value of 127. To achieve that, you must first substract 127 from all values, then multiply by a constant and finally add 127 again to all the values. So the correct formula becomes:

New value = (Original value – 127) * Constant + 127


Johan W. Elzenga johan<<at>>johanfoto.nl Editor / Photographer http://www.johanfoto.nl/
MR
Mike Russell
May 31, 2004
Johan W. Elzenga wrote:
Mike Russell wrote:

Princess Morgiah wrote:
Hi everyone,

Can anybody please explain what exactly happens when you increase or decrease the contrast of an image?

I am writing image recognition software and would like to know what (technically) happens to every pixel of an image that has it’s contrast increased or decreased.

Several searches on Google have led me to various sites explaining how to do it in Photoshop (and other applications), but now what is done to the images.

Thanks in advance,

Princess Morgiah

Contrast refers to multiplying all the pixel values by a constant. If the constant is less than 1.0, contrast is reduced. If it’s greater than 1.0, contrast is increased.

I don’t think this is correct. If you multiply each pixel with a constant, you do indeed change the contrast, but you also change the brightness. *ALL* pixels in the histogram move to the right or to the left.

If you do not want the brightness to change, the histogram needs to be stretched or compressed around the middle value of 127. To achieve that, you must first substract 127 from all values, then multiply by a constant and finally add 127 again to all the values. So the correct formula becomes:

New value = (Original value – 127) * Constant + 127

John,

You are correct. Photoshop does indeed do Brightness this way, keeping the center values the same.

There are other applications where Contrast is implemented as I described, where the overall brightness of the image is changed when contrast is increased. Adjusting the contrast of your computer monitor, or TV, for example, uses a simple multiplier.


Mike Russell
www.curvemeister.com
www.geigy.2y.net

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections