开发者

Projection matrix sign confusion (edited title)

Down I have edited my question. I am projecting Wxyz to image(u,v) and getting some wrong result. I can't figure out where is mistake. Please help some one to figure out.

Given:

Wxyzz =
       386.06       197.02      -1821.8            1
       407.32         -108      -1859.1            1
       4.9764       290.92      -1531.2            1
       103.39      -233.07      -1643.2            1
        189.7       320.19      -1667.9            1
       76.279        147.9      -1597.2            1
       47.798      -319.51      -1605.8            1
       164.74       -223.1      -1688.6            1
       482.06      -251.66      -1921.2            1
       226.42      -213.27      -1733.6            1
Wxyz=Wxyz' %';
%# intrinsic

fu = 2640; fv =2640; uo= 1514; vo = 994;

A= [ fu 0  uo 0
      0  fv  vo 0
      0  0  1    0
      0 0   0   1];

Exterior=[-6.6861,12.6118,-8.0660,[-0.4467,-0.3168,0.2380]*pi/180];%# deg 2 rad
%#data
X0=Exterior(1);
Y0=Exterior(2);
Z0=Exterior(3);
ax=Exterior(4);
by=Exterior(5);
cz=Exterior(6);
%#Rotation in X

 Rx = [1  0        0
        0  cos(ax)  -sin(ax)
        0  sin(ax)  cos(ax)];


%#Rotation in Y    
Ry = [cos(by)  0  sin(by)
        0        1  0
        -sin(by) 0  cos(by)];


%#Rotation in Z        
Rz = [cos(cz) -sin(cz) 0
        sin(cz) cos(cz)  0
        0       0        1];
R=Rx*Ry*Rz;

T=[X0;Y0;Z0];
Extrinsic= R';
Extrinsic(:,4) = -(R')* (T);
Extrinsic(4,:)   =  [0 0 0 1]


PImage =  A* Extrinsic* Wxyz;  

%#Obtain the X's
PImage(1 ,:) = PImage(1 ,:) ./ PImage(3 ,:);
%#Obtain the Y's
PImage(2 ,:) = PImage(2 ,:) ./ PImage(3 ,:);

I am getting

PImage =

       955.93       707.43      -1814.4            1
       939.75       1147.6      -1854.2            1
       1506.3       490.36        -1521            1
       1352.7       1370.2      -1637.6            1
       1213.9       485.04      -1658.4            1
       1389.7       749.08      -1588.5            1
       1440.9       1521.6      -1600.6            1
       1261.2       1344.2      -1683.2            1
       857.22         1340      -1917.8            1
       1173.9       1319.9      -1728.5            1

I supposed to get( real 2 D points)

img =

       2072.8       706.69
       2088.9       1146.9
       1522.6        489.6
       1676.1       1369.5
       1814.9        484.3
       1639.2       748.35
       1587.9       1520.9
       1767.6       1343.5
       2171.4       1339.3
       1854.9       1319.2

If I use A= [ -fu 0 uo 0 0 fv vo 0 0 0 1 0 0 0 0 1];开发者_Python百科 I get corect answer. I can't figure out where is mistake in rotation or translation; Why Pimage(:,1) is not identical with img(:,1). Any help will be grateful.


You've done the rotation, and you've done the transformation. What you need to do is the projection! Now I don't know what exactly you're trying to accomplish, but I don't see a projection matrix anywhere. So that's the first thing you need to fix.

Remember that doing a projection is a R4 -> R4 operation. If you're trying to get an R2 vector, you're trying to do something else (more).

see more at wikipedia.

if you really want to learn the details, you can watch and learn courtesy of YouTube

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜