edge detection filters are not detecting my edges for the matrix I created, even though the gradient changes are super obvious
Show older comments
I am trying to use the three edge filters below to show the edges of the image I created. For some reason the filters keep returning matrixes of zeros (black) even though there is super obvious gradient changes. Why are the filters not detecting the edges? Below is the code I have, and you can see from the images they are all black.
clear
figure
im=200*ones(10,10);
im(3:5,3:8)=50;
im(6:8,4:7)=50;
im2=mat2gray(im+round(9*randn(10,10)))
edge_p = edge(im2,'prewitt')
edge_s = edge(im2,'sobel')
edge_r = edge(im2,'roberts');
subplot(2,2,1);
imshow(im2);
title('Original Grayscale Image');
subplot(2,2,2);
imshow(edge_p);
title('Edge Using Prewit');
subplot(2,2,3);
imshow(edge_s);
title('Edge Using Sobel');
subplot(2,2,4);
imshow(edge_r);
title('Edge Using Roberts');
Accepted Answer
More Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!