polygon_primitive_with_texture.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
36 #ifndef _polygon_primitive_with_texture_H_
37 #define _polygon_primitive_with_texture_H_
38 
39 #ifndef PFLN
40 #define PFLN {printf("DEBUG PRINT FILE %s LINE %d\n",__FILE__,__LINE__);}
41 #endif
42 //####################################################################
45 
46 #include "polygon_primitive.h"
47 #include "camera_projection.h"
49 #include "textured_triangle.h"
50 #include <colormap/colormap.h>
51 #include <pthread.h>
52 
53 
55 {
56  // ------------------------------------------------------------------------------
57  //PUBLIC SECTION OF THE CLASS
58  // ------------------------------------------------------------------------------
59  public:
60 
62  {
63  id_visited_faces=0; ns_visited_faces = "visited_faces";
64  id_vertices_indices=0; ns_vertices_indices = "vertices_indices";
65  id_edge0=0; ns_edge0 = "edge0";
66  id_edge1=0; ns_edge1 = "edge1";
67  id_edge2=0; ns_edge2 = "edge2";
68  id_next_triangle=0; ns_next_triangle = "next_triangle";
69  id_proveniences=0; ns_proveniences = "proveniences";
70  id_constraints=0; ns_constraints = "constraints";
71  id_local_mesh=0; ns_local_mesh = "local_mesh";
72  id_camera_canvas=0; ns_camera_canvas = "camera_canvas";
73  id_camera_position=0; ns_camera_position = "camera_position";
74  id_projection_name=0; ns_projection_name = "projection_name";
75  id_camera_intersection=0; ns_camera_intersection="camera_intersection";
76  id_camera_intersection_vertices=0; ns_camera_intersection_vertices="camera_intersection_vertices";
77  id_textured_triangles=0; ns_textured_triangles="textured_triangles";
78  id_triangle_edges=0; ns_triangle_edges="triangle_edges";
79  id_triangle_vertices=0; ns_triangle_vertices="triangle_vertices";
80  id_projection_union=0; ns_projection_union="projection_union";
81  id_projection_union_vertices=0; ns_projection_union_vertices="projection_union_vertices";
82  std::string str="hot";
83  colormap = (class_colormap*) new class_colormap(str,8, 1, false);
84  mutex = PTHREAD_MUTEX_INITIALIZER;
85  };
86 
87 
88  int compute_mean_and_std(std::vector<float>* v, float* mean, float* std);
89 
90  size_t ask_for_number(void);
91  int publish_to_rviz(ros::Publisher* p_marker_pub);
92  int build_global_texture_set(ros::Publisher* p_marker_pub);
93  int build_global_mesh(ros::Publisher* p_marker_pub);
94  int compute_projection_union(void);
95  int readapt_to_new_plane(polygon_primitive_msg::polygon_primitive* new_plg);
96  int erase_old_markers(visualization_msgs::MarkerArray* marker_vec, unsigned int from, unsigned int to, std::string namesp);
97 
98  int add_camera_projection_to_triangle_mesh(int projection_index, ros::Publisher* p_marker_pub);
99 
100  int add_camera_projection_known_camera(cv::Mat* m, ros::Time t, tf::StampedTransform tf, std::string cam_name, std::string projection_name, cv::Scalar color);
101  int add_camera_projection(cv::Mat* m, ros::Time t, double fx, double fy, double cx, double cy, tf::StampedTransform tf, double k1, double k2, double p1, double p2, double k3, double sd_cx, double sd_cy, double param, double scale, std::string projection_name, cv::Scalar color);
102 
103  int create_textures_vizualization_msg(visualization_msgs::MarkerArray* marker_vec, bool reset_id=false);
104  int get_mesh_statistics(void);
105 
107 
108  //a vector of camera projections. Can be many shots of one camera across time or multiple cameras
109  std::vector<class_camera_projection> cp;
110 
111  pcl::PointCloud<pcl::PointXYZ> next_triangle;
113  class_colormap* colormap;
114  pthread_mutex_t mutex;
115  pthread_t thread;
116 
117 
118 
119  // ------------------------------------------------------------------------------
120  //PRIVATE SECTION OF THE CLASS
121  // ------------------------------------------------------------------------------
122  private:
123 
124  //RVIZ stuff
125  unsigned int id_visited_faces;
126  std::string ns_visited_faces;
127  unsigned int id_vertices_indices;
128  std::string ns_vertices_indices;
129  unsigned int id_edge0;
130  std::string ns_edge0;
131  unsigned int id_edge1;
132  std::string ns_edge1;
133  unsigned int id_edge2;
134  std::string ns_edge2;
135  unsigned int id_next_triangle;
136  std::string ns_next_triangle;
137  unsigned int id_proveniences;
138  std::string ns_proveniences;
139  unsigned int id_constraints;
140  std::string ns_constraints;
141  unsigned int id_local_mesh;
142  std::string ns_local_mesh;
143  unsigned int id_camera_canvas;
144  std::string ns_camera_canvas;
145  unsigned int id_camera_position;
146  std::string ns_camera_position;
147  unsigned int id_projection_name;
148  std::string ns_projection_name;
153  unsigned int id_textured_triangles;
155  unsigned int id_triangle_edges;
156  std::string ns_triangle_edges;
157  unsigned int id_triangle_vertices;
158  std::string ns_triangle_vertices;
159  unsigned int id_projection_union;
160  std::string ns_projection_union;
163 
164  unsigned int id_start;
165 
166 };
167 
168 
169 
170 #endif
171 
int readapt_to_new_plane(polygon_primitive_msg::polygon_primitive *new_plg)
int add_camera_projection_known_camera(cv::Mat *m, ros::Time t, tf::StampedTransform tf, std::string cam_name, std::string projection_name, cv::Scalar color)
int build_global_texture_set(ros::Publisher *p_marker_pub)
int publish_to_rviz(ros::Publisher *p_marker_pub)
pcl::PointCloud< pcl::PointXYZ > next_triangle
std::vector< class_camera_projection > cp
The polygon_primitive class. Defines methods for polygon extraction and expansion from a point cloud...
int add_camera_projection_to_triangle_mesh(int projection_index, ros::Publisher *p_marker_pub)
int compute_mean_and_std(std::vector< float > *v, float *mean, float *std)
Header for constrained delaunay triangulation.
int erase_old_markers(visualization_msgs::MarkerArray *marker_vec, unsigned int from, unsigned int to, std::string namesp)
int create_textures_vizualization_msg(visualization_msgs::MarkerArray *marker_vec, bool reset_id=false)
class_constrained_delaunay_triangulation dp
header for textured triangle
A class c_polygon_primitive that contains information about a detected polygon primitive as well as t...
The class camera_projection performs the projection of an image into a polygon plane.
int build_global_mesh(ros::Publisher *p_marker_pub)
int add_camera_projection(cv::Mat *m, ros::Time t, double fx, double fy, double cx, double cy, tf::StampedTransform tf, double k1, double k2, double p1, double p2, double k3, double sd_cx, double sd_cy, double param, double scale, std::string projection_name, cv::Scalar color)


polygon_primitives_extraction
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:32:42