从以相机为中心的坐标到以图案为中心的坐标

时间:2016-09-09 22:08:59

标签: matlab computer-vision camera-calibration

我目前在相机中设置相机对齐模型作为原点坐标:

http://i.imgur.com/UnSCAvG.png

并且,由于相机是静止的,我正在尝试将系统转换为模式固定模型

http://i.imgur.com/OKunxwA.png

Matlab非常适合向我展示,但唉,我发现没有办法提取数据,除非它是在固定相机模型上。它应该是一个简单的问题,即应用平移的反转和旋转来改变系统之间但不幸的是,这不起作用,我不明白为什么。

oldpoint = [0 0 0 1]';

translation = ([1 0  0 18.1043121043; 0 1 0 31.092351038; 0 0 1 -80.0610295707; 0 0 0 1]);
rotation = [eul2rotm([0.0957937074  -0.0234017529   -0.037084526]) zeros(3,1); 0 0 0 1];


newpoint = translation * point;

newpoint = rotation * newpoint;

我已经尝试了几种不同的替代品,但到目前为止还没有达到我想要得到的坐标。

1 个答案:

答案 0 :(得分:0)

有两件事情出错,matlab没有使用欧拉角,而Z需要倒置。

clc;
clear;
%%
oldpoint = [0 0 0 1]';

newpoints = zeros(13,4);

i = 1;
while( i<= length(translations) )
    trans = translations(i,:);
    rota = rotations(i,:);

    display(trans);
    display(rota);

    translation = ([1 0  0 -trans(1); 0 1 0 -trans(2); 0 0 1 trans(3); 0 0 0 1]);
    rotation = [rotationVectorToMatrix([-rota(1) -rota(2) -rota(3)]) zeros(3,1); 0 0 0 1];

    newpoint = translation  * oldpoint;
    newpoint = rotation * newpoint;

    newpoints(i,:) = newpoint;
    i = i + 1;
end
相关问题