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> 50 namespace texture_mapping
77 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
89 typedef std::vector<Camera, Eigen::aligned_allocator<Camera> >
CameraVector;
97 template<
typename Po
intInT>
102 typedef boost::shared_ptr< TextureMapping < PointInT > >
Ptr;
103 typedef boost::shared_ptr< const TextureMapping < PointInT > >
ConstPtr;
118 f_ (), vector_field_ (), tex_files_ (), tex_material_ ()
144 vector_field_ = Eigen::Vector3f (x, y, z);
146 vector_field_ = vector_field_ / std::sqrt (vector_field_.dot (vector_field_));
155 tex_files_ = tex_files;
164 tex_material_ = tex_material;
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;
246 isPointOccluded (
const PointInT &pt,
const OctreePtr octree);
256 removeOccludedPoints (
const PointCloudPtr &input_cloud,
257 PointCloudPtr &filtered_cloud,
const double octree_voxel_size,
258 std::vector<int> &visible_indices, std::vector<int> &occluded_indices);
275 removeOccludedPoints (
const pcl::TextureMesh &tex_mesh, PointCloudPtr &filtered_cloud,
const double octree_voxel_size);
290 const double octree_voxel_size, PointCloud &visible_pts);
303 showOcclusions (
const PointCloudPtr &input_cloud,
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);
388 getPointUVCoordinates (
const PointInT &pt,
const Camera &cam,
pcl::PointXY &UV_coordinates);
400 isFaceProjected (
const Camera &camera,
401 const PointInT &p1,
const PointInT &p2,
const PointInT &p3,
418 return (
"TextureMapping");
422 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
The texture mapping algorithm.
pcl::PointCloud< PointInT > PointCloud
~TextureMapping()
Destructor.
std::vector< Camera, Eigen::aligned_allocator< Camera > > CameraVector
This file defines compatibility wrappers for low level I/O functions.
pcl::texture_mapping::Camera Camera
void setTextureFiles(std::vector< std::string > tex_files)
Set texture files.
PointCloud::ConstPtr PointCloudConstPtr
bool getPointUVCoordinates(const PointInT &pt, const Camera &cam, Eigen::Vector2f &UV_coordinates)
computes UV coordinates of point, observed by one particular camera
A 2D point structure representing Euclidean xy coordinates.
boost::shared_ptr< PointCloud< PointT > > Ptr
pcl::octree::OctreePointCloudSearch< PointInT > Octree
boost::shared_ptr< OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > Ptr
TextureMapping()
Constructor.
Eigen::Vector3f vector_field_
vector field
void setVectorField(float x, float y, float z)
Set vector field.
boost::shared_ptr< const TextureMapping< PointInT > > ConstPtr
boost::shared_ptr< const PointCloud< PointInT > > ConstPtr
Structure to store camera pose and focal length.
Structure that links a uv coordinate to its 3D point and face.
void setF(float f)
Set mesh scale control.
float f_
mesh scale control.
boost::shared_ptr< TextureMapping< PointInT > > Ptr
void setTextureMaterials(TexMaterial tex_material)
Set texture materials.
pcl::texture_mapping::UvIndex UvIndex
std::string getClassName() const
Class get name method.
Octree::ConstPtr OctreeConstPtr
Octree pointcloud search class
PointCloud::Ptr PointCloudPtr
std::vector< std::string > tex_files_
list of texture files
boost::shared_ptr< const OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > ConstPtr
TexMaterial tex_material_
list of texture materials