clear
clc
Irgb = imread('bricks.png');
% figure,imshow(Irgb)
Id = rgb2gray(Irgb);
Ig = rgb2gray(Irgb);
% figure,imshow(Ig)
Id = im2double(Ig);
figure,imshow(Id)
figure,imshow(Id(1:2:end,1:2:end))
figure,imshow(Id(1:3:end,1:3:end))
%figure,imshow(Id)
figure,imshow(Id(1:10:end,1:10:end))
%figure,imshow(Id)
%Lets create an synthetic image
%This part is taken from the pdf
(I will provide it on the blog)
x = linspace(-pi, pi, 201);
% If you pass meshgrid only one
vector, it uses that vector for both the x
% and the y coordinates.
[xx,yy] = meshgrid(x);
A = 10;
Icircles = sin(A*(xx.^2 + yy.^2));
% End of synthetic image
creation
figure,imshow(Icircles)
figure,imshow(Icircles(1:3:end,1:3:end))
%imshow(Icircles)
Fcircles = fftshift(abs(fft2(Icircles)));
figure,imshow(Fcircles)
figure,imshow(Fcircles,[0,200])
FcirclesShifted = fftshift(fft2(Icircles));
%imshow(abs(Fcircles),[0,200])
size(Fcircles)
LowPassRectangle = zeros(size(Fcircles));
LowPassRectangle(69:132,69:132) = 1;
imshow(LowPassRectangle)
%imshow(LowPassRectangle.*Fcircles)
imshow(LowPassRectangle.*Fcircles,[0,200])
FcirclesLow =
LowPassRectangle.*FcirclesShifted;
figure,imshow(abs(FcirclesLow),[0,200])
%IcirclesLow =
ifft2(fftshift(FcirclesLow));
IcirclesLow =
abs(ifft2(fftshift(FcirclesLow)));
figure,imshow(IcirclesLow)
figure,imshow(Icircles(1:3:end,1:3:end))
figure,imshow(IcirclesLow(1:3:end,1:3:end))
figure,imshow(IcirclesLow(1:2:end,1:2:end))
figure,imshow(Icircles(1:2:end,1:2:end))
Iparrot = im2double(imread('parrotsGrayscale.jpg'));
figure,imshow(Iparrot)
figure,imshow(Iparrot(1:5:end,1:5:end))
Fparrot = fft2(Iparrot);
%figure,
imshow(abs(fftshift(Fparrot)))
figure, imshow(abs(fftshift(Fparrot)),[0,200])
LowPassRectangle = zeros(size(Fparrot));
%LowPassRectangle(342:382,221:258)=1;
%figure,imshow(LowPassRectangle)
%figure,
imshow(abs(fftshift(Fparrot)),[0,200])
%figure,imshow(LowPassRectangle)
LowPassRectangle = zeros(size(Fparrot));
LowPassRectangle(221:257,342:382)=1;
figure,imshow(LowPassRectangle)
figure,imshow(abs(LowPassRectangle.*fftshift(Fparrot)),[0,200])
IparrotLow =
abs(ifft2(fftshift(LowPassRectangle.*fftshift(Fparrot))));
figure,imshow(IparrotLow)
figure,imshow(IparrotLow(1:5:end,1:5:end))
Warning: Image is too big to fit
on screen; displaying at 50%
ans =
201
201





















No comments:
Post a Comment