資源簡介
SUSAN邊緣檢測的實現代碼,很簡單容易實現

代碼片段和文件信息
%?-----------------------------------------------------------------------
%?
%?This?function?uses?the?SUSAN?algorithm?to?find?edges?within?an?image
%?
%
%?>>image_out?=?susan(image_inthreshold)
%
%
%?Input?parameters?...?The?gray?scale?image?and?the?threshold?
%?image_out?..?(class:?double)?image?indicating?found?edges
%?typical?threshold?values?may?be?from?10?to?30
%
%
%The?following?steps?are?performed?at?each?image?pixel:?
%?(?from?the?SUSAN?webpage?http://www.fmrib.ox.ac.uk/~steve/susan/susan/node4.html?)
%?
%?Place?a?circular?mask?around?the?pixel?in?question.?
%?Calculate?the?number?of?pixels?within?the?circular?mask?which?have?similar?brightness?to?
%?the?nucleus.?These?define?the?USAN.?
%?Subtract?USAN?size?from?geometric?threshold?to?produce?edge?strength?image.?
%
%?Estimating?moments?to?find?the?edge?direction?has?not?been?implemented?.?
%?Non-maximal?suppresion?to?remove?weak?edges?has?not?been?implemented?yet.
%
%?example:
%
%?>>?image_in=imread(‘test_pattern.tif‘);
%?>>?image?=?susan(image_in27);
%?>>?imshow(image[])?
%
%
%?Abhishek?Ivaturi
%?
%?-------------------------------------------------------------------------
?
?function?image_out?=?susan(imthreshold)
close?all
clc
%?check?to?see?if?the?image?is?a?color?image...
d?=?length(size(im));
if?d==3
????image=double(rgb2gray(im));
elseif?d==2
????image=double(im);
end
%?mask?for?selecting?the?pixels?within?the?circular?region?(37?pixels?as
%?used?in?the?SUSAN?algorithm
mask?=?([?0?0?1?1?1?0?0?;0?1?1?1?1?1?0;1?1?1?1?1?1?1;1?1?1?1?1?1?1;1?1?1?1?1?1?1;0?1?1?1?1?1?0;0?0?1?1?1?0?0]);??
%?the?output?image?indicating?found?edges
R=zeros(size(image));
%?define?the?USAN?area
nmax?=?3*37/4;
%?padding?the?image
[a?b]=size(image);
new=zeros(a+7b+7);
[c?d]=size(new);
new(4:c-44:d-4)=image;
??
for?i=4:c-4
????
????for?j=4:d-4
????????
????????current_image?=?new(i-3:i+3j-3:j+3);
????????current_masked_image?=?mask.*current_image;
???
%???Uncomment?here?to?implement?binary?thresholding
%?????????current_masked_image(find(abs(current_masked_image-current_masked_image(44))>threshold))=0;?????????
%?????????current_masked_image(find(abs(current_masked_image-current_masked_image(44))<=threshold))=1;
%???This?thresholding?is?more?stable
?????????????????
????????????
???????
????????current_thresholded?=?susan_threshold(current_masked_imagethreshold);
????????g=sum(current_thresholded(:));
????????
????????if?nmax ????????????R(ij)?=?g-nmax;
????????else
????????????R(ij)?=?0;
????????end
????end
end
image_out=R(4:c-44:d-4);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????172231??2012-08-27?10:31??SUSAN邊緣檢測的實現代碼\1.jpg
?????文件???????2654??2012-08-27?16:27??SUSAN邊緣檢測的實現代碼\susan.m
?????文件????????655??2005-04-20?20:09??SUSAN邊緣檢測的實現代碼\susan_threshold.m
?????文件?????250454??2005-04-20?16:47??SUSAN邊緣檢測的實現代碼\test_pattern.tif
?????目錄??????????0??2012-10-15?10:18??SUSAN邊緣檢測的實現代碼
-----------?---------??----------?-----??----
???????????????426212????????????????????6
- 上一篇:克里金插值 matlab
- 下一篇:ssim.m結構相似性代碼matlab
評論
共有 條評論