function r=compute_rotation(dx,dy,dz)
% dx, dy ,dz are the unit vector indicate where the axis projects on the image plane. 
a=dx(1)/dx(2);
b=dy(1)/dy(2);
c=dz(1)/dz(2);

r2_2=inv([1,1,1;a*a,b*b,c*c; a,b,c])*[1,1,0]';

r(2,1)=sign(dx(2))*sqrt(r2_2(1));
r(2,2)=sign(dy(2))*sqrt(r2_2(2));
r(2,3)=sign(dz(2))*sqrt(r2_2(3));

r(1,1)=r(2,1)*a;
r(1,2)=r(2,2)*b;
r(1,3)=r(2,3)*c;

cc=cross_product(r(1,:),r(2,:));
r(3,:)=cc';