def triangulate_track(track, graph, reconstruction, Rt_by_id, reproj_threshold, min_ray_angle_degrees): min_ray_angle = np.radians(min_ray_angle_degrees) Rts, bs = [], [] for shot_id in graph[track]: if shot_id in reconstruction["shots"]: shot = reconstruction["shots"][shot_id] camera = reconstruction["cameras"][shot["camera"]] if shot_id not in Rt_by_id: Rt_by_id[shot_id] = Rt_from_shot(shot) Rts.append(Rt_by_id[shot_id]) x = graph[track][shot_id]["feature"] b = multiview.pixel_bearing(np.array(x), camera) bs.append(b) if len(Rts) >= 2: e, X = csfm.triangulate_bearings(Rts, bs, reproj_threshold, min_ray_angle) if X is not None: reconstruction["points"][track] = {"coordinates": list(X)}
def triangulate_track(track, graph, reconstruction, Rt_by_id, reproj_threshold, min_ray_angle_degrees): min_ray_angle = np.radians(min_ray_angle_degrees) Rts, bs = [], [] for shot_id in graph[track]: if shot_id in reconstruction.shots: shot = reconstruction.shots[shot_id] if shot_id not in Rt_by_id: Rt_by_id[shot_id] = shot.pose.get_Rt() Rts.append(Rt_by_id[shot_id]) x = graph[track][shot_id]['feature'] b = shot.camera.pixel_bearing(np.array(x)) bs.append(b) if len(Rts) >= 2: e, X = csfm.triangulate_bearings(Rts, bs, reproj_threshold, min_ray_angle) if X is not None: point = types.Point() point.id = track point.coordinates = X.tolist() reconstruction.add_point(point)
def triangulate_track(track, graph, reconstruction, Rt_by_id, reproj_threshold, min_ray_angle_degrees): min_ray_angle = np.radians(min_ray_angle_degrees) Rts, bs = [], [] for shot_id in graph[track]: if shot_id in reconstruction['shots']: shot = reconstruction['shots'][shot_id] camera = reconstruction['cameras'][shot['camera']] if shot_id not in Rt_by_id: Rt_by_id[shot_id] = Rt_from_shot(shot) Rts.append(Rt_by_id[shot_id]) x = graph[track][shot_id]['feature'] b = multiview.pixel_bearing(np.array(x), camera) bs.append(b) if len(Rts) >= 2: e, X = csfm.triangulate_bearings(Rts, bs, reproj_threshold, min_ray_angle) if X is not None: reconstruction['points'][track] = { "coordinates": list(X), }