task 1...................................................................................................................................................
1
task 2................................................................................................................................................... 1
task 3................................................................................................................................................... 2
clc
clear all
close all
task 1
function B = blurmatrix(n)
B = diag(0.5*ones(1,n))+diag((1/4)*ones(1,n-1),1)+diag((1/4)*ones(1,n-1),-1);
End
task 2
X = imread('toysnoflash.png');
X = double(rgb2gray(X));
imshow(X,[0 255]);
title('origna image');
Warning: Image is too big to fit on screen; displaying at 67%
task 3
part 1 applying blurring in vertical direction 60 times
[m,n] = size(X);
Z1 = (blurmatrix(m)^60)*X;
figure()
imshow(Z1,[0 255])
fprintf('the black lines around the borders dipict that blurring resulted in very low pixel
values around the borders this is due to the fact that our blurring matrix contained zeros
mostly');
% Part 2
Z = Z1*blurmatrix(n)^60;
figure()
imshow(Z,[0 255])
% Part 3
B = blurmatrix(100);
figure()
subplot(1,2,1);
spy(B);title('B');
subplot(1,2,2);
spy(B^10);title('B^{10}');
fprintf('BLuring an image ten times in general the effect on each pixel is that it is changed by
the average of nearest intensity values which results in blurring');
the black lines around the borders dipict that blurring resulted in very low pixel values around
the borders this is due to the fact that our blurring matrix contained zeros mostlyWarning: Image
is too big to fit on screen; displaying at 67%
BLuring an image ten times in general the effect on each pixel is that it is changed by the
average of nearest intensity values which results in blurring
RESULT OF VERTICALLY BLURRING THE IMAGE 60 TIMES
RESULT OF BLURRING 60 TIMES IN BOTH DIMENSIONS
BLuring an image ten times in general the effect on each pixel is that it is changed by the average of
nearest intensity values which results in blurring