ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
coordinate_frame.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 <Eigen/Core>
11 
12 #include "base/reconstruction.h"
13 
14 namespace colmap {
15 
17  // The maximum image size for line detection.
18  int max_image_size = 1024;
19  // The minimum length of line segments in pixels.
20  double min_line_length = 3;
21  // The tolerance for classifying lines into horizontal/vertical.
23  // The maximum distance in pixels between lines and the vanishing points.
24  double max_line_vp_distance = 0.5;
25  // The maximum cosine distance between estimated axes to be inliers.
26  double max_axis_distance = 0.05;
27 };
28 
29 // Estimate gravity vector by assuming gravity-aligned image orientation, i.e.
30 // the majority of images is assumed to have the gravity vector aligned with an
31 // upright image plane.
33  const Reconstruction& reconstruction,
34  const double max_axis_distance = 0.05);
35 
36 // Estimate the coordinate frame of the reconstruction assuming a Manhattan
37 // world by finding the major vanishing points in each image. This function
38 // assumes that the majority of images is taken in upright direction, i.e.
39 // people are standing upright in the image. The orthonormal axes of the
40 // estimated coordinate frame will be given in the columns of the returned
41 // matrix. If one axis could not be determined, the respective column will be
42 // zero. The axes are specified in the world coordinate system in the order
43 // rightward, downward, forward.
44 Eigen::Matrix3d EstimateManhattanWorldFrame(
46  const Reconstruction& reconstruction,
47  const std::string& image_path);
48 
49 // Aligns the reconstruction to the plane defined by running PCA on the 3D
50 // points. The model centroid is at the origin of the new coordinate system
51 // and the X axis is the first principal component with the Y axis being the
52 // second principal component
54 
55 // Aligns the reconstruction to the local ENU plane orientation. Rotates the
56 // reconstruction such that the x-y plane aligns with the ENU tangent plane at
57 // the point cloud centroid and translates the origin to the centroid.
58 // If unscaled == true, then the original scale of the model remains unchanged.
60  SimilarityTransform3* tform,
61  bool unscaled);
62 
63 } // namespace colmap
colmap::PrintHeading1
void PrintHeading1(const std::string &heading)
Definition: misc.cc:225
coordinate_frame.h
QtCompat::endl
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
colmap::LineSegmentOrientation::VERTICAL
@ VERTICAL
colmap::Reconstruction::NumPoints3D
size_t NumPoints3D() const
Definition: reconstruction.h:442
colmap::ManhattanWorldFrameEstimationOptions::max_line_vp_distance
double max_line_vp_distance
Definition: coordinate_frame.h:24
colmap::AlignToPrincipalPlane
void AlignToPrincipalPlane(Reconstruction *recon, SimilarityTransform3 *tform)
Definition: coordinate_frame.cc:302
x
normal_z x
Definition: my_point_types.h:165
colmap::Reconstruction::ComputeCentroid
Eigen::Vector3d ComputeCentroid(const double p0=0.1, const double p1=0.9) const
Definition: reconstruction.cc:375
colmap::Image::Tvec
const Eigen::Vector3d & Tvec() const
Definition: image.h:325
colmap::UndistortImage
void UndistortImage(const UndistortCameraOptions &options, const Bitmap &distorted_bitmap, const Camera &distorted_camera, Bitmap *undistorted_bitmap, Camera *undistorted_camera)
Definition: undistortion.cc:939
colmap::JoinPaths
std::string JoinPaths(T const &... paths)
Definition: misc.h:128
affine_transform.h
colmap::Bitmap
Definition: bitmap.h:51
X_t
const typedef Image * X_t
Definition: similarity_transform.cc:48
colmap::Image::ProjectionCenter
Eigen::Vector3d ProjectionCenter() const
Definition: image.cc:152
colmap::AffineTransformEstimator
Definition: affine_transform.h:18
colmap::GPSTransform::XYZToEll
std::vector< Eigen::Vector3d > XYZToEll(const std::vector< Eigen::Vector3d > &xyz) const
Definition: gps.cc:82
colmap::RANSACOptions
Definition: ransac.h:22
colmap::InvertQuaternion
Eigen::Vector4d InvertQuaternion(const Eigen::Vector4d &qvec)
Definition: pose.cc:93
colmap::EstimateGravityVectorFromImageOrientation
Eigen::Vector3d EstimateGravityVectorFromImageOrientation(const Reconstruction &reconstruction, const double max_axis_distance)
Definition: coordinate_frame.cc:145
colmap::AffineTransformEstimator::Estimate
static std::vector< M_t > Estimate(const std::vector< X_t > &points1, const std::vector< Y_t > &points2)
Definition: affine_transform.cc:40
testing.h
undistortion.h
colmap::Reconstruction
Definition: reconstruction.h:40
colmap::DegToRad
float DegToRad(const float deg)
Definition: math.h:171
colmap::SimilarityTransform3::TransformPose
void TransformPose(Eigen::Vector4d *qvec, Eigen::Vector3d *tvec) const
Definition: similarity_transform.cc:215
line.h
colmap::ManhattanWorldFrameEstimationOptions::line_orientation_tolerance
double line_orientation_tolerance
Definition: coordinate_frame.h:22
colmap::ManhattanWorldFrameEstimationOptions::min_line_length
double min_line_length
Definition: coordinate_frame.h:20
colmap::EstimateManhattanWorldFrame
Eigen::Matrix3d EstimateManhattanWorldFrame(const ManhattanWorldFrameEstimationOptions &options, const Reconstruction &reconstruction, const std::string &image_path)
Definition: coordinate_frame.cc:156
ecvColor::LookUpTable::at
Rgb at(size_t color_id)
Definition: ecvColorTypes.cpp:77
colmap::Camera::CalibrationMatrix
Eigen::Matrix3d CalibrationMatrix() const
Definition: camera.cc:75
kMinNumSamples
static const int kMinNumSamples
Definition: coordinate_frame.cc:55
gps.h
e
const double * e
Definition: essential_matrix_poly.h:10
misc.h
colmap::Reconstruction::RegImageIds
const std::vector< image_t > & RegImageIds() const
Definition: reconstruction.h:504
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(TestAffineTransform)
Definition: affine_transform_test.cc:39
colmap::ClassifyLineSegmentOrientations
std::vector< LineSegmentOrientation > ClassifyLineSegmentOrientations(const std::vector< LineSegment > &segments, const double tolerance)
Definition: line.cc:79
colmap::SimilarityTransform3::Scale
double Scale() const
Definition: similarity_transform.cc:245
colmap::RANSAC::Estimate
Report Estimate(const std::vector< typename Estimator::X_t > &X, const std::vector< typename Estimator::Y_t > &Y)
Definition: ransac.h:159
Y_t
const typedef Image * Y_t
Definition: similarity_transform.cc:49
colmap::DetectLineSegments
std::vector< LineSegment > DetectLineSegments(const Bitmap &bitmap, const double min_length)
Definition: line.cc:42
reconstruction.h
image
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
colmap::Image
Definition: image.h:29
colmap::Reconstruction::Images
const std::unordered_map< image_t, class Image > & Images() const
Definition: reconstruction.h:500
points
int points
Definition: FileIOFactory.cpp:144
colmap::RANSACOptions::max_error
double max_error
Definition: ransac.h:25
colmap::Reconstruction::NumRegImages
size_t NumRegImages() const
Definition: reconstruction.h:440
colmap::RotationMatrixToQuaternion
Eigen::Vector4d RotationMatrixToQuaternion(const Eigen::Matrix3d &rot_mat)
Definition: pose.cc:70
colmap::ManhattanWorldFrameEstimationOptions::max_image_size
int max_image_size
Definition: coordinate_frame.h:18
colmap::ManhattanWorldFrameEstimationOptions
Definition: coordinate_frame.h:16
colmap::AffineTransformEstimator::Residuals
static void Residuals(const std::vector< X_t > &points1, const std::vector< Y_t > &points2, const M_t &E, std::vector< double > *residuals)
Definition: affine_transform.cc:75
colmap::Bitmap::Read
bool Read(const std::string &path, const bool as_rgb=true)
Definition: bitmap.cc:485
colmap::SimilarityTransform3
Definition: similarity_transform.h:24
colmap::UndistortCameraOptions::max_image_size
int max_image_size
Definition: undistortion.h:28
colmap::Reconstruction::Points3D
const std::unordered_map< point3D_t, class Point3D > & Points3D() const
Definition: reconstruction.h:508
pose.h
logging.h
colmap::RANSAC
Definition: ransac.h:56
colmap::UndistortCameraOptions
Definition: undistortion.h:18
colmap
Definition: AutomaticReconstructionController.h:17
colmap::LineSegmentOrientation::HORIZONTAL
@ HORIZONTAL
colmap::ManhattanWorldFrameEstimationOptions::max_axis_distance
double max_axis_distance
Definition: coordinate_frame.h:26
colmap::Image::Qvec
const Eigen::Vector4d & Qvec() const
Definition: image.h:301
colmap::GPSTransform
Definition: gps.h:20
colmap::StringPrintf
std::string StringPrintf(const char *format,...)
Definition: string.cc:131
Utils::distance
static double distance(T *pot1, T *pot2)
Definition: utils.h:111
utils.h
colmap::QuaternionRotatePoint
Eigen::Vector3d QuaternionRotatePoint(const Eigen::Vector4d &qvec, const Eigen::Vector3d &point)
Definition: pose.cc:110
frame
Rect frame
Definition: BitmapWindowSystem.cpp:31
colmap::Reconstruction::Camera
const class Camera & Camera(const camera_t camera_id) const
Definition: reconstruction.h:450
colmap::Reconstruction::Transform
void Transform(const SimilarityTransform3 &tform)
Definition: reconstruction.cc:455
colmap::Camera
Definition: camera.h:20
ransac.h
colmap::AlignToENUPlane
void AlignToENUPlane(Reconstruction *recon, SimilarityTransform3 *tform, bool unscaled)
Definition: coordinate_frame.cc:333
colmap::Reconstruction::Image
const class Image & Image(const image_t image_id) const
Definition: reconstruction.h:454