Skip to content

Commit e998ddb

Browse files
authored
added 3Dmap calc
vectorised calc3Dmap
1 parent ec8539f commit e998ddb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

calc3DMap.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def calc3DMap_opt(depthmap,K):
2+
K_inv=LA.inv(K)
3+
vl_check=np.ones((480,640,3))
4+
vl_check[:,:,0]=np.tile(np.arange(480),(640,1)).T
5+
vl_check[:,:,1]=np.tile(np.arange(640),(480,1))
6+
worldPts=np.transpose(np.matmul(K,np.transpose(vl_check,(1,2,0))),(2,0,1))
7+
return worldPts*np.reshape(depthmap,(480,640,1))
8+
start_time=time()
9+
depthmap = np.array(Image.open('./photos/frame-000000.depth.png'))
10+
vl_u_check = calc3DMap_opt(depthmap, K)
11+
print(vl_u_check)
12+
print("--- %s seconds ---" % (time() - start_time))

0 commit comments

Comments
 (0)