1 // This file is part of OpenMVG, an Open Multiple View Geometry C++ library. 2 3 // Copyright (c) 2015 Pierre MOULON. 4 5 // This Source Code Form is subject to the terms of the Mozilla Public 6 // License, v. 2.0. If a copy of the MPL was not distributed with this 7 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 9 #ifndef OPENMVG_SFM_GLOBAL_ENGINE_PIPELINES_GLOBAL_ROTATION_AVERAGING_HPP 10 #define OPENMVG_SFM_GLOBAL_ENGINE_PIPELINES_GLOBAL_ROTATION_AVERAGING_HPP 11 12 #include <vector> 13 14 namespace openMVG { 15 namespace sfm { 16 17 enum ERotationAveragingMethod 18 { 19 ROTATION_AVERAGING_L1 = 1, 20 ROTATION_AVERAGING_L2 = 2 21 }; 22 23 enum ERelativeRotationInferenceMethod 24 { 25 TRIPLET_ROTATION_INFERENCE_NONE = 0, 26 TRIPLET_ROTATION_INFERENCE_COMPOSITION_ERROR = 1 27 }; 28 29 } // namespace sfm 30 } // namespace openMVG 31 32 namespace openMVG { namespace graph { struct Triplet; } } 33 #include "openMVG/types.hpp" 34 #include "openMVG/multiview/rotation_averaging_common.hpp" 35 36 namespace openMVG { 37 namespace sfm { 38 39 class GlobalSfM_Rotation_AveragingSolver 40 { 41 private: 42 mutable Pair_Set used_pairs; // pair that are considered as valid by the rotation averaging solver 43 44 public: 45 bool Run( 46 ERotationAveragingMethod eRotationAveragingMethod, 47 ERelativeRotationInferenceMethod eRelativeRotationInferenceMethod, 48 const rotation_averaging::RelativeRotations & relativeRot_In, 49 Hash_Map<IndexT, Mat3> & map_globalR 50 ) const; 51 52 /// Reject edges of the view graph that do not produce triplets with tiny 53 /// angular error once rotation composition have been computed. 54 void TripletRotationRejection( 55 const double max_angular_error, 56 std::vector<graph::Triplet> & vec_triplets, 57 rotation_averaging::RelativeRotations & relativeRotations) const; 58 59 /// Return the pairs validated by the GlobalRotation routine (inference can remove some) 60 Pair_Set GetUsedPairs() const; 61 }; 62 63 } // namespace sfm 64 } // namespace openMVG 65 66 #endif // OPENMVG_SFM_GLOBAL_ENGINE_PIPELINES_GLOBAL_ROTATION_AVERAGING_HPP 67