MATLAB Answers


decreasing number of gray levels in a image

Asked by k.v.swamy
on 30 Nov 2012

hi all, can any one tell me how to decrease the no of gray levels in a image.i have to decrease in the powers of 2. regards k.v.swamy.


1 Answer

Answer by Image Analyst
on 30 Nov 2012

Perhaps I don't understand what you want, but why can't you simply divide the image by 2, 4, 8, or whatever power of 2 you want? For examples:

reducedGrayLevelsImage = originalGrayImage / 8;
reducedGrayLevelsImage = originalGrayImage / 16;
reducedGrayLevelsImage = originalGrayImage / 4;

Is that all you're looking for? Or is it more complicated than that? If so, explain the nuances that I've overlooked.


Discover MakerZone

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

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!