Professional Documents
Culture Documents
Image processing
Austin Miller
% Exercise 1: This
f=imread('C:\Users\austi_\Downloads\liver-cells-gray.jpg');
h=imhist(f,20);
horz=linspace(0,255,20);
stem(horz,h,'filled','LineWidth',0.5)
ax=gca;
ax.Color=[179,207,227]/255;
d.
% Exercise 1 d
f=imread('C:\Users\austi_\Downloads\liver-cells-gray.jpg');
hp=imhist(f);
plot(hp,'Color',[112 28 25]/255,'LineWidth',1.0)
ax=gca;
ax.Color=[228,221,218]/255;
ax.FontName='Times Ten'
ax.FontSize=8;
Figure 2. An image of the histogram that uses a plot function, instead of a linspace
This function creates a histogram that is more continuous since it uses the plot
function.
Exercise 2
f=imread('C:\Users\austi_\Downloads\phoenix-lander.tif');
figure,imshow(f);
g=histeq(f);
figure,imshow(g);
figure,imhist(f);
figure,imhist(g);
The greyscale transformation applied transforms the grayscale image f so that the
histogram of the output grayscale image g has 64 bins and is approximately flat.
The normal and equalized histograms of the image in Figure 5. (Left) and Figure 6.
(Right) respectively
f=imread('C:\Users\austi_\Downloads\phoenix-lander.tif');
hnorm=imhist(f)/numel(f); %Normalized histogram.
cdf=cumsum(hnorm);
r=linspace(0,1,256); % 256 values in the range [0,1]
figure, plot(r,cdf)
Exercise 3.
f = imread('C:\Users\austi_\Downloads\spillway-dark.tif');
% Exercise 1 - part b)
g = intXform4e(f, "log", 3);
figure, imshow(g)
% Exercise 1 - part c)
g = intXform4e(f, "gamma", 0.5);
figure, imshow(g)
f = im2double(f);
switch mode
case 'neg'
g = imcomplement(1 - f);
case 'gamma'
g = gammaTransform(f, param);
case 'log'
g = log(1 + f);
otherwise
error('Unknown enhancement method.')
end
end
The logarithm transformed image becomes slightly darker because the logarithm makes
the dark pixels more pronounced.
c)
The image has been transformed using a gamma value, which exponentially increased the
intensity values of the image, making the brighter spots brighter.
d) The image can be improved by changing the gamma value, of which the optimized
values can be found by changing the gamma lower to make the image brighter and higher
to make the image darker.