24 class PinholeCameraTrajectory;
54 const Eigen::Vector3f&
pos,
60 Eigen::Vector2f
GetPixelCoords(
const Eigen::Vector3f& vertex)
const;
63 bool ValidPixel(
const Eigen::Vector2f& pixel)
const;
66 bool Inside(
const Eigen::Vector3f& v1,
67 const Eigen::Vector3f& v2,
68 const Eigen::Vector3f& v3)
const;
80 const std::vector<size_t>&
faces,
81 const std::vector<Eigen::Vector2f>&
texcoords,
82 std::shared_ptr<QImage>
image,
105 const std::string& image_path);
110 const ::cloudViewer::camera::PinholeCameraTrajectory&
112 const std::string& output_path);
116 void CreateTextureViews(
117 const ::cloudViewer::camera::PinholeCameraTrajectory&
121 void CalculateDataCosts(
const ccMesh& mesh);
127 void GenerateTexturePatches(
const ccMesh& mesh);
130 void SeamLeveling(
const ccMesh& mesh);
133 void GenerateTextureAtlases();
136 bool SaveOBJModel(
const std::string& output_path,
const ccMesh& mesh);
139 int GetWorkspaceImageIdx(
const image_t image_id)
const;
140 bool IsPointVisible(
const Eigen::Vector3d& point3d,
143 int workspace_image_idx)
const;
146 QImage ComputeGradientMagnitudeImage(
const QImage&
image);
147 float CalculateGMIQuality(
size_t view_id,
148 const Eigen::Vector2f& p1,
149 const Eigen::Vector2f& p2,
150 const Eigen::Vector2f& p3);
151 bool IsPointInTriangle(
float px,
153 const Eigen::Vector2f& p1,
154 const Eigen::Vector2f& p2,
155 const Eigen::Vector2f& p3)
const;
160 const std::string image_path_;
162 std::vector<std::unique_ptr<TextureView>> texture_views_;
163 std::vector<std::unique_ptr<TexturePatch>> texture_patches_;
166 struct TextureAtlas {
169 std::shared_ptr<QImage>
image;
170 std::vector<size_t> face_ids;
171 std::vector<Eigen::Vector2f> texcoords;
172 std::vector<size_t> texcoord_ids;
174 std::vector<TextureAtlas> texture_atlases_;
177 std::vector<image_t> view_to_image_id_;
180 mutable std::vector<QImage> gradient_magnitude_images_;
183 void BuildAdjacencyGraph(
const ccMesh& mesh);
184 float ComputePairwiseCost(
size_t face1,
190 struct FaceProjectionInfo {
193 Eigen::Vector3f mean_color;
195 std::vector<std::vector<FaceProjectionInfo>> face_projection_infos_;
196 std::vector<size_t> face_labels_;
199 struct VertexProjectionInfo {
200 size_t texture_patch_id;
201 Eigen::Vector2f projection;
202 std::vector<size_t> faces;
204 bool operator<(
const VertexProjectionInfo& other)
const {
205 return texture_patch_id < other.texture_patch_id;
208 std::vector<std::vector<VertexProjectionInfo>> vertex_projection_infos_;
211 std::vector<std::vector<size_t>> face_adjacency_;
214 std::vector<std::vector<std::pair<size_t, float>>> data_costs_;
221 std::vector<SeamEdge> seam_edges_;
224 void GetSubgraphs(
size_t label,
225 std::vector<std::vector<size_t>>* subgraphs)
const;
226 void MergeVertexProjectionInfos();
std::shared_ptr< core::Tensor > image
MvsTexturing(const Options &options, const Reconstruction &reconstruction, Workspace *workspace, const std::string &image_path)
bool TextureMesh(ccMesh &mesh, const ::cloudViewer::camera::PinholeCameraTrajectory &camera_trajectory, const std::string &output_path)
constexpr bool operator<(const optional< T > &x, const optional< T > &y)
Generic file read and write utility for python interface.
bool use_depth_normal_maps
bool use_gradient_magnitude
float max_viewing_angle_deg
std::vector< Eigen::Vector2f > texcoords
std::shared_ptr< QImage > image
std::vector< size_t > faces
TexturePatch(int label, const std::vector< size_t > &faces, const std::vector< Eigen::Vector2f > &texcoords, std::shared_ptr< QImage > image, int min_x, int min_y, int max_x, int max_y)
Eigen::Matrix4f world_to_cam
bool ValidPixel(const Eigen::Vector2f &pixel) const
bool Inside(const Eigen::Vector3f &v1, const Eigen::Vector3f &v2, const Eigen::Vector3f &v3) const
TextureView(std::size_t id, const std::string &image_file, const Eigen::Matrix3f &projection, const Eigen::Matrix4f &world_to_cam, const Eigen::Vector3f &pos, const Eigen::Vector3f &viewdir, int width, int height)
Eigen::Vector2f GetPixelCoords(const Eigen::Vector3f &vertex) const
Eigen::Matrix3f projection
std::shared_ptr< QImage > image_data