ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
combination_sampler.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "optim/sampler.h"
11 
12 namespace colmap {
13 
14 // Random sampler for RANSAC-based methods that generates unique samples.
15 //
16 // Note that a separate sampler should be instantiated per thread and it assumes
17 // that the input data is shuffled in advance.
18 class CombinationSampler : public Sampler {
19 public:
20  explicit CombinationSampler(const size_t num_samples);
21 
22  void Initialize(const size_t total_num_samples) override;
23 
24  size_t MaxNumSamples() override;
25 
26  std::vector<size_t> Sample() override;
27 
28 private:
29  const size_t num_samples_;
30  std::vector<size_t> total_sample_idxs_;
31 };
32 
33 } // namespace colmap
colmap::Camera::Camera
Camera()
Definition: camera.cc:42
colmap::NextCombination
bool NextCombination(Iterator first, Iterator middle, Iterator last)
Definition: math.h:273
CheckConstantImage
#define CheckConstantImage(image, orig_image)
Definition: bundle_adjustment_test.cc:71
colmap::image_t
uint32_t image_t
Definition: types.h:61
CheckConstantCamera
#define CheckConstantCamera(camera, orig_camera)
Definition: bundle_adjustment_test.cc:53
colmap::Image::SetPoints2D
void SetPoints2D(const std::vector< Eigen::Vector2d > &points)
Definition: image.cc:71
Eigen::Matrix3x4d
Matrix< double, 3, 4 > Matrix3x4d
Definition: types.h:39
camera_models.h
colmap::CombinationSampler::Sample
std::vector< size_t > Sample() override
Definition: combination_sampler.cc:55
colmap::CombinationSampler
Definition: combination_sampler.h:18
colmap::SetPRNGSeed
void SetPRNGSeed(unsigned seed)
Definition: random.cc:40
colmap::BundleAdjustmentConfig
Definition: bundle_adjustment.h:27
colmap::ComposeIdentityQuaternion
Eigen::Vector4d ComposeIdentityQuaternion()
Definition: pose.h:209
colmap::NChooseK
size_t NChooseK(const size_t n, const size_t k)
Definition: math.cc:36
colmap::Reconstruction::AddPoint3D
point3D_t AddPoint3D(const Eigen::Vector3d &xyz, const Track &track, const Eigen::Vector3ub &color=Eigen::Vector3ub::Zero())
Definition: reconstruction.cc:189
CheckConstantCameraRig
#define CheckConstantCameraRig(camera_rig, orig_camera_rig, camera_id)
Definition: bundle_adjustment_test.cc:83
colmap::BundleAdjustmentConfig::AddConstantPoint
void AddConstantPoint(const point3D_t point3D_id)
Definition: bundle_adjustment.cc:197
colmap::TrackElement::image_id
image_t image_id
Definition: track.h:22
colmap::Camera::SetModelIdFromName
void SetModelIdFromName(const std::string &model_name)
Definition: camera.cc:57
colmap::Image::Point2D
const class Point2D & Point2D(const point2D_t point2D_idx) const
Definition: image.h:349
CheckVariablePoint
#define CheckVariablePoint(point, orig_point)
Definition: bundle_adjustment_test.cc:103
colmap::Sampler
Definition: sampler.h:18
testing.h
colmap::Reconstruction
Definition: reconstruction.h:40
sampler.h
colmap::RigBundleAdjuster::Options::refine_relative_poses
bool refine_relative_poses
Definition: bundle_adjustment.h:278
colmap::SimpleRadialCameraModel::model_id
static const int model_id
Definition: camera_models.h:196
combination_sampler.h
colmap::CorrespondenceGraph
Definition: correspondence_graph.h:20
colmap::point3D_t
uint64_t point3D_t
Definition: types.h:72
projection.h
colmap::RandomReal
T RandomReal(const T min, const T max)
Definition: random.h:75
colmap::BundleAdjustmentOptions::refine_extra_params
bool refine_extra_params
Definition: bundle_adjustment.h:108
colmap::Image::SetCameraId
void SetCameraId(const camera_t camera_id)
Definition: image.h:250
math.h
random.h
colmap::BundleAdjustmentOptions::refine_focal_length
bool refine_focal_length
Definition: bundle_adjustment.h:102
colmap::BundleAdjuster
Definition: bundle_adjustment.h:172
colmap::SimpleRadialCameraModel::focal_length_idxs
static const std::vector< size_t > focal_length_idxs
Definition: camera_models.h:196
colmap::Reconstruction::DeleteObservation
void DeleteObservation(const image_t image_id, const point2D_t point2D_idx)
Definition: reconstruction.cc:283
colmap::Reconstruction::AddImage
void AddImage(const class Image &image)
Definition: reconstruction.cc:184
colmap::BundleAdjustmentConfig::SetConstantTvec
void SetConstantTvec(const image_t image_id, const std::vector< int > &idxs)
Definition: bundle_adjustment.cc:154
colmap::Reconstruction::SetUp
void SetUp(const CorrespondenceGraph *correspondence_graph)
Definition: reconstruction.cc:125
colmap::HasPointPositiveDepth
bool HasPointPositiveDepth(const Eigen::Matrix3x4d &proj_matrix, const Eigen::Vector3d &point3D)
Definition: projection.cc:191
bundle_adjustment.h
CheckConstantXImage
#define CheckConstantXImage(image, orig_image)
Definition: bundle_adjustment_test.cc:77
colmap::RigBundleAdjuster::Options
Definition: bundle_adjustment.h:276
CheckVariableCamera
#define CheckVariableCamera(camera, orig_camera)
Definition: bundle_adjustment_test.cc:41
colmap::BundleAdjustmentOptions::refine_principal_point
bool refine_principal_point
Definition: bundle_adjustment.h:105
colmap::BundleAdjustmentConfig::SetConstantCamera
void SetConstantCamera(const camera_t camera_id)
Definition: bundle_adjustment.cc:128
colmap::Reconstruction::AddObservation
void AddObservation(const point3D_t point3D_id, const TrackElement &track_el)
Definition: reconstruction.cc:218
image
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
colmap::Image
Definition: image.h:29
colmap::BundleAdjustmentConfig::AddImage
void AddImage(const image_t image_id)
Definition: bundle_adjustment.cc:116
colmap::TrackElement
Definition: track.h:18
colmap::Reconstruction::AddCamera
void AddCamera(const class Camera &camera)
Definition: reconstruction.cc:178
colmap::CombinationSampler::CombinationSampler
CombinationSampler(const size_t num_samples)
Definition: combination_sampler.cc:41
colmap::CombinationSampler::Initialize
void Initialize(const size_t total_num_samples) override
Definition: combination_sampler.cc:44
colmap::Point2D::Point3DId
point3D_t Point3DId() const
Definition: point2d.h:63
colmap::RigBundleAdjuster::Solve
bool Solve(Reconstruction *reconstruction, std::vector< CameraRig > *camera_rigs)
Definition: bundle_adjustment.cc:907
GeneratePointCloud
void GeneratePointCloud(const size_t num_points, const Eigen::Vector3d &min, const Eigen::Vector3d &max, Reconstruction *reconstruction)
Definition: bundle_adjustment_test.cc:111
CheckConstantPoint
#define CheckConstantPoint(point, orig_point)
Definition: bundle_adjustment_test.cc:106
colmap::RigBundleAdjuster
Definition: bundle_adjustment.h:274
colmap::SimpleRadialCameraModel::principal_point_idxs
static const std::vector< size_t > principal_point_idxs
Definition: camera_models.h:196
colmap::Track
Definition: track.h:30
colmap::BundleAdjuster::Solve
bool Solve(Reconstruction *reconstruction)
Definition: bundle_adjustment.cc:372
colmap::Reconstruction::Points3D
const std::unordered_map< point3D_t, class Point3D > & Points3D() const
Definition: reconstruction.h:508
correspondence_graph.h
colmap::Image::Image
Image()
Definition: image.cc:46
colmap::BundleAdjustmentConfig::SetConstantPose
void SetConstantPose(const image_t image_id)
Definition: bundle_adjustment.cc:140
colmap::BundleAdjustmentOptions
Definition: bundle_adjustment.h:93
colmap
Definition: AutomaticReconstructionController.h:17
colmap::BundleAdjustmentConfig::NumResiduals
size_t NumResiduals(const Reconstruction &reconstruction) const
Definition: bundle_adjustment.cc:83
GenerateReconstruction
void GenerateReconstruction(const size_t num_images, const size_t num_points, Reconstruction *reconstruction, CorrespondenceGraph *correspondence_graph)
Definition: bundle_adjustment_test.cc:123
CheckVariableImage
#define CheckVariableImage(image, orig_image)
Definition: bundle_adjustment_test.cc:65
colmap::camera_t
uint32_t camera_t
Definition: types.h:58
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(TestConfigNumObservations)
Definition: bundle_adjustment_test.cc:186
colmap::BundleAdjuster::Summary
const ceres::Solver::Summary & Summary() const
Definition: bundle_adjustment.cc:404
CheckVariableCameraRig
#define CheckVariableCameraRig(camera_rig, orig_camera_rig, camera_id)
Definition: bundle_adjustment_test.cc:91
patch::to_string
std::string to_string(const T &n)
Definition: Common.h:20
colmap::BundleAdjustmentConfig::AddVariablePoint
void AddVariablePoint(const point3D_t point3D_id)
Definition: bundle_adjustment.cc:192
colmap::CombinationSampler::MaxNumSamples
size_t MaxNumSamples() override
Definition: combination_sampler.cc:51
colmap::CorrespondenceGraph::AddImage
void AddImage(const image_t image_id, const size_t num_points2D)
Definition: correspondence_graph.cc:71
colmap::ProjectPointToImage
Eigen::Vector2d ProjectPointToImage(const Eigen::Vector3d &point3D, const Eigen::Matrix3x4d &proj_matrix, const Camera &camera)
Definition: projection.cc:104
colmap::Reconstruction::Camera
const class Camera & Camera(const camera_t camera_id) const
Definition: reconstruction.h:450
colmap::SimpleRadialCameraModel::extra_params_idxs
static const std::vector< size_t > extra_params_idxs
Definition: camera_models.h:196
colmap::Camera
Definition: camera.h:20
colmap::Camera::SetCameraId
void SetCameraId(const camera_t camera_id)
Definition: camera.h:156
colmap::Camera::InitializeWithId
void InitializeWithId(const int model_id, const double focal_length, const size_t width, const size_t height)
Definition: camera.cc:203
colmap::Reconstruction::Image
const class Image & Image(const image_t image_id) const
Definition: reconstruction.h:454
colmap::TrackElement::point2D_idx
point2D_t point2D_idx
Definition: track.h:24