MATLAB Answers


Altering intensity levels within an image

Asked by mona
on 8 Feb 2013

I would like to know with a black and white image of bit depth 8 (0-255 tones), how could I divide this range of 0-255 into two or more range for the purpose of decreasing the intensity levels of an image in Matlab? For instance, if a pixel has the intensity 192, how could I possibly bring it down to 2 by dividing the range of 0-255?



No products are associated with this question.

2 Answers

Answer by Image Analyst
on 8 Feb 2013

Simply divide by 2:

yourImage = uint8(yourImage / 2);

I have no idea what you are thinking with respect to having two or more ranges. You have only one range 0-255 and images can take any value in that range.


Answer by Youssef Khmou
on 8 Feb 2013

hi, you can use the function :

 J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)

for an example see :

 doc imadjust


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!