Edge detection using matlab
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
close all;
clc;
img=imread('download.jpg');
B=rgb2gray(img);
subplot(2,2,1)
imshow(B)
pause(2)
I=double(B);
for i=1:size(I,1)-2
for j=1:size(I,2)-2
%Sobel mask for x-direction:
mx=((2*I(i+2,j+1)+I(i+2,j)+I(i+2,j+2))-(2*I(i,j+1)+I(i,j)+I(i,j+2)));
%Sobel mask for y-direction:
my=((2*I(i+1,j+2)+I(i,j+2)+I(i+2,j+2))-(2*I(i+1,j)+I(i,j)+I(i+2,j)));
B(i,j)=sqrt(mx.^2+my.^2);
end
end
subplot(2,2,2)
imshow(B); title('Sobel gradient');
pause(2)
%Define a threshold value
Thresh=100;
B=max(B,Thresh);
B(B==round(Thresh))=0;
B=uint8(B);
subplot(2,2,3)
imshow(~B);title('Edge detected Image');
Im using this code for detect the edges in my image and it works fine ...
My question how to plot outpot line on the input image using least squares fitting ???
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!