pkg load image clear clc I = imread('peppers.bmp'); I2 = I; I3 = I; for i = 1 : 256 for j = 1 :256 if (I(i,j)<128) I2(i,j) = I(i,j) - 0.3*I(i,j); else I2(i,j) = I(i,j) + 0.3*I(i,j); endif endfor endfor for i = 1 : 256 for j = 1 :256 if (I(i,j)<128) I3(i,j) = I(i,j) + 0.3*I(i,j); else I3(i,j) = I(i,j) - 0.3*I(i,j); endif endfor endfor subplot(2,3,1), imshow(I, [0 255]), title('Original') subplot(2,3,2), imshow(I2, [0 255]), title('Transformed 1') subplot(2,3,3), imshow(I3, [0 255]), title('Transformed 2') subplot(2,3,4), imhist(I) subplot(2,3,5), imhist(I2), axis([0 256 0 3000]) subplot(2,3,6), imhist(I3), axis([0 256 0 2000])