Open3D (C++ API)  0.11.0
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 
33 #include "open3d/geometry/Image.h"
36 #include "open3d/utility/Eigen.h"
37 
38 namespace open3d {
39 namespace pipelines {
40 namespace color_map {
41 
42 class ImageWarpingField;
43 class ColorMapOptimizationOption;
44 
45 inline std::tuple<float, float, float> Project3DPointAndGetUVDepth(
46  const Eigen::Vector3d X,
47  const camera::PinholeCameraTrajectory& camera,
48  int camid);
49 
50 std::tuple<std::vector<std::vector<int>>, std::vector<std::vector<int>>>
52  const geometry::TriangleMesh& mesh,
53  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
54  const std::vector<std::shared_ptr<geometry::Image>>& images_mask,
55  const camera::PinholeCameraTrajectory& camera,
56  double maximum_allowable_depth,
57  double depth_threshold_for_visibility_check);
58 
59 template <typename T>
60 std::tuple<bool, T> QueryImageIntensity(
61  const geometry::Image& img,
62  const Eigen::Vector3d& V,
63  const camera::PinholeCameraTrajectory& camera,
64  int camid,
65  int ch = -1,
66  int image_boundary_margin = 10);
67 
68 template <typename T>
69 std::tuple<bool, T> QueryImageIntensity(
70  const geometry::Image& img,
71  const ImageWarpingField& field,
72  const Eigen::Vector3d& V,
73  const camera::PinholeCameraTrajectory& camera,
74  int camid,
75  int ch = -1,
76  int image_boundary_margin = 10);
77 
79  const geometry::TriangleMesh& mesh,
80  const std::vector<std::shared_ptr<geometry::Image>>& images_gray,
81  const std::vector<ImageWarpingField>& warping_field,
82  const camera::PinholeCameraTrajectory& camera,
83  const std::vector<std::vector<int>>& visibility_vertex_to_image,
84  std::vector<double>& proxy_intensity,
85  int image_boundary_margin);
86 
88  const geometry::TriangleMesh& mesh,
89  const std::vector<std::shared_ptr<geometry::Image>>& images_gray,
90  const camera::PinholeCameraTrajectory& camera,
91  const std::vector<std::vector<int>>& visibility_vertex_to_image,
92  std::vector<double>& proxy_intensity,
93  int image_boundary_margin);
94 
96  geometry::TriangleMesh& mesh,
97  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
98  const camera::PinholeCameraTrajectory& camera,
99  const std::vector<std::vector<int>>& visibility_vertex_to_image,
100  int image_boundary_margin = 10,
101  int invisible_vertex_color_knn = 3);
102 
104  geometry::TriangleMesh& mesh,
105  const std::vector<std::shared_ptr<geometry::Image>>& images_rgbd,
106  const std::vector<ImageWarpingField>& warping_fields,
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 
112 } // namespace color_map
113 } // namespace pipelines
114 } // namespace open3d
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:175
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:57
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:123
std::tuple< float, float, float > Project3DPointAndGetUVDepth(const Eigen::Vector3d X, const camera::PinholeCameraTrajectory &camera, int camid)
Definition: TriangleMeshAndImageUtilities.cpp:40
Definition: PinholeCameraIntrinsic.cpp:35
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:242