script3

clear
close all
load extrinsic1

R = Rc_1';
pos = -R*Tc_1/12;
fprintf('pos %g %g %g\n',pos);
vk = R(:,3)

up = [0 0 1];
phi = axis_angle(vk,[0 1 0],up);
fprintf('down look angle %g degrees (from R)\n',phi);

phi_v2 = atan2(vk(3),vk(2))*180/pi;
fprintf('down look angle (v2) %g degrees\n',phi_v2);


phi_v3 = atan2(-pos(3),-pos(2))*180/pi;
fprintf('down look angle (v3) %g degrees (from position)\n',phi_v3);
pos 1.30291 -6.73298 2.40665

vk =

   -0.0063
    0.9429
   -0.3330

down look angle -19.4518 degrees (from R)
down look angle (v2) -19.4487 degrees
down look angle (v3) -19.669 degrees (from position)
load filelist
n = 16;
filename = char(files(n));
rgb2 = imread(filename);
imshow(rgb2);
sz = size(rgb2);
cen = [sz(2) sz(1)]/2

load hallpts16

pt1 = hallpts(1:2,:)
pt2 = hallpts(3:4,:)

hold on
plot(pt1(:,1),pt1(:,2),'y',pt2(:,1),pt2(:,2),'m','LineWidth',2);
plot(cen(1),cen(2),'mx');
text(cen(1)+20,cen(2),'image center');
hold off

pt = intersect(pt1,pt2)

hold on
plot(pt(1),pt(2),'kx');
hold off

cc = [ 1056.532269918812300  1113.068166667991800 ];

hold on
plot(cc(1),cc(2),'cx');
text(cc(1)+30,cc(2),'cc');
hold off
Warning: Image is too big to fit on screen; displaying at 33% 

cen =

        1024         768


pt1 =

    1.5281  877.4799
  824.0181  359.3112


pt2 =

   1.0e+03 *

    1.7246    1.1222
    1.1263    0.4169


pt =

  989.1669  255.2675

f = 2530;
d = (pt-cen)/f
phi = atan(d(2))*180/pi;
fprintf('angle %g degrees (based on image center)\n',phi);

d = (pt-cc)/f;
phi2 = atan(d(2))*180/pi;
fprintf('angle %g degrees (based on cc)\n',phi2);
d =

   -0.0138   -0.2027

angle -11.4565 degrees (based on image center)
angle -18.7293 degrees (based on cc)