Question

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 0 10 0 1 0 clear % Read image A-int32 (imread ( [N, M]-size (A) % change unsigned to signed integer for matrix comp

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

01 0 010 Original Gray Image 2-1 0 0 1 1 0 1 2 0-1 0 1 5 1 0-1 0

Add a comment
Know the answer?
Add Answer to:
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...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT