3D reconstruction from a 2D image
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Damon Pierre-Marie
am 9 Nov. 2017
Kommentiert: Ayush singhal
am 22 Mai 2021
Hello,
I have some difficulties to reconstruct a 3D scene from a 2D image. I would like to create a top view of scene removing the perspective, in other words, realize an inverse perspective mapping. Let's assume we know the camera position, orientation and its parameters. Moreover we consider all the captured points lie on the same plane XY. Then, it is easy to prove that a pixel at a (u,v) location in the image will move to the coordinate (X,Y,0) in the 3D space with:
X=-((u*P(3,4)-P(1,4))*(v*P(3,1)-P(2,1)) + (v*P(3,4)-P(2,4))*(P(1,1)-u*P(3,1)))/((u*P(3,2)-P(1,2))*(v*P(3,1)-P(2,1)) + (v*P(3,2)-P(2,2))*(P(1,1)-u*P(3,1)));
Y=(X*(u*P(3,2)-P(1,2)) + (u*P(3,4)-P(1,4)))/(P(1,1)-u*P(3,1));
P is the projection matrix such that: P=[KR KT] with K,R and T respectively the intrinsic, rotation and translation matrices.
Once all the 3D locations of each pixel are computed, I would like to display the XY plane with the color information of the original pixel as if it was a 2D image.
However, a pixel (u,v) can mapped in 3D space to a non integer location meaning that I get a non-regular scatter plot were each (X,Y) point contain a color information. I tried to divide the XY plane into small windows and then compute the average color of all points into each squares but it is very slow.
Please find my code enclosed. Some help would be appreciated!
Thank you in advance, Pm
8 Kommentare
mostafa TAIBI
am 13 Feb. 2020
another question if you allow, for the 3d reconstruction is that you take all the pixels of the image after you use the formula to calculate X and Y?
Akzeptierte Antwort
Matt J
am 9 Nov. 2017
Bearbeitet: Matt J
am 9 Nov. 2017
Once all the 3D locations of each pixel are computed, I would like to display the XY plane with the color information of the original pixel as if it was a 2D image.
I don't think you need to be doing the work of mapping and interpolating the coordinates. I think it should be as simple as
Image2 = imwarp(Image1,projective2d(P(:,[1,2,4]).'))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Computer Vision with Simulink finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



