how do i find out the perfect edge
조회 수: 1 (최근 30일)
이전 댓글 표시
Iam writing the code to detect the edge of a leaf in matlab code,but Iam unable to find out the clearcut edge formation my code is
clc
close all;
clear all;
a=imread('t.jpg');
figure(1);
subplot(3,3,1);
imshow(a);
title('Actual image');
g=rgb2gray(a);
subplot(3,3,2);
imshow(g);
title('Gray image');
[r c l]=size(a);
o(:,:)=a(:,:,1);
x=0;y=0;
bw=im2bw(a,0.4);
subplot(3,3,3)
imshow(bw)
title('binarized image');
s=imcomplement(bw);
subplot(3,3,4)
imshow(s)
title('complement for binarized image')
for i=1:r
for j=1:c
for k=1:3
if g(i,j)<=80
o(i,j)=0;
elseif g(i,j)>80
o(i,j)=255;
end
if(s(i,j)==255)
x=x+1;
w=x*0.00147;
elseif(s(i,j)==0)
y=y+1;
b=y*0.00147;
end
end
end
end
c=edge(s,'canny');
subplot(3,3,5);
imshow(c);
title('canny');
p=edge(s,'log');
subplot(3,3,6);
imshow(p);
title('log filter');
p=edge(s,'roberts');
subplot(3,3,7);
imshow(p);
title('roberts filter');
p=edge(s,'sobel');
subplot(3,3,8);
imshow(p);
title('sobel filter');
댓글 수: 0
답변 (1개)
Walter Roberson
2017년 2월 13일
You cannot get perfect edge detection from a JPEG image, unless it is one of the rare lossless JPEG images. JPEG blurs edges in strange ways.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!