

function [Vcam N0 d0 control]=EstimateN0d0(T)

NV=size(T,3);
 %  estimate of N0,d0 using method 1 (ECCV 2010)
for N1=1:NV-1
 auxTi=T(:,:,N1+1)/T(:,:,1);
 [Ri ti]=T2Rt(auxTi);
 [thetai wi]=R2Euler(Ri);
 A(3*N1-2:3*N1,1:3)=skew_symetric_v(ti)+tan(thetai/2)*wi*transpose(ti);
 A(3*N1-2:3*N1,4)=-2*tan(thetai/2)*wi;
end
[a b] = find(isnan(A));
a=unique(a);
a=sort(a,'descend');
for i=1:length(a)
    A(a(i),:) = [];
end
[U,S,V]=svd(A);
control=diag(S);
aux=V(:,4)./norm(V(1:3,4));
N0=aux(1:3);
d0=aux(4);
Vcam=ReflectTransf(N0,d0);