Computer Science, asked by shahzaibhamza45, 11 months ago

Write a computer program capable of reducing the number of intensity levels in an image
from 256 to 2, in integer powers of 2. The desired number of intensity levels needs to be a
variable input to your program

Answers

Answered by aakankshavatsal
0

Answer:

Program for Reduction of Gray Level is as below:

function img = reductionGrayLevel(image, level)

imageSize = size(image);

num = 256 / level;

 

img = uint8(zeros(imageSize(1), imageSize(2)));

 

for r = 1:1:imageSize(1)

 for c = 1:1:imageSize(2)

  img(r, c) = fix(double(image(r, c)) / num) * 255 / (level-1);

 end

end

end

Similar questions