 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
14 #include <unordered_map>
189 void MaybeLoadCameras();
190 void MaybeLoadImages();
192 const size_t cache_size_;
194 std::mutex database_mutex_;
195 std::unique_ptr<std::unordered_map<camera_t, Camera>> cameras_cache_;
196 std::unique_ptr<std::unordered_map<image_t, Image>> images_cache_;
197 std::unique_ptr<ThreadSafeLRUCache<image_t, FeatureKeypoints>>
199 std::unique_ptr<ThreadSafeLRUCache<image_t, FeatureDescriptors>>
201 std::unique_ptr<ThreadSafeLRUCache<image_t, bool>> keypoints_exists_cache_;
202 std::unique_ptr<ThreadSafeLRUCache<image_t, bool>>
203 descriptors_exists_cache_;
292 void GetFeatureData(
const int index,
300 std::unique_ptr<OpenGLContextManager> opengl_context_;
303 std::array<image_t, 2> prev_uploaded_image_ids_;
304 std::array<FeatureKeypoints, 2> prev_uploaded_keypoints_;
305 std::array<FeatureDescriptors, 2> prev_uploaded_descriptors_;
345 void Match(
const std::vector<std::pair<image_t, image_t>>& image_pairs);
354 std::vector<std::unique_ptr<FeatureMatcherThread>> matchers_;
355 std::vector<std::unique_ptr<FeatureMatcherThread>> guided_matchers_;
356 std::vector<std::unique_ptr<Thread>> verifiers_;
357 std::unique_ptr<ThreadPool> thread_pool_;
392 const std::string& database_path);
399 std::shared_ptr<Database> database_;
400 std::shared_ptr<FeatureMatcherCache> cache_;
401 std::shared_ptr<SiftFeatureMatcher> matcher_;
426 const std::string& database_path);
431 std::vector<image_t> GetOrderedImageIds()
const;
432 void RunSequentialMatching(
const std::vector<image_t>& image_ids);
433 void RunLoopDetection(
const std::vector<image_t>& image_ids);
438 const std::shared_ptr<FeatureMatcherCache> cache_;
447 const std::string& database_path);
465 const std::string& database_path);
485 const std::string& database_path);
510 const std::string& database_path);
541 const std::string& database_path);
544 const static size_t kCacheSize = 100;
Definition: two_view_geometry.h:43
JobQueue< Output > * output_queue_
Definition: matching.h:232
void PrintHeading1(const std::string &heading)
Definition: misc.cc:225
int loop_detection_num_nearest_neighbors
Definition: matching.h:53
const Image & GetImage(const image_t image_id)
Definition: matching.cc:287
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
Definition: matching.h:99
JobQueue< Input > * input_queue_
Definition: matching.h:231
uint32_t image_t
Definition: types.h:61
uint64_t image_pair_t
Definition: types.h:64
Definition: two_view_geometry.h:19
FeatureDescriptors ReadDescriptors(const image_t image_id) const
Definition: database.cc:448
int num_iterations
Definition: matching.h:122
TwoViewGeometryVerifier(const SiftMatchingOptions &options, FeatureMatcherCache *cache, JobQueue< Input > *input_queue, JobQueue< Output > *output_queue)
Definition: matching.cc:656
void Run() override
Definition: matching.cc:677
TwoViewGeometry::Options two_view_geometry_options_
Definition: matching.h:322
SiftGPUFeatureMatcher(const SiftMatchingOptions &options, FeatureMatcherCache *cache, JobQueue< Input > *input_queue, JobQueue< Output > *output_queue)
Definition: matching.cc:411
std::vector< image_t > GetImageIds()
Definition: matching.cc:308
int num_nearest_neighbors
Definition: matching.h:77
Definition: matching.h:206
Definition: matching.h:218
image_t image_id2
Definition: matching.h:151
const Timer & GetTimer() const
Definition: threading.cc:154
std::filesystem::path MaybeDownloadAndCacheFile(const std::string &uri)
void MatchSiftFeaturesGPU(const SiftMatchingOptions &match_options, const FeatureDescriptors *descriptors1, const FeatureDescriptors *descriptors2, SiftMatchGPU *sift_match_gpu, FeatureMatches *matches)
Definition: sift.cc:1195
TwoViewGeometry two_view_geometry
Definition: matching.h:153
int max_num_matches
Definition: sift.h:121
bool ExistsMatches(const image_t image_id1, const image_t image_id2)
Definition: matching.cc:328
bool Check() const
Definition: matching.cc:197
SequentialFeatureMatcher(const SequentialMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1038
Definition: matching.h:506
Definition: matching.h:72
GraphType data
Definition: graph_cut.cc:138
Definition: matching.h:422
int batch_size
Definition: matching.h:119
std::vector< Image > ReadAllImages() const
Definition: database.cc:423
Definition: threading.h:237
FeatureKeypoints ReadKeypoints(const image_t image_id) const
Definition: database.cc:436
void DeleteInlierMatches(const image_t image_id1, const image_t image_id2) const
Definition: database.cc:818
FeaturePairsFeatureMatcher(const FeaturePairsMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1649
Definition: matching.h:537
void ReadTwoViewGeometryNumInliers(std::vector< std::pair< image_t, image_t >> *image_pairs, std::vector< int > *num_inliers) const
Definition: database.cc:579
Definition: matching.h:127
int block_size
Definition: matching.h:30
std::array< image_t, 2 > prev_uploaded_image_ids_
Definition: matching.h:258
bool Check() const
Definition: sift.cc:403
int loop_detection_period
Definition: matching.h:46
TransitiveFeatureMatcher(const TransitiveMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1436
Definition: matching.h:149
Definition: matching.h:279
Definition: threading.h:74
FeatureMatcherThread(const SiftMatchingOptions &options, FeatureMatcherCache *cache)
Definition: matching.cc:366
bool is_gps
Definition: matching.h:102
@ CALIBRATED
Definition: two_view_geometry.h:26
SpatialFeatureMatcher(const SpatialMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1251
int num_images
Definition: matching.h:74
std::array< FeatureDescriptors, 2 > prev_uploaded_descriptors_
Definition: matching.h:259
Definition: database.h:29
internal::FeatureMatcherData Input
Definition: matching.h:264
bool Check() const
Definition: matching.cc:176
void GetDescriptorData(const int index, const image_t image_id, const FeatureDescriptors **descriptors_ptr)
Definition: matching.cc:488
JobQueue< Input > * input_queue_
Definition: matching.h:324
bool Setup()
Definition: matching.cc:833
int max_num_features
Definition: matching.h:88
int max_num_neighbors
Definition: matching.h:108
bool multiple_models
Definition: sift.h:143
Definition: opengl_utils.h:73
bool loop_detection
Definition: matching.h:43
SiftFeatureMatcher(const SiftMatchingOptions &options, Database *database, FeatureMatcherCache *cache)
Definition: matching.cc:724
double confidence
Definition: ransac.h:33
std::string vocab_tree_path
Definition: matching.h:67
FeatureMatcherCache * cache_
Definition: matching.h:215
int num_threads
Definition: sift.h:98
Definition: matching.h:35
bool ExistsKeypoints(const image_t image_id) const
Definition: database.cc:307
FeatureMatcherCache(const size_t cache_size, const Database *database)
Definition: matching.cc:216
ExhaustiveFeatureMatcher(const ExhaustiveMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:961
bool use_gpu
Definition: sift.h:104
void SetMaxNumMatches(const int max_num_matches)
Definition: matching.cc:370
void DeleteMatches(const image_t image_id1, const image_t image_id2) const
Definition: database.cc:809
FeatureMatches GetMatches(const image_t image_id1, const image_t image_id2)
Definition: matching.cc:302
internal::FeatureMatcherData Input
Definition: matching.h:281
int num_checks
Definition: matching.h:80
std::shared_ptr< FeatureKeypoints > GetKeypoints(const image_t image_id)
Definition: matching.cc:292
const image_t kInvalidImageId
Definition: types.h:76
double max_distance
Definition: matching.h:112
Eigen::Matrix< uint8_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > FeatureDescriptors
Definition: types.h:79
const double * e
Definition: essential_matrix_poly.h:10
Definition: matching.h:235
const Camera & GetCamera(const camera_t camera_id)
Definition: matching.cc:282
std::string gpu_index
Definition: sift.h:109
std::string match_list_path
Definition: matching.h:132
std::vector< Eigen::Vector2d > FeatureKeypointsToPointsVector(const FeatureKeypoints &keypoints)
Definition: utils.cc:38
Definition: matching.h:481
int loop_detection_num_images
Definition: matching.h:50
void Run() override
Definition: matching.cc:428
bool CreateSiftGPUMatcher(const SiftMatchingOptions &match_options, SiftMatchGPU *sift_match_gpu)
Definition: sift.cc:1124
int loop_detection_max_num_features
Definition: matching.h:64
JobQueue< Output > * output_queue_
Definition: matching.h:325
std::vector< Camera > ReadAllCameras() const
Definition: database.cc:380
void Setup()
Definition: matching.cc:250
static image_pair_t ImagePairToPairId(const image_t image_id1, const image_t image_id2)
Definition: database.h:339
std::string match_list_path
Definition: matching.h:94
bool guided_matching
Definition: sift.h:146
int GetNumCudaDevices()
Definition: cuda.cc:57
Definition: matching.h:333
void MatchSiftFeaturesCPU(const SiftMatchingOptions &match_options, const FeatureDescriptors &descriptors1, const FeatureDescriptors &descriptors2, FeatureMatches *matches)
Definition: sift.cc:1042
GuidedSiftGPUFeatureMatcher(const SiftMatchingOptions &options, FeatureMatcherCache *cache, JobQueue< Input > *input_queue, JobQueue< Output > *output_queue)
Definition: matching.cc:551
bool ExistsInlierMatches(const image_t image_id1, const image_t image_id2)
Definition: matching.cc:334
internal::FeatureMatcherData Output
Definition: matching.h:282
int block_size
Definition: matching.h:129
Definition: matching.h:461
Definition: matching.h:443
@ UNCALIBRATED
Definition: two_view_geometry.h:28
bool Check() const
Definition: matching.cc:203
int loop_detection_num_images_after_verification
Definition: matching.h:60
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
void Match(const std::vector< std::pair< image_t, image_t >> &image_pairs)
Definition: matching.cc:869
RANSACOptions ransac_options
Definition: two_view_geometry.h:81
void WriteTwoViewGeometry(const image_t image_id1, const image_t image_id2, const TwoViewGeometry &two_view_geometry)
Definition: matching.cc:347
void WriteMatches(const image_t image_id1, const image_t image_id2, const FeatureMatches &matches)
Definition: matching.cc:340
double max_error
Definition: ransac.h:25
void MatchGuidedSiftFeaturesCPU(const SiftMatchingOptions &match_options, const FeatureKeypoints &keypoints1, const FeatureKeypoints &keypoints2, const FeatureDescriptors &descriptors1, const FeatureDescriptors &descriptors2, TwoViewGeometry *two_view_geometry)
Definition: sift.cc:1050
internal::FeatureMatcherData Input
Definition: matching.h:220
Definition: matching.h:137
void DeleteMatches(const image_t image_id1, const image_t image_id2)
Definition: matching.cc:354
JobQueue< Input > * input_queue_
Definition: matching.h:252
const static std::string kDefaultVocabTreeUri
Definition: resources.h:25
void StringTrim(std::string *str)
Definition: string.cc:188
std::unique_ptr< OpenGLContextManager > opengl_context_
Definition: matching.h:255
size_t min_num_trials
Definition: ransac.h:40
bool Check() const
Definition: matching.cc:190
std::string match_list_path
Definition: matching.h:142
bool ExistsDescriptors(const image_t image_id) const
Definition: database.cc:311
internal::FeatureMatcherData Input
Definition: matching.h:237
double min_inlier_ratio
Definition: ransac.h:29
bool quadratic_overlap
Definition: matching.h:40
double max_error
Definition: sift.h:124
JobQueue< Output > * output_queue_
Definition: matching.h:253
int min_num_trials
Definition: sift.h:131
internal::FeatureMatcherData Output
Definition: matching.h:221
double confidence
Definition: sift.h:127
const SiftMatchingOptions options_
Definition: matching.h:321
FeatureMatches matches
Definition: matching.h:152
static const int kMaxNumThreads
Definition: threading.h:173
void SignalInvalidSetup()
Definition: threading.cc:146
int GetEffectiveNumThreads(const int num_threads)
Definition: threading.cc:269
Definition: matching.h:28
void ExtractTopScaleFeatures(FeatureKeypoints *keypoints, FeatureDescriptors *descriptors, const size_t num_features)
Definition: utils.cc:79
SiftCPUFeatureMatcher(const SiftMatchingOptions &options, FeatureMatcherCache *cache, JobQueue< Input > *input_queue, JobQueue< Output > *output_queue)
Definition: matching.cc:374
int overlap
Definition: matching.h:37
SiftMatchingOptions options_
Definition: matching.h:214
bool Check() const
Definition: matching.cc:214
Definition: matching.h:388
void Run() override
Definition: matching.cc:384
void SignalValidSetup()
Definition: threading.cc:138
bool ExistsDescriptors(const image_t image_id)
Definition: matching.cc:324
void WriteMatches(const image_t image_id1, const image_t image_id2, const FeatureMatches &matches) const
Definition: database.cc:685
void DeleteInlierMatches(const image_t image_id1, const image_t image_id2)
Definition: matching.cc:360
void WriteTwoViewGeometry(const image_t image_id1, const image_t image_id2, const TwoViewGeometry &two_view_geometry) const
Definition: database.cc:703
size_t max_num_trials
Definition: ransac.h:41
FeatureMatches ReadMatches(const image_t image_id1, const image_t image_id2) const
Definition: database.cc:461
double min_inlier_ratio
Definition: sift.h:136
Definition: AutomaticReconstructionController.h:17
VocabTreeFeatureMatcher(const VocabTreeMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1171
Definition: matching.h:308
int loop_detection_num_checks
Definition: matching.h:56
bool ExistsKeypoints(const image_t image_id)
Definition: matching.cc:320
internal::FeatureMatcherData Input
Definition: matching.h:310
ImagePairsFeatureMatcher(const ImagePairsMatchingOptions &options, const SiftMatchingOptions &match_options, const std::string &database_path)
Definition: matching.cc:1534
Definition: matching.h:117
Definition: matching.h:262
bool IsStopped()
Definition: threading.cc:97
bool ExistsInlierMatches(const image_t image_id1, const image_t image_id2) const
Definition: database.cc:321
std::vector< FeatureKeypoint > FeatureKeypoints
Definition: types.h:77
void PrintMinutes() const
Definition: timer.cc:93
bool Check() const
Definition: matching.cc:181
std::string vocab_tree_path
Definition: matching.h:91
uint32_t camera_t
Definition: types.h:58
int min_num_inliers
Definition: sift.h:140
GuidedSiftCPUFeatureMatcher(const SiftMatchingOptions &options, FeatureMatcherCache *cache, JobQueue< Input > *input_queue, JobQueue< Output > *output_queue)
Definition: matching.cc:502
#define CHECK_OPTION_GT(val1, val2)
Definition: logging.h:34
std::vector< FeatureMatch > FeatureMatches
Definition: types.h:80
size_t min_num_inliers
Definition: two_view_geometry.h:45
bool Check() const
Definition: matching.cc:209
internal::FeatureMatcherData Output
Definition: matching.h:311
int num_images_after_verification
Definition: matching.h:84
image_t image_id1
Definition: matching.h:150
std::string StringPrintf(const char *format,...)
Definition: string.cc:131
FeatureMatcherCache * cache_
Definition: matching.h:323
std::string to_string(const T &n)
Definition: Common.h:20
bool ExistsMatches(const image_t image_id1, const image_t image_id2) const
Definition: database.cc:315
bool ignore_z
Definition: matching.h:105
internal::FeatureMatcherData Output
Definition: matching.h:238
void MatchGuidedSiftFeaturesGPU(const SiftMatchingOptions &match_options, const FeatureKeypoints *keypoints1, const FeatureKeypoints *keypoints2, const FeatureDescriptors *descriptors1, const FeatureDescriptors *descriptors2, SiftMatchGPU *sift_match_gpu, TwoViewGeometry *two_view_geometry)
Definition: sift.cc:1267
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
Definition: matching.h:159
internal::FeatureMatcherData Output
Definition: matching.h:265
~SiftFeatureMatcher()
Definition: matching.cc:797
std::shared_ptr< FeatureDescriptors > GetDescriptors(const image_t image_id)
Definition: matching.cc:297
bool verify_matches
Definition: matching.h:139
int max_num_trials
Definition: sift.h:132