Complete the MATLAB code - image convolution:
- Implement image convolution in Matlab:
-- Apply the following kernels and compare their images
-- If output is less than zero, set it to zero
Below is matlab code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all,
clear all,
clc,
ProjectPath = pwd;
ImagePath = strcat(ProjectPath,'\Leena.jpg');
Orig = imread(ImagePath);
Gray = rgb2gray(Orig);
subplot(2,2,1); imshow(Gray); title('Original Gray Image');
%Convolution Filter-1
s = [0 1 0; 1 1 1; 0 1 0];
size(Gray)
A = uint8(conv2(Gray,s));
subplot(2,2,2); imshow(A); str= strcat(num2str(s)); title(str);
%Convolution Filter-1
s = [0 -1 0;-1 5 1;0 -1 0];
size(Gray)
A = uint8(conv2(Gray,s));
subplot(2,2,3); imshow(A); str= strcat(num2str(s)); title(str);
%Convolution Filter-1
s = [-2 -1 0;0 1 1;0 1 2];
size(Gray)
A = uint8(conv2(Gray,s));
subplot(2,2,4); imshow(A); str= strcat(num2str(s));
title(str);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Complete the MATLAB code - image convolution: - Implement image convolution in Matlab: -- Apply the following kernels and compare their images -- If output is less than zero, set it to zero -2 10 151...