Skip to content

Commit

Permalink
incorporate Braden's suggested improvement to photogrammetry.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bbean23 committed Mar 15, 2024
1 parent 568ab23 commit e418cac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions opencsp/common/lib/photogrammetry/photogrammetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ def align_merit_fcn(vec: ndarray):
return np.sqrt(np.mean(e**2))

# Optimize points
vec = np.array([0, 0, 0, 0, 0, 0, 1], dtype=float)
if scale:
vec = np.array([0, 0, 0, 0, 0, 0, 1], dtype=float)
else:
vec = np.array([0, 0, 0, 0, 0, 0], dtype=float)
x = minimize(align_merit_fcn, vec, method='Powell')

# Calculate final alignment error
Expand All @@ -291,7 +294,8 @@ def align_merit_fcn(vec: ndarray):
# Return transform and scale
rot_out = Rotation.from_rotvec(x.x[:3])
trans_out = Vxyz(x.x[3:6])
return TransformXYZ.from_R_V(rot_out, trans_out), x.x[6], e_final
scale_out = 1.0 if not scale else x.x[6]
return TransformXYZ.from_R_V(rot_out, trans_out), scale_out, e_final


def _ref_coord_error(pts_obj: Vxyz, pts_exp: Vxyz) -> np.ndarray:
Expand Down

0 comments on commit e418cac

Please sign in to comment.