@@ -93,47 +93,54 @@ pub fn filter_config<C: Camera<Float> + Clone, Feat: Feature> (
93
93
println ! ( "After DUAL Outlier: SFM Config Max Reprojection Error 2): {}, Min Reprojection Error: {}" , max_reprojection_error_outlier_dual, min_reprojection_error_outlier_dual) ;
94
94
}
95
95
96
- if refine_rotation_via_rcd {
97
- let new_pose_map = refine_rotation_by_rcd ( root, & paths, & pose_map) ;
98
- let path_pairs = conversions:: compute_path_id_pairs ( root, & paths) ;
99
- let mut new_landmark_map = compute_landmark_maps ( & path_pairs, & new_pose_map, & match_map, & camera_map, triangulation) ;
100
- let mut new_reprojection_error_map =
101
- compute_reprojection_maps (
102
- & path_pairs,
103
- & new_landmark_map,
104
- & new_pose_map,
105
- & match_norm_map,
106
- & camera_norm_map
107
- ) ;
108
- let keys = landmark_map. keys ( ) . map ( |k| * k) . collect :: < Vec < _ > > ( ) ;
109
- for key in keys {
110
- let new_reprojection_errors = new_reprojection_error_map. get ( & key) . unwrap ( ) ;
111
- let current_reprojection_errors = reprojection_error_map. get_mut ( & key) . unwrap ( ) ;
112
-
113
- if new_reprojection_errors. mean ( ) < current_reprojection_errors. mean ( ) {
114
- landmark_map. insert ( key, new_landmark_map. remove ( & key) . unwrap ( ) ) ;
115
- reprojection_error_map
116
- . insert ( key, new_reprojection_error_map. remove ( & key) . unwrap ( ) ) ;
117
- pose_map. insert ( key, new_pose_map. get ( & key) . unwrap ( ) . clone ( ) ) ;
118
- }
119
- }
120
- abs_pose_map = conversions:: compute_absolute_poses_for_root ( root, & paths_pairs, & pose_map) ;
121
- if run_outlier_detection_pipeline {
122
- let new_rejected_camera_ids = reject_landmark_outliers (
123
- & mut landmark_map,
124
- & mut reprojection_error_map,
125
- & mut match_map,
126
- & mut match_norm_map,
127
- landmark_cutoff_thresh,
128
- ) ;
129
- rejected_camera_ids. extend ( new_rejected_camera_ids. iter ( ) ) ;
130
- assert ! ( !rejected_camera_ids. contains( & root) ) ;
131
96
97
+ let new_pose_map = match refine_rotation_via_rcd {
98
+ true => refine_rotation_by_rcd ( root, & paths, & pose_map) ,
99
+ false => pose_map. clone ( )
100
+ } ;
101
+
102
+ // We re-triangulate regardless of rcd because matches, landmarks may have been removed by the outlier rejection
103
+ let path_pairs = conversions:: compute_path_id_pairs ( root, & paths) ;
104
+ let mut new_landmark_map = compute_landmark_maps ( & path_pairs, & new_pose_map, & match_map, & camera_map, triangulation) ;
105
+ let mut new_reprojection_error_map =
106
+ compute_reprojection_maps (
107
+ & path_pairs,
108
+ & new_landmark_map,
109
+ & new_pose_map,
110
+ & match_norm_map,
111
+ & camera_norm_map
112
+ ) ;
113
+
114
+ let keys = landmark_map. keys ( ) . map ( |k| * k) . collect :: < Vec < _ > > ( ) ;
115
+ for key in keys {
116
+ let new_reprojection_errors = new_reprojection_error_map. get ( & key) . unwrap ( ) ;
117
+ let current_reprojection_errors = reprojection_error_map. get_mut ( & key) . unwrap ( ) ;
118
+
119
+ if new_reprojection_errors. mean ( ) < current_reprojection_errors. mean ( ) {
120
+ landmark_map. insert ( key, new_landmark_map. remove ( & key) . unwrap ( ) ) ;
121
+ reprojection_error_map
122
+ . insert ( key, new_reprojection_error_map. remove ( & key) . unwrap ( ) ) ;
123
+ pose_map. insert ( key, new_pose_map. get ( & key) . unwrap ( ) . clone ( ) ) ;
132
124
}
133
- let ( min_reprojection_error_refined, max_reprojection_error_refined) =
134
- compute_reprojection_ranges ( & reprojection_error_map) ;
135
- println ! ( "After Rotation: BA Config Max Reprojection Error 2): {}, Min Reprojection Error: {}" , max_reprojection_error_refined, min_reprojection_error_refined) ;
136
125
}
126
+ abs_pose_map = conversions:: compute_absolute_poses_for_root ( root, & paths_pairs, & pose_map) ;
127
+ if run_outlier_detection_pipeline {
128
+ let new_rejected_camera_ids = reject_landmark_outliers (
129
+ & mut landmark_map,
130
+ & mut reprojection_error_map,
131
+ & mut match_map,
132
+ & mut match_norm_map,
133
+ landmark_cutoff_thresh,
134
+ ) ;
135
+ rejected_camera_ids. extend ( new_rejected_camera_ids. iter ( ) ) ;
136
+ assert ! ( !rejected_camera_ids. contains( & root) ) ;
137
+
138
+ }
139
+ let ( min_reprojection_error_refined, max_reprojection_error_refined) =
140
+ compute_reprojection_ranges ( & reprojection_error_map) ;
141
+ println ! ( "After Rotation: BA Config Max Reprojection Error 2): {}, Min Reprojection Error: {}" , max_reprojection_error_refined, min_reprojection_error_refined) ;
142
+
143
+
137
144
138
145
for ( k, v) in match_map. iter ( ) {
139
146
println ! ( "Final matches for Cam {:?} : {}" , k, v. len( ) ) ;
0 commit comments