Design a convolution mask that does any one of the following and implement the convolution process (Pls do not use any image processing library functions) 1. smoothing 2. sharpening 3. detect edges Please show the out put and the code clearly, thanks in advance.
Design a convolution mask that does any one of the following and implement the convolution process (Pls do not use any image processing library functions)
1. smoothing
2. sharpening
3. detect edges
Please show the out put and the code clearly, thanks in advance.
Expert Answer
The Answer is in given below steps
clc;
clear;
A = imread('Lenna.png');
I = rgb2gray(A);
mask1 = (1/16)*[1 2 1;2 4 2;1 2 1]; %Gaussian blur
mask2 = [0 -1 -0;-1 5 -1; 0 -1 0]; %Sharpen
mask3 = [-1 -1 -1;-1 8 -1;-1 -1 -1]; %Edge
I1 = conv2(I,mask1);
I2 = conv2(I,mask2);
I3 = conv2(I,mask3);
subplot(2,2,1);
imshow(I);
title('original')
subplot(2,2,2);
imshow(uint8(I1));
title('smooth');
subplot(2,2,3);
imshow(uint8(I2));
title('sharp');
subplot(2,2,4);
imshow(uint8(I3));
title('edge');
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images