📄 crit_vanline.m
字号:
function vancrit=crit_vanline(V,Lines,i,j,whichvoted,maxrect)
p=[1; i; j];
threshold2=10;
%for each pair of VPoints
loop=[1 2 3
1 3 2
2 3 1];
for i=1:3
a=loop(i,1);
b=loop(i,2);
c=loop(i,3);
%check the Lines which voted for both VPs
voted=find(whichvoted(p(a),:).*whichvoted(p(b),:));
%if there are any lines
if(voted)
% if not both VPs are at infinity
if V(a,3)~=0 || V(b,3)~=0
% get the Vanishing line
vanline=cross(V(a,:),V(b,:),2);
%calculate the distances between voting Lines and vanishing line them
[D,Alpha]=vpdistance2(vanline,Lines(voted,:));
% %cool debug output
% h=drawline(vanline,maxrect,[0 1 0],2);
% H=drawlines(Lines(voted,:),maxrect,[1 0 1],2);
% delete(h);
% delete(H);
%If the angle is too small the VP combination is illegal
if(max(Alpha)>threshold2/180*pi)
if(i==1)
% the first pair was already wrong => dont try it again
% with the same first VPs
vancrit=-1;
else
% the second or third was wrong
vancrit=0;
end
%error found => EXIT
return;
end
% if both VPs are at infinity
else
% there musn't be any lines voting for both
if voted~=0
if(i==1)
% the first pair was already wrong => dont try it again
% with the same first VPs
vancrit=-1;
else
% the second or third was wrong
vancrit=0;
end
%error found => EXIT
return;
end
end
end
end
%vanishing lin criterion fulfilled
vancrit=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -