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
Eigen::Matrix3d EstimateManhattanWorldFrame(const ManhattanWorldFrameEstimationOptions &options, const Reconstruction &reconstruction, const std::string &image_path)
Eigen::Vector3d EstimateGravityVectorFromImageOrientation(const Reconstruction &reconstruction, const double max_axis_distance)
void AlignToENUPlane(Reconstruction *recon, SimilarityTransform3 *tform, bool unscaled)
void AlignToPrincipalPlane(Reconstruction *recon, SimilarityTransform3 *tform)