代码拉取完成,页面将自动刷新
同步操作将从 陈帅/ShadowRemoval 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
function bl = bdspln(ffu,smsk,bd,gsc)
%BDSPLN provides the two ends of each sampling line
%
% Function is written by Han Gong, University of Bath, UK
bdp = bd.p(:,~bd.t); bdn = bd.n(:,~bd.t);
llen = size(bdp,2); % length of selected boundary points
imhw = size(ffu); % size of image
bl.s = zeros(2,llen); bl.e = zeros(2,llen); % shadow boundary points
% compute illumination gradient field
[fx,fy] = gradient(ffu);
% get endpoints
for i = 1:llen
% get current parameters
pt = bdp(:,i); % boundary point
ptinc = bdn(:,i); % advance vector using boundary normal vector
gvec = [fx(pt(2),pt(1));fy(pt(2),pt(1))];
% get starting end
cpt1 = round(pt); cpt2 = round(pt); % current ends
gmlen = get2Dprolen(gvec,ptinc)/gsc; % minimum gradient strength
goon = true; t1 = false;
while goon
rcpt1 = round(cpt1); rcpt2 = round(cpt2);
if reachbd(rcpt1,imhw) || reachbd(rcpt2,imhw) || gmlen<=0
goon = false; % boundary check
else
if t1 && (~smsk(rcpt1(2),rcpt1(1)) || smsk(rcpt2(2),rcpt2(1)))
goon = false; % mask check
end
cgvec1 = [fx(rcpt1(2),rcpt1(1)),fy(rcpt1(2),rcpt1(1))];
cgvec2 = [fx(rcpt2(2),rcpt2(1)),fy(rcpt2(2),rcpt2(1))];
ig1 = get2Dprolen(cgvec1, ptinc);
ig2 = get2Dprolen(cgvec2, ptinc);
if max(ig1,ig2) < gmlen % gradient check
goon = false;
else
cpt1 = cpt1 - ptinc; cpt2 = cpt2 + ptinc; t1 = true;
end
end
end
bl.s(:,i) = cpt1; bl.e(:,i) = cpt2;
end
function res = reachbd(pt,sz)
% test whether a point is at image boarder
res = pt(1)<1 || pt(2)<1 || pt(1) > sz(2) || pt(2) > sz(1);
end
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。