@@ -410,10 +410,10 @@ bool AlignReconstructionsViaPoints(const Reconstruction& src_reconstruction,
410410
411411bool MergeReconstructions (const double max_reproj_error,
412412 const Reconstruction& src_reconstruction,
413- Reconstruction* tgt_reconstruction) {
413+ Reconstruction& tgt_reconstruction) {
414414 Sim3d tgt_from_src;
415415 if (!AlignReconstructionsViaReprojections (src_reconstruction,
416- * tgt_reconstruction,
416+ tgt_reconstruction,
417417 /* min_inlier_observations=*/ 0.3 ,
418418 max_reproj_error,
419419 &tgt_from_src)) {
@@ -426,7 +426,7 @@ bool MergeReconstructions(const double max_reproj_error,
426426 std::unordered_set<image_t > missing_image_ids;
427427 missing_image_ids.reserve (src_reconstruction.NumRegImages ());
428428 for (const auto & image_id : src_reconstruction.RegImageIds ()) {
429- if (tgt_reconstruction-> ExistsImage (image_id)) {
429+ if (tgt_reconstruction. ExistsImage (image_id)) {
430430 common_image_ids.insert (image_id);
431431 } else {
432432 missing_image_ids.insert (image_id);
@@ -439,10 +439,10 @@ bool MergeReconstructions(const double max_reproj_error,
439439 src_image.SetRegistered (false );
440440 src_image.CamFromWorld () =
441441 TransformCameraWorld (tgt_from_src, src_image.CamFromWorld ());
442- tgt_reconstruction-> AddImage (src_image);
443- tgt_reconstruction-> RegisterImage (image_id);
444- if (!tgt_reconstruction-> ExistsCamera (src_image.CameraId ())) {
445- tgt_reconstruction-> AddCamera (
442+ tgt_reconstruction. AddImage (src_image);
443+ tgt_reconstruction. RegisterImage (image_id);
444+ if (!tgt_reconstruction. ExistsCamera (src_image.CameraId ())) {
445+ tgt_reconstruction. AddCamera (
446446 src_reconstruction.Camera (src_image.CameraId ()));
447447 }
448448 }
@@ -461,7 +461,7 @@ bool MergeReconstructions(const double max_reproj_error,
461461 std::unordered_set<point3D_t> old_point3D_ids;
462462 for (const auto & track_el : point3D.second .track .Elements ()) {
463463 if (common_image_ids.count (track_el.image_id ) > 0 ) {
464- const auto & point2D = tgt_reconstruction-> Image (track_el.image_id )
464+ const auto & point2D = tgt_reconstruction. Image (track_el.image_id )
465465 .Point2D (track_el.point2D_idx );
466466 if (point2D.HasPoint3D ()) {
467467 old_track.AddElement (track_el);
@@ -470,7 +470,7 @@ bool MergeReconstructions(const double max_reproj_error,
470470 new_track.AddElement (track_el);
471471 }
472472 } else if (missing_image_ids.count (track_el.image_id ) > 0 ) {
473- tgt_reconstruction-> Image (track_el.image_id )
473+ tgt_reconstruction. Image (track_el.image_id )
474474 .ResetPoint3DForPoint2D (track_el.point2D_idx );
475475 new_track.AddElement (track_el);
476476 }
@@ -483,15 +483,12 @@ bool MergeReconstructions(const double max_reproj_error,
483483 if (create_new_point || merge_new_and_old_point) {
484484 const Eigen::Vector3d xyz = tgt_from_src * point3D.second .xyz ;
485485 const auto point3D_id =
486- tgt_reconstruction-> AddPoint3D (xyz, new_track, point3D.second .color );
486+ tgt_reconstruction. AddPoint3D (xyz, new_track, point3D.second .color );
487487 if (old_point3D_ids.size () == 1 ) {
488- tgt_reconstruction-> MergePoints3D (point3D_id, *old_point3D_ids.begin ());
488+ tgt_reconstruction. MergePoints3D (point3D_id, *old_point3D_ids.begin ());
489489 }
490490 }
491491 }
492-
493- tgt_reconstruction->FilterAllPoints3D (max_reproj_error, /* min_tri_angle=*/ 0 );
494-
495492 return true ;
496493}
497494
0 commit comments