function retstr = cannydetection(instruct, outfile)
% VERSION 2006/08/24 // bug fixed in ascii-file display
% CREATED BY: M.B. Wieling and N. Petkov, Groningen University,
% Department of Computer Science, Intelligent Systems
%
%% PLEASE CHANGE THE FOLLOWING PARAMETERS TO THEIR DESIRED VALUES
FTPSERVER = 'ftp://matlabserver.cs.rug.nl'; % Adress of the ftp-server which should link to /INPUTIMAGES/
WEBDIR = 'C:\MATLAB6p5\work\cannyedgedetectionweb'; % the directory which contains the webapplication
NR_OF_DAYS = 14; % number of days images are kept on the server
%% END
retstr = char('');
%%% Get unique identifier (to form file name)
mlid = getfield(instruct, 'mlid');
%%% Create a specific directory for every browser window open
%%% in which the files are stored for that browserwindow
cd(strcat(WEBDIR, '\TMPIMAGES'));
if isfield(instruct, 'privdir')
data.privdir = instruct.privdir;
if (exist(data.privdir, 'dir') ~= 7)
data.privdir = sprintf('user%s', mlid);
mkdir(data.privdir);
end
else
data.privdir = sprintf('user%s', mlid);
mkdir(data.privdir);
end
% cleans up directories (removes old/illegal files) and
% checks and possibly rescales image to max(height,width) = 512 (aspect
% ratio is kept)
cleanup(data.privdir, 512, NR_OF_DAYS);
%% --------------------------------------------------------------
%% GATHER INPUT IMAGE LIST
%% --------------------------------------------------------------
% in case only the the image list is requested (to prepare for the initial
% page) immediately return it
if (isfield(instruct,'populatelist'))
imagename = instruct.selImage;
% parse imagename; if imagename comes in a cell type rather than matlab
% array convert it (this is due to filename extraction from a list rather
% than a single input field.
if (strcmp(class(imagename),'cell'))
imagename = cell2mat(imagename);
end;
data.imagename = strcat('INPUTIMAGES/', imagename);
data.simpleimagename = imagename;
% read image from directory
cd(strcat(WEBDIR, '\INPUTIMAGES'));
tmp = dir;
fileslist = char(sortrows({tmp.name}));
data.imagelist = '';
for I=3:size(fileslist)
filename = deblank(fileslist(I,:));
if (strcmp(deblank(imagename), filename) == 1)
data.imagelist = sprintf('%s\n<option selected>%s</option>',data.imagelist,filename);
else
data.imagelist = sprintf('%s\n<option>%s</option>',data.imagelist,filename);
end
end
cd ..
data.imagename = imagename;
cd(strcat(WEBDIR, '\WEB'));
templatefile = which('cannydetection1.html');
retstr = htmlrep(data,templatefile);
return;
else
% initialise values
data.error = 0;
data.errorstring = '';
data.orientation = [0, 0.5*pi];
data.inhibTerm = 0; % not yet calculated
% if fields are disabled, give them dummy values
if (isfield(instruct, 'supIsoinhib') == 0)
instruct.supIsoinhib = 'L-infinity norm';
end
if (isfield(instruct, 'alpha') == 0)
instruct.alpha = '1';
end
if (isfield(instruct, 'k1') == 0)
instruct.k1= '1';
end
if (isfield(instruct, 'k2') == 0)
instruct.k2 = '4';
end
if (isfield(instruct, 'tlow') == 0)
instruct.tlow = '0.05';
end
if (isfield(instruct, 'thigh') == 0)
instruct.thigh = '0.5';
end
if (isfield(instruct, 'clow') == 0)
instruct.clow = '0.1';
end
if (isfield(instruct, 'chigh') == 0)
instruct.chigh = '0.2';
end
if (isfield(instruct, 'inhibMethod') == 0)
instruct.inhibMethod = 'No surround suppression';
end
%%%%%% <LINEAR FILTERING>
%%%% DATA.SIGMA
% read all the values from the webpage
data.sigma = str2double(instruct.sigma);
if (isnan(data.sigma)) | (data.sigma <= 0)
data.errorstring = sprintf('%s\n <li><i><b>Sigma</b></i>: Please enter a real positive value.<br> Current incorrect value: <b>%s</b>.</li>', data.errorstring, instruct.sigma);
data.error = unique([data.error, 1]);
else
data.error = setdiff(data.error, 1);
end
%%%%%% <\LINEAR FILTERING>
%%%%%% <SELECT DISPLAY>
data.selRightSel1 = ' ';
data.selRightSel2 = ' ';
data.selRightSel3 = ' ';
data.selRightSel4 = ' ';
data.selRightSel5 = ' ';
data.selRightSel6 = ' ';
data.selRightSel7 = ' ';
if (strcmp('Filter output', instruct.selRight) == 1)
data.selRight=1;
data.selRightSel1 = 'selected';
elseif (strcmp('Filterkernel (x)', instruct.selRight) == 1)
data.selRight=2;
data.selRightSel2 = 'selected';
elseif (strcmp('Filterkernel (y)', instruct.selRight) == 1)
data.selRight=3;
data.selRightSel3 = 'selected';
elseif (strcmp('Filterkernel (power spectrum, x)', instruct.selRight) == 1)
data.selRight=4;
data.selRightSel4 = 'selected';
elseif (strcmp('Filterkernel (power spectrum, y)', instruct.selRight) == 1)
data.selRight=5;
data.selRightSel5 = 'selected';
elseif (strcmp('Inhibition term', instruct.selRight) == 1)
data.selRight=7;
data.selRightSel7 = 'selected';
else % inhibitionkernel
data.selRight=6;
data.selRightSel6 = 'selected';
end
%%%%%% </SELECT DISPLAY>
%%%%%% <SURROUND INHIBITION>
%%%% SURROUND INHIBITION METHOD
data.inhibMethodSel1 = ' ';
data.inhibMethodSel2 = ' ';
data.inhibMethodSel3 = ' ';
if (strcmp('No surround suppression', instruct.inhibMethod) == 1)
data.inhibMethod = 1;
data.inhibMethodSel1 = 'selected';
elseif (strcmp('Isotropic surround suppression', instruct.inhibMethod) == 1)
data.inhibMethod = 2;
data.inhibMethodSel2 = 'selected';
else
data.inhibMethod = 3; % anisotropic surround suppression
data.inhibMethodSel3 = 'selected';
end
%%%% SUPERPOSITION METHOD FOR ISOTROPIC SURROUND INHIBITION
data.supIsoinhibSel1 = ' ';
data.supIsoinhibSel2 = ' ';
data.supIsoinhibSel3 = ' ';
if (strcmp('L1 norm', instruct.supIsoinhib) == 1)
data.supIsoinhib = 1;
data.supIsoinhibSel2 = 'selected';
elseif (strcmp('L2 norm', instruct.supIsoinhib) == 1)
data.supIsoinhib = 2;
data.supIsoinhibSel3 = 'selected';
else
data.supIsoinhib = 3;
data.supIsoinhibSel1 = 'selected';
end
%%%% ALPHA
data.alpha = str2double(instruct.alpha);
if (data.inhibMethod ~=1) && (data.selRight == 1)% with no surround inhibition, no error checking
if (isnan(data.alpha))
data.errorstring = sprintf('%s\n <li><i><b>Alpha</b></i>: Please enter a numerical value.<br> Current incorrect value: <b>%s</b>.</li>', data.errorstring, instruct.alpha);
data.error = unique([data.error, 9]);
else
data.error = setdiff(data.error, 9);
end
end
%%%% K1
data.k1 = str2double(instruct.k1);
data.k2 = str2double(instruct.k2);
if ((data.inhibMethod ~=1) && (data.selRight == 1)) || (data.selRight == 6) % with no surround inhibition, no error checking
if (isnan(data.k1)) | (data.k1 == 0)
data.errorstring = sprintf('%s\n <li><i><b>K1</b></i>: Please enter a numerical (non zero) value, which is unequal to K2 (%s).<br> Current incorrect value: <b>%s</b>.</li>', data.errorstring, instruct.k2, instruct.k1);
data.error = unique([data.error, 10]);
elseif (data.k1 == data.k2) % k1 should be not equal to k1
data.errorstring = sprintf('%s\n <li><i><b>K1</b></i>: Please enter a numerical (non zero) value, which is unequal to K2 (%s).<br> Current incorrect value: <b>%s (equal to K2)</b>.</li>', data.errorstring, instruct.k2, instruct.k1);
data.error = unique([data.error, 12]);
else
data.error = setdiff(data.error, 10);
data.error = setdiff(data.error, 12);
end
end
%%%% K2
if ((data.inhibMethod ~=1) && (data.selRight == 1)) || (data.selRight == 6) % with no surround inhibition, no error checking
if (isnan(data.k2)) | (data.k2 == 0)
data.errorstring = sprintf('%s\n <li><i><b>K2</b></i>: Please enter a numerical (non zero) value, which is unequal to K1 (%s).<br> Current incorrect value: <b>%s</b>.</li>', data.errorstring, instruct.k1, instruct.k2);
data.error = unique([data.error, 11]);
elseif (data.k1 == data.k2) % k1 should be not equal to k1
data.errorstring = sprintf('%s\n <li><i><b>K2</b></i>: Please enter a numerical (non zero) value, which is unequal to K1 (%s).<br> Current incorre
没有合适的资源?快使用搜索试试~ 我知道了~
cannyedgedetectionweb.zip_canny _canny edge
共52个文件
m:23个
png:11个
html:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 150 浏览量
2022-07-15
17:22:35
上传
评论
收藏 913KB ZIP 举报
温馨提示
matlab canny 边缘检测程序,功能比较全面,可以作为程序参考
资源推荐
资源详情
资源评论
收起资源包目录
cannyedgedetectionweb.zip (52个子文件)
cannyedgedetectionweb
calc_inhibterm.m 1KB
filterkernelpower_onscreen.m 2KB
hysthresh.m 3KB
calc_hysteresis.m 2KB
calc_hystsup.m 2KB
calc_inhibition.m 4KB
calc_viewimage.m 1KB
derivgausskernel2d.m 2KB
onscreen.m 454B
WEB
cannydetection2.html 15KB
cannydetection1.html 13KB
cannydetection_matfile.html 4KB
cannydetection.html 543B
cannydetection_examples.html 6KB
cannydetection_params.html 12KB
index.html 4KB
cannydetection_error.html 1KB
cannydetection_uploading.html 5KB
inhibkernel2d.m 902B
cannydetection.m 32KB
calc_thinning.m 1KB
convolution.m 3KB
INPUTIMAGES
pellets01.jpg 83KB
BARS2.bmp 264KB
rhino.png 95KB
goat_3.png 121KB
elephant.png 93KB
rooster2.JPG 20KB
texturecollage.jpg 11KB
Vitosha_stones.jpg 39KB
test.bmp 264KB
popout.png 2KB
kanizsa.png 370B
hyena.png 105KB
synthetic1.png 666B
gazelle_2.png 115KB
triangle.png 8KB
pellets02.jpg 17KB
octagon.jpg 2KB
zebra.png 83KB
lena.jpg 59KB
squares.png 354B
filterkernel_onscreen.m 5KB
inhibkernel_onscreen.m 5KB
TMPIMAGES
thinning.m 5KB
cleanup.m 5KB
calc_orientations.m 919B
diffOfGausskernel2d.m 1KB
gaussian2d.m 748B
calc_inhibtermvis.m 2KB
powerspectrumdg.m 5KB
dgfilter.m 3KB
共 52 条
- 1
资源评论
weixin_42651887
- 粉丝: 81
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功