Skip to content

Commit 44edaea

Browse files
committed
fix: fix GCP triangulation
1 parent 4456b5b commit 44edaea

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

opensfm/align.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def align_reconstruction_naive_similarity(config, reconstruction, gcp):
122122
if len(X) == 0:
123123
return 1.0, np.identity(3), np.zeros((3))
124124

125-
# Translation-only case, either :
125+
# Translation-only case, either :
126126
# - a single value
127127
# - identical values
128128
same_values = (np.linalg.norm(np.std(Xp, axis=0)) < 1e-10)
@@ -211,7 +211,7 @@ def align_reconstruction_orientation_prior_similarity(reconstruction, config, gc
211211

212212
def estimate_ground_plane(reconstruction, config):
213213
"""Estimate ground plane orientation.
214-
214+
215215
It assumes cameras are all at a similar height and uses the
216216
align_orientation_prior option to enforce cameras to look
217217
horizontally or vertically.
@@ -239,10 +239,10 @@ def estimate_ground_plane(reconstruction, config):
239239
ground_points.append(shot.pose.get_origin())
240240
ground_points = np.array(ground_points)
241241
ground_points -= ground_points.mean(axis=0)
242-
242+
243243
plane = multiview.fit_plane(ground_points, onplane, verticals)
244244
return plane
245-
245+
246246

247247
def get_horizontal_and_vertical_directions(R, orientation):
248248
"""Get orientation vectors from camera rotation matrix and orientation tag.
@@ -288,16 +288,16 @@ def triangulate_single_gcp(reconstruction, observations):
288288
if len(os) >= 2:
289289
thresholds = len(os) * [reproj_threshold]
290290
angle = np.radians(min_ray_angle_degrees)
291-
e, X = pygeometry.triangulate_bearings_midpoint(os, bs, thresholds, angle)
292-
return X
291+
return pygeometry.triangulate_bearings_midpoint(os, bs, thresholds, angle)
292+
return False, None
293293

294294

295295
def triangulate_all_gcp(reconstruction, gcp):
296296
"""Group and triangulate Ground Control Points seen in 2+ images."""
297297
triangulated, measured = [], []
298298
for point in gcp:
299-
x = triangulate_single_gcp(reconstruction, point.observations)
300-
if x is not None:
299+
e, x = triangulate_single_gcp(reconstruction, point.observations)
300+
if e:
301301
triangulated.append(x)
302302
measured.append(point.coordinates)
303303
return triangulated, measured

0 commit comments

Comments
 (0)