Go to the documentation of this file.
40 #ifndef PCL_SURFACE_TEXTURE_MAPPING_H_
41 #define PCL_SURFACE_TEXTURE_MAPPING_H_
43 #include <pcl/surface/reconstruction.h>
44 #include <pcl/common/transforms.h>
45 #include <pcl/TextureMesh.h>
46 #include <pcl/octree/octree.h>
55 namespace texture_mapping
81 std::vector<double>
roi;
96 typedef std::vector<Camera, Eigen::aligned_allocator<Camera> >
CameraVector;
104 template<
typename Po
intInT>
116 typedef pcl::octree::OctreePointCloudSearch<PointInT>
Octree;
233 double sizeX =
cam.width;
234 double sizeY =
cam.height;
236 if (
cam.center_w > 0)
240 if (
cam.center_h > 0)
245 double focal_x, focal_y;
246 if (
cam.focal_length_w > 0)
247 focal_x =
cam.focal_length_w;
249 focal_x =
cam.focal_length;
250 if (
cam.focal_length_h>0)
251 focal_y =
cam.focal_length_h;
253 focal_y =
cam.focal_length;
256 UV_coordinates[0] =
static_cast<float> ((focal_x * (pt.x / pt.z) +
cx) / sizeX);
257 UV_coordinates[1] = 1.0f -
static_cast<float> (((focal_y * (pt.y / pt.z) +
cy) / sizeY));
260 if (UV_coordinates[0] >= 0.0 && UV_coordinates[0] <= 1.0 && UV_coordinates[1] >= 0.0 && UV_coordinates[1]
266 UV_coordinates[0] = -1.0;
267 UV_coordinates[1] = -1.0;
288 PointCloudPtr &filtered_cloud,
const double octree_voxel_size,
289 std::vector<int> &visible_indices, std::vector<int> &occluded_indices);
297 removeOccludedPoints (
const pcl::TextureMesh &tex_mesh, pcl::TextureMesh &cleaned_mesh,
const double octree_voxel_size);
319 pcl::TextureMesh &sorted_mesh,
321 const double octree_voxel_size,
PointCloud &visible_pts);
335 pcl::PointCloud<pcl::PointXYZI>::Ptr &colored_cloud,
336 const double octree_voxel_size,
337 const bool show_nb_occlusions =
true,
338 const int max_occlusions = 4);
352 pcl::PointCloud<pcl::PointXYZI>::Ptr &colored_cloud,
353 double octree_voxel_size,
354 bool show_nb_occlusions =
true,
355 int max_occlusions = 4);
370 std::vector<std::map<int, pcl::PointXY> > * vertexToPixels = 0,
371 bool distanceToCamPolicy =
false);
403 std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> >
404 mapTexture2Face (
const Eigen::Vector3f &p1,
const Eigen::Vector3f &p2,
const Eigen::Vector3f &p3);
415 getTriangleCircumcenterAndSize (
const pcl::PointXY &p1,
const pcl::PointXY &p2,
const pcl::PointXY &p3, pcl::PointXY &circumcenter,
double &radius);
450 const PointInT &p1,
const PointInT &p2,
const PointInT &p3,
451 pcl::PointXY &proj1, pcl::PointXY &proj2, pcl::PointXY &proj3);
461 checkPointInsideTriangle (
const pcl::PointXY &p1,
const pcl::PointXY &p2,
const pcl::PointXY &p3,
const pcl::PointXY &pt);
467 return (
"TextureMapping");
void setTextureFiles(std::vector< std::string > tex_files)
Set texture files.
bool isPointOccluded(const PointInT &pt, const OctreePtr octree)
Check if a point is occluded using raycasting on octree.
void setMaxDepthError(float maxDepthError)
void mapTexture2Mesh(pcl::TextureMesh &tex_mesh)
Map texture to a mesh synthesis algorithm.
void setMaxDistance(float maxDistance)
std::vector< std::string > tex_files_
list of texture files
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.
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.
pcl::octree::OctreePointCloudSearch< PointInT > Octree
const float maxDepthError
rtabmap::SensorCaptureThread * cam
int min_cluster_size_
Remove texture from small polygon clusters.
std::vector< double > roi
The texture mapping algorithm.
pcl::PointCloud< PointInT > PointCloud
float f_
mesh scale control.
PointCloud::ConstPtr PointCloudConstPtr
void mapTexture2MeshUV(pcl::TextureMesh &tex_mesh)
Map texture to a mesh UV mapping.
void setTextureMaterials(TexMaterial tex_material)
Set texture materials.
Some conversion functions.
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
pcl::texture_mapping::UvIndex UvIndex
boost::shared_ptr< TextureMapping< PointInT > > Ptr
boost::shared_ptr< const TextureMapping< PointInT > > ConstPtr
Eigen::Vector3f vector_field_
vector field
void setVectorField(float x, float y, float z)
Set vector field.
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW
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 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
Octree::ConstPtr OctreeConstPtr
bool textureMeshwithMultipleCameras2(pcl::TextureMesh &mesh, const pcl::texture_mapping::CameraVector &cameras, const rtabmap::ProgressState *callback=0, std::vector< std::map< int, pcl::PointXY > > *vertexToPixels=0, bool distanceToCamPolicy=false)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
PointCloud::Ptr PointCloudPtr
ULogger class and convenient macros.
float max_distance_
maximum distance between camera and polygon to apply a texture
Structure that links a uv coordinate to its 3D point and face.
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.
std::string getClassName() const
Class get name method.
void setMinClusterSize(int size)
float max_depth_error_
maximum depth error between projected point and corresponding depth of the camera to apply a texture
Structure to store camera pose and focal length.
void mapMultipleTexturesToMeshUV(pcl::TextureMesh &tex_mesh, pcl::texture_mapping::CameraVector &cams)
Map textures acquired from a set of cameras onto a mesh.
Wrappers of STL for convenient functions.
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.
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.
TextureMapping()
Constructor.
void textureMeshwithMultipleCameras(pcl::TextureMesh &mesh, const pcl::texture_mapping::CameraVector &cameras)
Segment and texture faces by camera visibility. Face-based segmentation.
void setMaxAngle(float maxAngle)
std::vector< Camera, Eigen::aligned_allocator< Camera > > CameraVector
pcl::texture_mapping::Camera Camera
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. Point-based segmentation.
float max_angle_
maximum angle (rad) between camera and polygon to apply a texture
bool getPointUVCoordinates(const PointInT &pt, const Camera &cam, Eigen::Vector2f &UV_coordinates)
computes UV coordinates of point, observed by one particular camera
~TextureMapping()
Destructor.
void setF(float f)
Set mesh scale control.
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:22