完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
|
网上下了很多的susan程序,但是发现都是同一个,程序直接运行就开始报错,我对matlab不是很了解,所以很多小白错误都改不出来,现在希望懂的朋友能帮助下,帮我把程序改的可以正常运行,程序如下:
function image_out = susan(im,threshold) close all clc im = imread('rice.png'); % 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+7,b+7); [c d]=size(new); new(4:c-4,4:d-4)=image; for i=4:c-4 for j=4:d-4 current_image = new(i-3:i+3,j-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(4,4))>threshold))=0; % current_masked_image(find(abs(current_masked_image-current_masked_image(4,4))<=threshold))=1; % This thresholding is more stable current_thresholded = susan_threshold(current_masked_image,threshold); g=sum(current_thresholded(:)); if nmax else R(i,j) = 0; end end end image_out=R(4:c-4,4:d-4); 程序首先缺少个图像输入,我加了一句:im = imread('rice.png'); 然后是提示阈值threshold没有设定,我就直接有加了一句 threshold=27.7不知道这样对不对,接下来的报错是: ??? Undefined command/function 'susan_threshold'. Error in ==> susanedge at 91 current_thresholded = susan_threshold(current_masked_image,threshold); 这个我就不知道怎么改了,是说函数定义不对么?应该怎么改,求大家帮忙!! |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
我用matlab的coder 封装了一个c语言的dll, 但是在用labview调用时,会出现识别不到库的问题,有大神遇到过吗
2630 浏览 0 评论
5216 浏览 0 评论
在matlab中如何计算含有第一类修正的贝塞尔函数的积分算不出的问题?
9012 浏览 0 评论
怎么利用matlab得到95%,80%和70%的置信区间,并生成不同区间下的功率误差贝塔分布?
10454 浏览 0 评论
请问simulink的s-function模块如何添加多输入输出接口
14615 浏览 2 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 00:00 , Processed in 0.974121 second(s), Total 92, Slave 75 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1152