clear; pollenmat = imread('Fig3.10(b).jpg'); u = double(pollenmat); [nx ny] = size(u) nshades = 256; ulight = u + ones(nx,ny)*100; % Transform by shifting to light. hist= zeros(nshades,1); for i=1:nx for j=1:ny for k=0:nshades-1 if ulight(i,j)==k hist(k+1)=hist(k+1)+1; end end end end plot(hist); pollenlighta = uint8(ulight); imwrite(pollenlighta, 'pollenlight.jpg');