obelix
obelix

Reputation: 890

Increasing intensity values to Grasycale Image

I need to add intensity values to a grayscale image . However this assumes that I must make a check that my values remain in the range 0...255

How can i ensure that my result values are remain in the range?

How am i supposed to perform the afformentioned operation in matlab??

Upvotes: 0

Views: 350

Answers (2)

evading
evading

Reputation: 3090

If I understand you correctly, you want to increase the intensity of all the image pixels with the brightest one being 255. You can do this by

J = I .* (255/max(max(J)));

This will "scale" the brightness of your image so that the brightest part in the image will have a value of 255.

Upvotes: 1

Marcin
Marcin

Reputation: 238209

If your gray-scale level image is in uint8 format, it wont allow values greater than 255. For example,

I = uint8(rand(5)*255);
I(1,1) = I(1,1) + 300;
% value of I(1,1) will be 255, i.e. the max allowed value in uint8.

Upvotes: 2

Related Questions