3D reconstruction, matlab

2.1k Views Asked by At

I have image A and image B from same camera.

Points in Image A

    PA=[
1   2172    998.9
2   2405    225.2
3   1480    1420
4   1045    1342
5   3039    1789
6   3727    968.7
7   1038    443.1
8   3606    856.6
9   1248    520.1
10  2189    976.8
    ]

Points in Image B

  PB=[
    1   2363    1598
2   2551    840.7
3   1768    2045
4   1404    1985
5   3040    2335
6   3636    1485
7   1393    1142
8   3514    1379
9   1550    1199
10  2378    1575]

t=1e-4;

Fundamental matrix

[F, inliers] = ransacfitfundmatrix(x1, x2, t);

F=[ 5.12243654806919e-009    -5.65511649689218e-008    -3.90901140383986e-006
 9.48853562184938e-008     4.56036186476569e-008      -0.00133231474573608
 -0.000178137312702315       0.00112651242300972          1.10421882784367]

Camera file

focallength =18.6188 mm

format size 
width =22.6791 mm
height=15.1130 mm

Image size 
5184*3456 pixel

Principle point

    x0=11.5399 mm 
    y0=07.8574 mm

    lens distortion (ideal)
    K1=0 mm
    K2=0 mm
    K3=0
    P1=0mm
    P2=0 mm

Homography

H = vgg_H_from_x_lin(x1,x2)

**Question A= I want to get back PointsB

e.g., PointsB(:,1)==H*x1(:,1)

The results are wrong, why, any thing missing

More detail:

x2(:,1)'*F*x1(:,1)= -0.000644154818346676  % I guess its OK.
PointsB(:,1)==H*x1(:,1)= [  2240.66095080911 
                            1522.92361373263 
                            0.953866074561989] %%%%%% WHY not 1

 PB=[        1  2363    1598]; SHOULD BE

Question B= How can I have 3D points from above informations.

Any link or matlab code would be helpful.

How can I use

vgg_X_from_xP_lin.m 3D point from image projections and cameras, linear

X = vgg_X_from_xP_lin(u,P,imsize) % what is u

1

There are 1 best solutions below

0
On

Are the two images taken with the same camera?

Question A: what you are looking for is point correspondences between the two images. One way to find corresponding points is to use local feature matching. There are many algorithms for detecting interest points and finding feature desriptors, such as SIFT, SURF, BRISK, FREAK, etc.

Question B: You can get the 3D points using triangulation. Also see Direct Linear Transformation in Multiple View Geometry in computer vision by Hartley and Zisserman.