Open3D (C++ API)
TriangleMeshAndImageUtilities.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <memory>
30 #include <vector>
31 
32 #include "Open3D/Utility/Eigen.h"
33 
34 namespace open3d {
35 
36 namespace geometry {
37 class Image;
38 }
39 namespace geometry {
40 class RGBDImage;
41 }
42 namespace geometry {
43 class TriangleMesh;
44 }
45 namespace camera {
46 class PinholeCameraTrajectory;
47 }
48 
49 namespace color_map {
50 
51 class ImageWarpingField;
52 class ColorMapOptimizationOption;
53 
54 inline std::tuple<float, float, float> Project3DPointAndGetUVDepth(
55  const Eigen::Vector3d X,
56  const camera::PinholeCameraTrajectory& camera,
57  int camid);
58 
59 std::tuple<std::vector<std::vector<int>>, std::vector<std::vector<int>>>
61  const geometry::TriangleMesh& mesh,
62  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
63  const std::vector<std::shared_ptr<geometry::Image>>& images_mask,
64  const camera::PinholeCameraTrajectory& camera,
65  double maximum_allowable_depth,
66  double depth_threshold_for_visibility_check);
67 
68 template <typename T>
69 std::tuple<bool, T> QueryImageIntensity(
70  const geometry::Image& img,
71  const Eigen::Vector3d& V,
72  const camera::PinholeCameraTrajectory& camera,
73  int camid,
74  int ch = -1,
75  int image_boundary_margin = 10);
76 
77 template <typename T>
78 std::tuple<bool, T> QueryImageIntensity(
79  const geometry::Image& img,
80  const ImageWarpingField& field,
81  const Eigen::Vector3d& V,
82  const camera::PinholeCameraTrajectory& camera,
83  int camid,
84  int ch = -1,
85  int image_boundary_margin = 10);
86 
88  const geometry::TriangleMesh& mesh,
89  const std::vector<std::shared_ptr<geometry::Image>>& images_gray,
90  const std::vector<ImageWarpingField>& warping_field,
91  const camera::PinholeCameraTrajectory& camera,
92  const std::vector<std::vector<int>>& visibility_vertex_to_image,
93  std::vector<double>& proxy_intensity,
94  int image_boundary_margin);
95 
97  const geometry::TriangleMesh& mesh,
98  const std::vector<std::shared_ptr<geometry::Image>>& images_gray,
99  const camera::PinholeCameraTrajectory& camera,
100  const std::vector<std::vector<int>>& visibility_vertex_to_image,
101  std::vector<double>& proxy_intensity,
102  int image_boundary_margin);
103 
105  geometry::TriangleMesh& mesh,
106  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
107  const camera::PinholeCameraTrajectory& camera,
108  const std::vector<std::vector<int>>& visibility_vertex_to_image,
109  int image_boundary_margin = 10,
110  int invisible_vertex_color_knn = 3);
111 
113  geometry::TriangleMesh& mesh,
114  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
115  const std::vector<ImageWarpingField>& warping_fields,
116  const camera::PinholeCameraTrajectory& camera,
117  const std::vector<std::vector<int>>& visibility_vertex_to_image,
118  int image_boundary_margin = 10,
119  int invisible_vertex_color_knn = 3);
120 } // namespace color_map
121 } // namespace open3d
std::tuple< float, float, float > Project3DPointAndGetUVDepth(const Eigen::Vector3d X, const camera::PinholeCameraTrajectory &camera, int camid)
Definition: TriangleMeshAndImageUtilities.cpp:38
std::tuple< std::vector< std::vector< int > >, std::vector< std::vector< int > > > CreateVertexAndImageVisibility(const geometry::TriangleMesh &mesh, const std::vector< std::shared_ptr< geometry::Image >> &images_depth, const std::vector< std::shared_ptr< geometry::Image >> &images_mask, const camera::PinholeCameraTrajectory &camera, double maximum_allowable_depth, double depth_threshold_for_visibility_check)
Definition: TriangleMeshAndImageUtilities.cpp:55
std::tuple< bool, T > QueryImageIntensity(const geometry::Image &img, const Eigen::Vector3d &V, const camera::PinholeCameraTrajectory &camera, int camid, int ch, int image_boundary_margin)
Definition: TriangleMeshAndImageUtilities.cpp:125
void SetProxyIntensityForVertex(const geometry::TriangleMesh &mesh, const std::vector< std::shared_ptr< geometry::Image >> &images_gray, const std::vector< ImageWarpingField > &warping_field, const camera::PinholeCameraTrajectory &camera, const std::vector< std::vector< int >> &visibility_vertex_to_image, std::vector< double > &proxy_intensity, int image_boundary_margin)
Definition: TriangleMeshAndImageUtilities.cpp:177
Definition: Open3DViewer.h:29
void SetGeometryColorAverage(geometry::TriangleMesh &mesh, const std::vector< std::shared_ptr< geometry::Image >> &images_color, const camera::PinholeCameraTrajectory &camera, const std::vector< std::vector< int >> &visibility_vertex_to_image, int image_boundary_margin, int invisible_vertex_color_knn)
Definition: TriangleMeshAndImageUtilities.cpp:248