Beruflich Dokumente
Kultur Dokumente
(K00371921)
Solution)
%example_convolve_boundary
%Prepare impulse response array
clc; clear all;
Ones = ones(3,3);
Imp = imdivide(Ones, 9);
%Prepare source image
Center = imread('roma.jpg');
Center = rgb2gray(Center);
Center = imresize(Center, [101 101]);
%Ctr = Ctr(1:101, 1:101); %image([1 101], [1 101], 0);
Center(51:51, 51:51) = 1;
Center(1:1, 1:2) = 1;
Center(1:2, 1:2) = 1;
ROMA PATEL
(K00371921)
Center(101:101, 101:101) = 1;
subplot(2, 3, 1); imshow(Center); title('Source image'); %imageinfo;
%pause;
%Enclosed array option, with exclusion of IPPL
iptsetpref('UseIPPL', false);
Work = imfilter(Center, Imp, NaN);
Work(isnan(Work)) = 0;
subplot(2, 3, 2); imshow(Work); title('Convolved with enclosed array');%
imageinfo;
%pause;
%Print upper left corner and mid image pixels
iptsetpref('UseIPPL', true);
Work2 = imcrop(Work, [1 1 4 4]);
Work3 = imcrop(Work, [49 49 4 4]);
a1 = mat2str(Work2, 3);
display('Pixel samples of source convolved with enclosed array');
display('s1 = upper left corner, s2 = mid image');
display(a1);
a2 = mat2str(Work3, 3);
display(a2);
%Zero exterior convolution
Work = imfilter(Center, Imp, 0);
subplot(2, 3, 3); imshow(Work, [0 1]); title('Convolved with zero exterior');
%imageinfo;
%pause;
%Print upper left corner and mid image pixels
Work2 = imcrop(Work, [1 1 4 4]);
Work3 = imcrop(Work, [49 49 4 4]);
a1 = mat2str(Work2, 3);
display('Pixel samples of source convolved with zero exterior');
display('s1 = upper left corner, s2 = mid image');
display(a1);
a2 = mat2str(Work3, 3);
display(a2);
%Reflected exterior convolution
Wrk1 = imfilter(Center, Imp, 'symmetric');
subplot(2, 3, 4); imshow(Wrk1); title('Convolved with reflected exterior');
%imageinfo;
%pause;
%Print upper left corner and mid image pixels
Work2 = imcrop(Wrk1, [1 1 4 4]);
Work3 = imcrop(Wrk1, [49 49 4 4]);
a1 = mat2str(Work2, 3);
display('Pixel samples of source convolved with reflected exterior');
display('s1 = upper left corner, s2 = middle of image');
display(a1);
a2 = mat2str(Work3, 3);
display(a2);
ROMA PATEL
(K00371921)
ROMA PATEL
(K00371921)
Pixel samples of source convolved with reflected exterior
a1 = upper left corner, a2 = middle of image
a1 =
[1 23 45 71 78;26 41 55 73 78;48 56 63 70 73;70 72 73 69 69;70 70 70 66 65]
a2
=[75 61 52 49 47;89 66 60 58 67;85 67 66 65 76;69 57 60 63 77;55 58 64 71 79]
>>
Sol)
clc;
clear;
ctr11 = imread('roma.jpg');%filename);
filename = 'roma.jpg';
label = strcat(filename, ' source image');
figure(1);
subplot(1, 2, 1);imshow(ctr11); title(label,'Interpreter','none');
%imageinfo();
%pause
Imp = fspecial('average', 5);
Dst1 = imfilter(ctr11, Imp, 'symmetric');
label = strcat(filename,' uniform filtered');
subplot(1, 2, 2);imshow(Dst1); title(label,'Interpreter','none');
%imageinfo();
ROMA PATEL
(K00371921)