Point Cloud Library (PCL)
1.10.0
|
43 #include <pcl/surface/reconstruction.h>
44 #include <pcl/common/transforms.h>
45 #include <pcl/TextureMesh.h>
50 namespace texture_mapping
89 using CameraVector = std::vector<Camera, Eigen::aligned_allocator<Camera> >;
97 template<
typename Po
intInT>
202 double sizeX = cam.
width;
203 double sizeY = cam.
height;
214 double focal_x, focal_y;
225 UV_coordinates[0] =
static_cast<float> ((focal_x * (pt.x / pt.z) + cx) / sizeX);
226 UV_coordinates[1] = 1.0f -
static_cast<float> (((focal_y * (pt.y / pt.z) + cy) / sizeY));
229 if (UV_coordinates[0] >= 0.0 && UV_coordinates[0] <= 1.0 && UV_coordinates[1] >= 0.0 && UV_coordinates[1]
235 UV_coordinates[0] = -1.0;
236 UV_coordinates[1] = -1.0;
257 PointCloudPtr &filtered_cloud,
const double octree_voxel_size,
258 std::vector<int> &visible_indices, std::vector<int> &occluded_indices);
290 const double octree_voxel_size,
PointCloud &visible_pts);
305 const double octree_voxel_size,
306 const bool show_nb_occlusions =
true,
307 const int max_occlusions = 4);
322 double octree_voxel_size,
323 bool show_nb_occlusions =
true,
324 int max_occlusions = 4);
354 std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> >
355 mapTexture2Face (
const Eigen::Vector3f &p1,
const Eigen::Vector3f &p2,
const Eigen::Vector3f &p3);
401 const PointInT &p1,
const PointInT &p2,
const PointInT &p3,
418 return (
"TextureMapping");
bool checkPointInsideTriangle(const pcl::PointXY &p1, const pcl::PointXY &p2, const pcl::PointXY &p3, const pcl::PointXY &pt)
Returns True if a point lays within a triangle.
TexMaterial tex_material_
list of texture materials
Defines all the PCL and non-PCL macros used.
This file defines compatibility wrappers for low level I/O functions.
void getTriangleCircumcscribedCircleCentroid(const pcl::PointXY &p1, const pcl::PointXY &p2, const pcl::PointXY &p3, pcl::PointXY &circumcenter, double &radius)
Returns the centroid of a triangle and the corresponding circumscribed circle's radius.
Structure that links a uv coordinate to its 3D point and face.
void mapTexture2MeshUV(pcl::TextureMesh &tex_mesh)
Map texture to a mesh UV mapping.
void textureMeshwithMultipleCameras(pcl::TextureMesh &mesh, const pcl::texture_mapping::CameraVector &cameras)
Segment and texture faces by camera visibility.
void setTextureFiles(std::vector< std::string > tex_files)
Set texture files.
bool isFaceProjected(const Camera &camera, const PointInT &p1, const PointInT &p2, const PointInT &p3, pcl::PointXY &proj1, pcl::PointXY &proj2, pcl::PointXY &proj3)
Returns true if all the vertices of one face are projected on the camera's image plane.
bool isPointOccluded(const PointInT &pt, const OctreePtr octree)
Check if a point is occluded using raycasting on octree.
Eigen::Vector3f vector_field_
vector field
Structure to store camera pose and focal length.
typename Octree::Ptr OctreePtr
The texture mapping algorithm.
bool getPointUVCoordinates(const PointInT &pt, const Camera &cam, Eigen::Vector2f &UV_coordinates)
computes UV coordinates of point, observed by one particular camera
void removeOccludedPoints(const PointCloudPtr &input_cloud, PointCloudPtr &filtered_cloud, const double octree_voxel_size, std::vector< int > &visible_indices, std::vector< int > &occluded_indices)
Remove occluded points from a point cloud.
typename Octree::ConstPtr OctreeConstPtr
std::vector< Camera, Eigen::aligned_allocator< Camera > > CameraVector
void setTextureMaterials(TexMaterial tex_material)
Set texture materials.
void mapTexture2Mesh(pcl::TextureMesh &tex_mesh)
Map texture to a mesh synthesis algorithm.
shared_ptr< OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > Ptr
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
TextureMapping()
Constructor.
std::string getClassName() const
Class get name method.
A 2D point structure representing Euclidean xy coordinates.
void setVectorField(float x, float y, float z)
Set vector field.
std::vector< Eigen::Vector2f, Eigen::aligned_allocator< Eigen::Vector2f > > mapTexture2Face(const Eigen::Vector3f &p1, const Eigen::Vector3f &p2, const Eigen::Vector3f &p3)
Map texture to a face.
shared_ptr< PointCloud< PointInT > > Ptr
typename PointCloud::ConstPtr PointCloudConstPtr
void showOcclusions(const PointCloudPtr &input_cloud, pcl::PointCloud< pcl::PointXYZI >::Ptr &colored_cloud, const double octree_voxel_size, const bool show_nb_occlusions=true, const int max_occlusions=4)
Colors a point cloud, depending on its occlusions.
void setF(float f)
Set mesh scale control.
shared_ptr< const PointCloud< PointInT > > ConstPtr
float f_
mesh scale control.
void mapMultipleTexturesToMeshUV(pcl::TextureMesh &tex_mesh, pcl::texture_mapping::CameraVector &cams)
Map textures acquired from a set of cameras onto a mesh.
shared_ptr< const TextureMapping< PointInT > > ConstPtr
void getTriangleCircumcenterAndSize(const pcl::PointXY &p1, const pcl::PointXY &p2, const pcl::PointXY &p3, pcl::PointXY &circumcenter, double &radius)
Returns the circumcenter of a triangle and the circle's radius.
typename PointCloud::Ptr PointCloudPtr
Octree pointcloud search class
std::vector< std::string > tex_files_
list of texture files
shared_ptr< TextureMapping< PointInT > > Ptr
~TextureMapping()
Destructor.
shared_ptr< const OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > ConstPtr
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.
int sortFacesByCamera(pcl::TextureMesh &tex_mesh, pcl::TextureMesh &sorted_mesh, const pcl::texture_mapping::CameraVector &cameras, const double octree_voxel_size, PointCloud &visible_pts)
Segment faces by camera visibility.