Skip to content

Commit 993f002

Browse files
authored
Add files via upload
1 parent 3560389 commit 993f002

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

script/tools.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,18 @@ def nptran(pcd:np.ndarray, rigdtran:np.ndarray) -> np.ndarray:
7777
pcd_ = rigdtran[:3, :3] @ pcd_ + rigdtran[:3, [3]]
7878
return pcd_.T
7979

80-
def npproj(pcd:np.ndarray, extran:np.ndarray, intran:np.ndarray, img_shape:tuple) -> np.ndarray:
80+
def npproj(pcd:np.ndarray, extran:np.ndarray, intran:np.ndarray, img_shape:tuple):
81+
"""_summary_
82+
83+
Args:
84+
pcd (np.ndarray): Nx3\\
85+
extran (np.ndarray): 4x4\\
86+
intran (np.ndarray): 3x3\\
87+
img_shape (tuple): HxW\\
88+
89+
Returns:
90+
_type_: uv (N,2), rev (N,)
91+
"""
8192
H, W = img_shape
8293
pcd_ = nptran(pcd, extran) # (N, 3)
8394
pcd_ = intran @ pcd_.T # (3, N)
@@ -88,7 +99,7 @@ def npproj(pcd:np.ndarray, extran:np.ndarray, intran:np.ndarray, img_shape:tuple
8899
u = u[rev]/w[rev]
89100
v = v[rev]/w[rev]
90101
rev2 = (0<=u) * (u<W) * (0<=v) * (v<H)
91-
return np.stack((u[rev2],v[rev2]),axis=1), raw_index[rev2] # (N, 2)
102+
return np.stack((u[rev2],v[rev2]),axis=1), raw_index[rev2] # (N, 2), (N,)
92103

93104
def project_corr_pts(src_pcd_corr:np.ndarray, tgt_pcd_corr:np.ndarray, extran:np.ndarray, intran:np.ndarray, img_shape:tuple):
94105
src_proj_pts, src_rev_idx = npproj(src_pcd_corr, extran, intran, img_shape)

0 commit comments

Comments
 (0)