0% found this document useful (0 votes)
17 views

Matlab Tasksforbeginner

The document describes three tasks related to image blurring. Task 1 defines a blur matrix function. Task 2 loads an image and displays it. Task 3 applies the blur matrix 60 times vertically, then 60 times horizontally to the image, resulting in black borders due to low pixel values from the blurring. It also demonstrates that blurring an image multiple times averages the intensities of surrounding pixels, causing blurring.

Uploaded by

asd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Matlab Tasksforbeginner

The document describes three tasks related to image blurring. Task 1 defines a blur matrix function. Task 2 loads an image and displays it. Task 3 applies the blur matrix 60 times vertically, then 60 times horizontally to the image, resulting in black borders due to low pixel values from the blurring. It also demonstrates that blurring an image multiple times averages the intensities of surrounding pixels, causing blurring.

Uploaded by

asd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

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

You might also like