Advertisement
Guest User

Untitled

a guest
Jan 26th, 2011
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.65 KB | None | 0 0
  1. function [v] = krd2(TH)
  2.  
  3. I=[176 492 337 37 176 492 38;
  4.    331 291 235 269 389 345 319 ;
  5.    1   1   1    1   1   1   1];
  6.  
  7. W=[0   0  .1345 .1345    0     0     .1345;
  8.    0 .159 .159     0     0   .159      0;
  9.    0   0    0      0   .026  .026    .026;
  10.    1   1    1      1     1     1       1];
  11.  
  12.  
  13. cx=TH(1);
  14. cy=TH(2);
  15. mx=TH(3);
  16. my=TH(4);
  17. phi=TH(5);
  18. tht=TH(6);
  19. psi=TH(7);
  20. Pcam=[TH(8);TH(9);TH(10)];
  21.  
  22. v=0;
  23. for i=1:7,
  24.     point_proj = [mx 0 cx;0 my cy;0 0 1]*[0 1 0;0 0 1;1 0 0]*euler2dcm([phi;tht;psi])*(W(1:3,i) - Pcam);
  25.     x=point_proj(1)/point_proj(3);
  26.     y=point_proj(2)/point_proj(3);
  27.     v=v+sqrt((I(1,i) - x)^2 + (I(2,i) - y)^2);
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement