% Problem 2 % ========= I = [12 6 5 13 14 14 16 15 ; ... 11 10 8 5 8 11 14 14 ; ... 9 8 3 4 7 12 18 19 ; ... 10 7 4 2 10 12 13 17 ; ... 16 9 13 13 16 19 19 17 ; ... 12 10 14 15 18 18 16 14 ; ... 11 8 10 12 14 13 14 15 ; ... 8 6 3 7 9 11 12 12]; [g,T,pin,pout] = heq_full(I,20); % Problem 3 % ========= c = imread('cameraman.tif'); [x map] = gray2ind(c); [xeq,t,pin,pout] = heq_full(x,256); figure(1);clf subplot(221);imshow(x); title('Original'); subplot(222);stem(0:255,pin); title('Original histogram') subplot(223);imshow(uint8(xeq)); title('Equalized'); subplot(224);stem(0:255,pout); title('Equalized histogram') print -djpeg prob3.jpg % Problem 4 % ========= gam1 = .3; c1 = 255^(1-gam1); gam2 = 1.5; c2 = 255^(1-gam2); r = (0:255)'; figure(1);clf; plot(r,c1*r.^gam1,'-',r,c2*r.^gam2,'--'); legend('\gamma = 0.1','\gamma = 1.5') xlabel('r'); ylabel('s') print -djpeg prob4.jpg