Skip to content

Commit be191e1

Browse files
committed
more numba
1 parent bb070fb commit be191e1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

openptv_python/multimed.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def multimed_r_nlay(cal: Calibration, mm: MultimediaPar, pos: np.ndarray) -> flo
5757
return mmf
5858

5959

60-
# @njit
60+
@njit
6161
def fast_multimed_r_nlay(
6262
nlay: int,
6363
n1: float,
@@ -87,7 +87,7 @@ def fast_multimed_r_nlay(
8787
for i in range(1, nlay):
8888
zout += d[i]
8989

90-
r = np.linalg.norm(np.array([X-x0, Y-y0, 0], dtype=np.float64))
90+
r = norm(X-x0, Y-y0, 0)
9191
rq = r
9292

9393
it = 0
@@ -117,7 +117,7 @@ def fast_multimed_r_nlay(
117117

118118
def trans_cam_point(
119119
ex: Exterior, mm: MultimediaPar, glass: Glass, pos: np.ndarray
120-
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.float64]:
120+
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]:
121121
"""Transform the camera and point coordinates to the glass coordinates.
122122
123123
ex = Exterior(x0=ex_x, y0=ex_y, z0=ex_z)
@@ -141,7 +141,7 @@ def fast_trans_cam_point(
141141
d: float,
142142
glass_dir: np.ndarray,
143143
pos: np.ndarray
144-
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.float64]:
144+
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]:
145145
"""Derive translation of camera point."""
146146
dist_o_glass = float(np.linalg.norm(glass_dir)) # vector length
147147
if dist_o_glass == 0.0:
@@ -169,7 +169,7 @@ def fast_trans_cam_point(
169169
temp = cross_p - temp
170170
pos_t = np.array([np.linalg.norm(temp), 0, dist_point_glass])
171171

172-
return pos_t, cross_p, cross_c, z0
172+
return pos_t, cross_p, cross_c, float(z0)
173173

174174

175175
def back_trans_point(

0 commit comments

Comments
 (0)