degital image processing using matlab,,,answer questions Edge detection methods
ID: 2081737 • Letter: D
Question
degital image processing using matlab,,,answer questions
Edge detection methods are often compared by their ability to detect edges in noisy images. Let us perform the Prewitt operator on the Lenna image with additive Gaussian noise. Add noise to the test image and extract its edges. I_noise = imnoise (I, 'gaussian'); [I_prw2, t2] = edge (I_noise, 'prewitt'); subplot (2, 2, 3), imshow (I_noise), title ('Image w/noise'); subplot (2, 2, 4), imshow (I_prw2), title ('Prewitt on noise'); How did the Prewitt edge detector perform in the presence of noise (compared to no noise)? Did MATLAB use a different threshold value for the noisy image? Try using different threshold values. Do these different values affect the operator's response to noise? How does the threshold value affect the edges of the object?Explanation / Answer
clc;
close all;
clear all;
[IMG2,map] = imread('lenna.jpg');
figure
imshow(IMG2);
IMG1 = (rgb2gray(IMG2));
figure
I_noise = imnoise(IMG1,'gaussian');
[I_prw2,t2] = edge(IMG1,'prewitt');
[I_prw1,t2] = edge(I_noise,'prewitt');
subplot(3,1,1),imshow(I_noise),title('Image w/ noise');
subplot(3,1,2),imshow(I_prw2),title('Prewitt w/o noise');
subplot(3,1,3),imshow(I_prw1),title('Prewitt on noise');
%ANS a) Prewitt edge detector performs better with noiseless image than noisy.
%ANS b) MATLAB uses same threshold for noisy and noiseless.
[I_prw2,t2] = edge(IMG1,'prewitt');
[I_prw1,t2] = edge(I_noise,'prewitt',0.1);
figure
subplot(2,1,1),imshow(I_prw2),title('Prewitt w/o noise');
subplot(2,1,2),imshow(I_prw1),title('Prewitt on noise');
[I_prw2,t2] = edge(IMG1,'prewitt');
[I_prw1,t2] = edge(I_noise,'prewitt',0.2);
figure
subplot(2,1,1),imshow(I_prw2),title('Prewitt w/o noise');
subplot(2,1,2),imshow(I_prw1),title('Prewitt on noise');
[I_prw2,t2] = edge(IMG1,'prewitt');
[I_prw1,t2] = edge(I_noise,'prewitt',0.3);
figure
subplot(2,1,1),imshow(I_prw2),title('Prewitt w/o noise');
subplot(2,1,2),imshow(I_prw1),title('Prewitt on noise');
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.