Skip to content

Commit 4fb06da

Browse files
committed
seems to be a bug in orient and dm,drad are now inputs
1 parent 8813e2e commit 4fb06da

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

openptv_python/orientation.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def orient(
195195
pix: List[Target],
196196
flags: OrientPar,
197197
sigmabeta: np.ndarray,
198+
dm: float = 0.000001,
199+
drad: float = 0.000001
198200
) -> Optional[np.ndarray]:
199201
"""Calculate orientation of the camera, updating its calibration.
200202
@@ -252,8 +254,8 @@ def orient(
252254
"""
253255
maxsize = nfix * 2 + IDT
254256

255-
dm: float = 0.000001
256-
drad: float = 0.0000001
257+
# dm: float = 0.000001
258+
# drad: float = 0.0000001
257259

258260
# P, y, yh, Xbeta, resi are arrays of double
259261
P = np.ones(maxsize, dtype=float)
@@ -385,7 +387,7 @@ def orient(
385387
cal.update_rotation_matrix()
386388
xpd, ypd = img_coord(fix[i], cal, cpar.mm)
387389
X[n][6] = (xpd - xp) / dm
388-
X[n + 1][6] = ypd - yp
390+
X[n + 1][6] = (ypd - yp) / dm
389391
# for i in range(len(fix)):
390392
# dm = 0.0001
391393
# xp, yp = 0.0, 0.0
@@ -587,6 +589,8 @@ def raw_orient(
587589
nfix: int,
588590
fix: np.ndarray,
589591
pix: List[Target],
592+
dm: float = 1e-4,
593+
drad: float = 1e-4
590594
) -> bool:
591595
"""Calculate orientation of the camera, updating its calibration."""
592596
# the original C file says nfix is typically 4, but why X is 10 x 6 and not 8?
@@ -600,8 +604,6 @@ def raw_orient(
600604
# XPX = np.zeros((6, 6))
601605
# XPy = np.zeros(6)
602606
beta = np.zeros(6)
603-
dm = 0.0001
604-
drad = 0.0001
605607
pos = np.zeros(3)
606608

607609
cal.added_par.k1 = 0
@@ -788,6 +790,8 @@ def full_calibration(
788790
img_pts: TargetArray,
789791
cparam: ControlPar,
790792
orient_par: OrientPar,
793+
dm: float = 1e-6,
794+
drad: float = 1e-6
791795
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
792796
"""
793797
Perform a full calibration, affecting all calibration structs.
@@ -828,7 +832,7 @@ def full_calibration(
828832
ValueError if iteration did not converge.
829833
"""
830834
err_est = np.empty((NPAR + 1), dtype=np.float64)
831-
residuals = orient(cal, cparam, len(ref_pts), ref_pts, img_pts, orient_par, err_est)
835+
residuals = orient(cal, cparam, len(ref_pts), ref_pts, img_pts, orient_par, err_est, dm=dm, drad=drad)
832836

833837
# free(orip)
834838

0 commit comments

Comments
 (0)