Digital Image Processing Lab 8
Digital Image Processing Lab 8
Task 1
Analysing simple shapes like triangles in the Fourier spectrum shows spots indicating their
edges and angles. Grayscale images of sine functions display spots at frequencies matching
the wave oscillations.
Rotating an image changes the orientation of its frequency components in the power
spectrum, but the overall magnitude remains the same. Translating an image introduces a
linear phase shift in the power spectrum without affecting its magnitude.
The power spectrum of an image shows dominant frequencies, the orientation of patterns,
and provides information about texture, spatial relationships, symmetry, and overall image
complexity.
Yes, it is possible. It shows the frequency of a sine wave as a bright spot on a specific line.
This spot's position matches the frequency of the sine wave in the image. A higher peak
means a higher frequency sine wave. The power spectrum shows the main frequencies in
the image, including those of sine waves.
Task 2
t1 = imread('szczur.jpg');
t1 = imcrop(t1,[0,0, 200, 200]);
[hei, wid, colors] = size(t1);
t1 = im2gray(t1);
j=0;
kernel = [0 -1 0; -1 4 -1; 0 -1 0];
t2 = imfilter(t1,kernel,'same');
t3 = imfilter(t2,kernel,'same');
t4 = imfilter(t3,kernel,'same');
t5 = imfilter(t4,kernel,'same');
trigs = [t1,t2,t3,t4,t5];
imgs = [];
mags = [];
for i=1:5
j=j+1;
t1 = imcrop(trigs,[((i-1)*wid), 0, wid, hei]);
imgs=[imgs,t1];
subplot(2,5, j);
imshow(t1);
xlabel('I' + i);
j=j+5;
subplot(2,5, j);
L1=fftshift(fft2(t1));
m = log(1+abs(L1));
scaled_m = (m - min(m(:))) / (max(m(:)) - min(m(:)));
mags = [mags,scaled_m];
imshow(log(1+abs(L1)),[]);
xlabel('Magnitude of DFT');
j = i;
end
imwrite(imgs,"task2a.png");
imwrite(mags,"task2b.png");
saveas(gcf, 'task2.png');
Using a low pass filter zeroes all the components above a cut-off. Using a high pass
filter bunches the noise in the centre, small losses. In the low pass it is eliminated from the
centre.
Task 3
Task 4
Conclusion
The labs taught me about Fourier transform. Then, I learned about frequency domain image
filtering, which lets us change the vibration patterns to improve or hide parts of the image
and about frequency domain image analysis which helps in understanding it.