www.pudn.com > laserCCDcalibration.zip > xindeshiyanchengxu.m, change:2014-10-12,size:1697b


clc;clear all;close all; 
% fc=[783.58731 1265.23828]; %Focal Length 
% cc=[335.18397 277.81436];%Principal Point  
fc=[783.58731 1305.23828]; %Focal Length 
cc=[358.18397 277.81436];%Principal Point  
%%改数据后 
% fc=[843.58731 1265.23828]; %Focal Length 
% cc=[320.18397 277.81436];%Principal Point  
 
R=[ -0.9994    0.0331   -0.0130; 
    0.0209    0.3554   -0.9344; 
    0.0493    0.9341    0.3560]; 
 
T=[18.569353;275.690603;233.253248];        %标定时的旋转矩阵和平移矩阵 
 
img=imread('loudao_nsct3.bmp');             %红外与可见光融合之后的图片 
% im1=imread('beizicutobject.bmp'); 
im1=imread('shiwaiobj.bmp');                %分割之后的图片 
figure;imshow(img);axis on;hold on; 
a=1; 
e=1; 
d=1; 
Dis=20; 
M=-800; 
for k=1:66                                 %读取66个激光文件 
    x=num2str(k); 
    str=['data' x '.txt']; 
    data=load(str); 
     
    len=length(data);                     %取出每个激光文件的长度,即每个激光文件里面的激光点的数量 
    ZlaserP=M*ones(1,len); 
    f=1; 
    for i=1:len 
           XlaserP(i)=data(i)*cos((i-1)/2*pi/180); 
           YlaserP(i)=data(i)*sin((i-1)/2*pi/180); 
            
           Xcamser(i)=R(1,1)*XlaserP(i)+R(1,2)*YlaserP(i)+R(1,3)* ZlaserP(i)+T(1,1); 
           Ycamser(i)=R(2,1)*XlaserP(i)+R(2,2)*YlaserP(i)+R(2,3)* ZlaserP(i)+T(2,1); 
           Zcamser(i)=R(3,1)*XlaserP(i)+R(3,2)*YlaserP(i)+R(3,3)* ZlaserP(i)+T(3,1); 
                      
           U(i)=-(fc(1)*(Xcamser(i)/Zcamser(i))-cc(1)); 
           V(i)=fc(2)*(Ycamser(i)/Zcamser(i))-cc(2); 
           OU(i)=round(U(i)); 
           OV(i)=round(V(i)); 
 
        plot(round(U(i)),round(V(i)),'.','Color','r','LineWidth',9);hold on; 
    end 
    M=M+Dis; 
end