render_views_tesselated_sphere.h
Go to the documentation of this file.
00001 /*
00002  * render_views_tesselated_sphere.h
00003  *
00004  *  Created on: Dec 23, 2011
00005  *      Author: aitor
00006  */
00007 
00008 #ifndef RENDER_VIEWS_TESSELATED_SPHERE_H_
00009 #define RENDER_VIEWS_TESSELATED_SPHERE_H_
00010 
00011 #include <vtkSmartPointer.h>
00012 #include <vtkPolyData.h>
00013 #include <pcl/common/common.h>
00014 
00015 namespace pcl
00016 {
00017   namespace apps
00018   {
00026     class PCL_EXPORTS RenderViewsTesselatedSphere
00027     {
00028     private:
00029       std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > poses_;
00030       std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> generated_views_;
00031       std::vector<float> entropies_;
00032       int resolution_;
00033       int tesselation_level_;
00034       bool use_vertices_;
00035       float view_angle_;
00036       float radius_sphere_;
00037       bool compute_entropy_;
00038       vtkSmartPointer<vtkPolyData> polydata_;
00039 
00040     public:
00041       RenderViewsTesselatedSphere ()
00042       {
00043         resolution_ = 150;
00044         tesselation_level_ = 1;
00045         use_vertices_ = false;
00046         view_angle_ = 57;
00047         radius_sphere_ = 1.f;
00048         compute_entropy_ = false;
00049       }
00050 
00051       /* \brief Sets the size of the render window
00052        * \param res resolution size
00053        */
00054       void
00055       setResolution (int res)
00056       {
00057         resolution_ = res;
00058       }
00059 
00060       /* \brief Wether to use the vertices or triangle centers of the tesselated sphere
00061        * \param use true indicates to use vertices, false triangle centers
00062        */
00063 
00064       void
00065       setUseVertices (bool use)
00066       {
00067         use_vertices_ = use;
00068       }
00069 
00070       /* \brief Radius of the sphere where the virtual camera will be placed
00071        * \param use true indicates to use vertices, false triangle centers
00072        */
00073       void
00074       setRadiusSphere (float radius)
00075       {
00076         radius_sphere_ = radius;
00077       }
00078 
00079       /* \brief Wether to compute the entropies (level of occlusions for each view)
00080        * \param compute true to compute entropies, false otherwise
00081        */
00082       void
00083       setComputeEntropies (bool compute)
00084       {
00085         compute_entropy_ = compute;
00086       }
00087 
00088       /* \brief How many times the icosahedron should be tesselated. Results in more or less camera positions and generated views.
00089        * \param level amount of tesselation
00090        */
00091       void
00092       setTesselationLevel (int level)
00093       {
00094         tesselation_level_ = level;
00095       }
00096 
00097       /* \brief Sets the view angle of the virtual camera
00098        * \param angle view angle in degrees
00099        */
00100       void
00101       setViewAngle (float angle)
00102       {
00103         view_angle_ = angle;
00104       }
00105 
00106       /* \brief adds the mesh to be used as a vtkPolyData
00107        * \param polydata vtkPolyData object
00108        */
00109       void
00110       addModelFromPolyData (vtkSmartPointer<vtkPolyData> polydata)
00111       {
00112         polydata_ = polydata;
00113       }
00114 
00115       /* \brief performs the rendering and stores the generated information
00116        */
00117       void
00118       generateViews ();
00119 
00120       /* \brief Get the generated poses for the generated views
00121        * \param poses 4x4 matrices representing the pose of the cloud relative to the model coordinate system
00122        */
00123       void
00124       getPoses (std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > & poses)
00125       {
00126         poses = poses_;
00127       }
00128 
00129       /* \brief Get the generated views
00130        * \param views generated pointclouds in camera coordinates
00131        */
00132       void
00133       getViews (std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> & views)
00134       {
00135         views = generated_views_;
00136       }
00137 
00138       /* \brief Get the entropies (level of occlusions) for the views
00139        * \param entropies level of occlusions
00140        */
00141       void
00142       getEntropies (std::vector<float> & entropies)
00143       {
00144         entropies = entropies_;
00145       }
00146     };
00147 
00148   }
00149 }
00150 
00151 #endif /* RENDER_VIEWS_TESSELATED_SPHERE_H_ */


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:39