 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
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::size_t id
Definition: texturing.h:38
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
2D texture coordinates
Definition: ecvAdvancedTypes.h:138
constexpr double M_PI
Pi.
Definition: CVConst.h:19
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
uint32_t image_t
Definition: types.h:61
std::shared_ptr< QImage > image_data
Definition: texturing.h:48
bool IsInside(const TexturePatchCandidate &other) const
Definition: texturing.cc:1066
int min_x
Definition: texturing.h:77
QSharedPointer< ccMaterial > Shared
Shared type.
Definition: ecvMaterial.h:33
constexpr bool operator<(const optional< T > &x, const optional< T > &y)
Definition: Optional.h:625
constexpr Rgb black(0, 0, 0)
MvsTexturing(const Options &options, const Reconstruction &reconstruction, Workspace *workspace, const std::string &image_path)
Definition: texturing.cc:131
CLOUDVIEWER_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:49
normal_z x
Definition: my_point_types.h:165
Type x
Definition: CVGeom.h:137
unsigned i2
Definition: GenericIndexedMesh.h:19
Matrix< double, 3, 4 > Matrix3x4d
Definition: types.h:39
int offset
Definition: FileIOFactory.cpp:135
Triangle described by the indexes of its 3 vertices.
Definition: GenericIndexedMesh.h:16
virtual unsigned size() const override
Returns the number of triangles.
Definition: ecvMesh.cpp:2143
Definition: workspace.h:21
bool ExistsFile(const std::string &path)
Definition: misc.cc:100
std::string image_file
Definition: texturing.h:39
static ccPointCloud * ToPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccPointCloud.
Definition: ecvHObjectCaster.cpp:54
virtual const DepthMap & GetDepthMap(const int image_idx)
Definition: workspace.cc:123
cloudViewer::VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex) override
Returns the indexes of the vertices of a given triangle.
Definition: ecvMesh.cpp:2599
void addTriangleTexCoordIndexes(int i1, int i2, int i3)
Adds a triplet of tex coords indexes for next triangle.
Definition: ecvMesh.cpp:3678
virtual void setName(const QString &name)
Sets object name.
Definition: ecvObject.h:75
std::string JoinPaths(T const &... paths)
Definition: misc.h:128
bool isShifted() const
Returns whether the cloud is shifted or not.
Definition: ecvShiftedObject.h:56
bool reservePerTriangleTexCoordIndexes()
Reserves memory to store per-triangle triplets of tex coords indexes.
Definition: ecvMesh.cpp:3659
void setMaterialSet(ccMaterialSet *materialSet, bool autoReleaseOldMaterialSet=true)
Sets associated material set (may be shared)
Definition: ecvMesh.cpp:492
const CCVector3 * getPoint(unsigned index) const override
Definition: PointCloudTpl.h:143
ccMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMeshFactory.cpp:1388
unsigned size() const override
Definition: PointCloudTpl.h:38
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
Definition: texturing.h:72
Eigen::Matrix3f projection
Definition: texturing.h:42
bool verbose
Definition: texturing.h:94
int min_x
Definition: texturing.cc:1063
int max_y
Definition: texturing.h:77
bool reserve(std::size_t n)
Reserves the memory to store the vertex indexes (3 per triangle)
Definition: ecvMesh.cpp:2475
Eigen::Vector2f GetPixelCoords(const Eigen::Vector3f &vertex) const
Definition: texturing.cc:71
ccGenericPointCloud * getAssociatedCloud() const override
Returns the vertices cloud.
Definition: ecvMesh.h:143
int max_x
Definition: texturing.h:77
Definition: reconstruction.h:40
float max_viewing_angle_deg
Definition: texturing.h:96
std::vector< unsigned int > face
Definition: TriangleMeshIO.cpp:50
float max_depth_error
Definition: texturing.h:95
core::Tensor result
Definition: VtkUtils.cpp:76
int width
Definition: FileIOFactory.cpp:142
int min_y
Definition: texturing.h:77
Eigen::Matrix4f world_to_cam
Definition: texturing.h:43
bool reservePerTriangleMtlIndexes()
Reserves memory to store per-triangle material index.
Definition: ecvMesh.cpp:3734
int height
Definition: FileIOFactory.cpp:143
void addTriangle(unsigned i1, unsigned i2, unsigned i3)
Adds a triangle to the mesh.
Definition: ecvMesh.cpp:2428
virtual const CCVector3d & getGlobalShift() const
Returns the shift applied to original coordinates.
Definition: ecvShiftedObject.h:46
normal_z y
Definition: my_point_types.h:168
Mesh (triangle) material.
Definition: ecvMaterial.h:28
virtual CC_FILE_ERROR saveToFile(ccHObject *entity, const QString &filename, const SaveParameters ¶meters) override
Saves an entity (or a group of) to a file.
Definition: ObjFilter.cpp:59
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
bool alwaysDisplaySaveDialog
Definition: FileIOFilter.h:91
Eigen::Matrix3x4d ProjectionMatrix() const
Definition: image.cc:140
int label
Definition: texturing.h:73
bool ValidPixel(const Eigen::Vector2f &pixel) const
Definition: texturing.cc:100
const image_t kInvalidImageId
Definition: types.h:76
static const std::string path
Definition: PointCloud.cpp:59
const double * e
Definition: essential_matrix_poly.h:10
const std::vector< image_t > & RegImageIds() const
Definition: reconstruction.h:504
Definition: texturing.h:93
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Definition: SmallVector.h:1370
static TexturePatchCandidate GenerateCandidate(int label, TextureView *texture_view, const std::vector< size_t > &faces, const ccMesh &mesh, ccPointCloud *cloud, bool mesh_is_shifted=false)
Definition: texturing.cc:1074
CC_FILE_ERROR
Typical I/O filter errors.
Definition: FileIOFilter.h:20
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)
Definition: texturing.cc:54
unsigned i3
Definition: GenericIndexedMesh.h:19
std::string GetPathBaseName(const std::string &path)
Definition: misc.cc:118
size_t Width() const
Definition: camera.h:160
bool hasNormals() const override
Returns whether normals are enabled or not.
Definition: ecvPointCloud.cpp:1693
void addElement(const Type &value)
Definition: ecvArray.h:105
bool HasDepthMap(const int image_idx) const
Definition: workspace.cc:147
bool use_depth_normal_maps
Definition: texturing.h:98
std::shared_ptr< QImage > image
Definition: texturing.h:76
Array of 2D texture coordinates.
Definition: ecvAdvancedTypes.h:151
MiniVec< float, N > floor(const MiniVec< float, N > &a)
Definition: MiniVec.h:75
Eigen::Matrix< Index, 3, 1 > Vector3i
Definition: knncpp.h:30
a[190]
Definition: essential_matrix_poly.h:19
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
std::vector< size_t > faces
Definition: texturing.h:74
int max_y
Definition: texturing.cc:1063
void setTexCoordinatesTable(TextureCoordsContainer *texCoordsTable, bool autoReleaseOldTable=true)
Sets per-triangle texture coordinates array (may be shared)
Definition: ecvMesh.cpp:3598
bool use_gradient_magnitude
Definition: texturing.h:99
Type z
Definition: CVGeom.h:137
CCVector3d toGlobal3d(const Vector3Tpl< T > &Plocal) const
Returns the point back-projected into the original coordinates system.
Definition: ecvShiftedObject.h:64
Definition: texturing.h:91
void SplitFileExtension(const std::string &path, std::string *root, std::string *ext)
Definition: misc.cc:64
Wavefront meshes file I/O filter.
Definition: ObjFilter.h:13
Definition: texturing.cc:1062
int width
Definition: texturing.h:40
int min_y
Definition: texturing.cc:1063
int addMaterial(ccMaterial::CShared mat, bool allowDuplicateNames=false)
Adds a material.
Definition: ecvMaterialSet.cpp:60
std::vector< Eigen::Vector2f > texcoords
Definition: texturing.h:75
QWidget * parentWidget
Parent widget (if any)
Definition: FileIOFilter.h:93
Generic saving parameters.
Definition: FileIOFilter.h:84
std::string GetParentDir(const std::string &path)
Definition: misc.cc:128
Triangular mesh.
Definition: ecvMesh.h:35
const std::string & Name() const
Definition: image.h:242
virtual double getGlobalScale() const
Returns the scale applied to original coordinates.
Definition: ecvShiftedObject.h:53
Definition: texturing.h:37
Eigen::Vector3f viewdir
Definition: texturing.h:45
Mesh (triangle) material.
Definition: ecvMaterialSet.h:16
Type y
Definition: CVGeom.h:137
Eigen::Vector3f pos
Definition: texturing.h:44
Definition: AutomaticReconstructionController.h:17
Definition: ccGuiPythonInstance.h:15
int GetImageIdx(const std::string &name) const
Definition: model.cc:127
bool TextureMesh(ccMesh &mesh, const ::cloudViewer::camera::PinholeCameraTrajectory &camera_trajectory, const std::string &output_path)
Definition: texturing.cc:236
const Model & GetModel() const
Definition: workspace.h:50
size_t Height() const
Definition: camera.h:162
ccPointCloud * cloneThis(ccPointCloud *destCloud=nullptr, bool ignoreChildren=false)
Clones this entity.
Definition: ecvPointCloud.cpp:564
void addTriangleMtlIndex(int mtlIndex)
Adds triangle material index for next triangle.
Definition: ecvMesh.cpp:3751
std::unique_ptr< TexturePatch > texture_patch
Definition: texturing.cc:1064
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
Definition: ecvHObject.cpp:534
@ CC_FERR_NO_ERROR
Definition: FileIOFilter.h:21
std::string StringPrintf(const char *format,...)
Definition: string.cc:131
virtual void setEnabled(bool state)
Sets the "enabled" property.
Definition: ecvObject.h:102
std::string to_string(const T &n)
Definition: Common.h:20
int max_x
Definition: texturing.cc:1063
bool Inside(const Eigen::Vector3f &v1, const Eigen::Vector3f &v2, const Eigen::Vector3f &v3) const
Definition: texturing.cc:105
static const int max_iterations
Definition: Registration.cpp:29
const class Camera & Camera(const camera_t camera_id) const
Definition: reconstruction.h:450
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
unsigned i1
Definition: GenericIndexedMesh.h:19
const Options & GetOptions() const
Definition: workspace.h:48
RGBA color structure.
Definition: ecvColorTypes.h:145
int height
Definition: texturing.h:41
std::string name
Definition: FileIOFactory.cpp:129
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)
Definition: texturing.cc:114
const class Image & Image(const image_t image_id) const
Definition: reconstruction.h:454