📄 propagate_bound_triang.m
字号:
function [outrect] = propagate_bound_triang(inrect, index, camlist, nbrimages);%inrect = inrect1old;%index = index2;[m,n] = size(camlist{1});if (index > n) conset = [1:n-1, index]; remset = [n:index-1, index+1:nbrimages];else conset = [1:n]; remset = [n+1:nbrimages];endfor i = 1:ncamP = camlist{conset(i)};Amax(i,:) = -camP(m,:);bmax(i,1) = -inrect.sllist(conset(i));endfor i = 1:ncamP = camlist{conset(i)};Amin(i,:) = camP(m,:);bmin(i,1) = inrect.sulist(conset(i));endA = [Amax;Amin];b = [bmax;bmin];options = optimset('Display','off');options = optimset(options,'LargeScale','off');for i = 1:length(remset) camP = camlist{remset(i)}; f = camP(m, :)'; g = -f; [xtmp,lsolset(i),exitflag1] = linprog(f, A, b,[],[],[],[],[],options); [xtmp,usolset(i),exitflag2] = linprog(g, A, b,[],[],[],[],[],options);endif exitflag1 ~= 1disp('Error propagating lower bounds. Setting to minus infinity.');lsolset = -Inf*ones(size(remset));endif exitflag2 ~= 1disp('Error propagating upper bounds. Setting to infinity.')usolset = Inf*ones(size(remset));endoutrect = inrect;outrect.sllist(conset) = inrect.sllist(conset);outrect.sllist(remset) = lsolset;outrect.sulist(conset) = inrect.sulist(conset);outrect.sulist(remset) = -usolset;%outrect%inrectlretainlist = inrect.sllist;lindretain = find(outrect.sllist > inrect.sllist);lretainlist(lindretain) = outrect.sllist(lindretain);uretainlist = inrect.sulist;uindretain = find(outrect.sulist < inrect.sulist);uretainlist(uindretain) = outrect.sulist(uindretain);outrect.sllist = lretainlist;outrect.sulist = uretainlist;%%if length(lindretain) > 0%fprintf('Lower bound propagated: %d : ', length(lindretain))%fprintf('%d ', lindretain);%fprintf('\n');%%end%%if length(uindretain) > 0%fprintf('Upper bound propagated: %d : ', length(uindretain))%fprintf('%d ', uindretain);%fprintf('\n\n');%%end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -