ed
gui_plugin.cpp
Go to the documentation of this file.
1 #include "gui_plugin.h"
2 
3 #include <ed/entity.h>
4 #include <ed/measurement.h>
5 #include <ed/world_model.h>
6 
7 #include <rgbd/Image.h>
8 #include <rgbd/View.h>
9 
10 #include <ros/node_handle.h>
11 #include <ros/advertise_service_options.h>
12 
13 #include <geolib/Shape.h>
14 
15 #include <opencv2/highgui/highgui.hpp>
16 
17 #include <map>
18 #include <vector>
19 
20 // ----------------------------------------------------------------------------------------------------
21 
23 {
24 
25 public:
26 
27  ColorRenderResult(cv::Mat& image, cv::Mat& z_buffer, const cv::Vec3b& color, float min_depth, float max_depth)
28  : geo::RenderResult(image.rows, image.rows), image_(image), z_buffer_(z_buffer), color_(color),
29  min_depth_(min_depth), max_depth_(max_depth)
30  {
31  }
32 
33  void renderPixel(int x, int y, float depth, int /*i_triangle*/)
34  {
35  float old_depth = z_buffer_.at<float>(y, x);
36  if (old_depth == 0 || depth < old_depth)
37  {
38  float f = (depth - min_depth_) / (max_depth_ - min_depth_);
39 
40  f = 1.0 - std::min(1.0f, std::max(0.0f, f));
41 
42  z_buffer_.at<float>(y, x) = depth;
43  image_.at<cv::Vec3b>(y, x) = f * color_;
44  }
45  }
46 
47 protected:
48 
49  cv::Mat image_;
50  cv::Mat z_buffer_;
51  cv::Vec3b color_;
53 
54 
55 };
56 
57 // ----------------------------------------------------------------------------------------------------
58 
59 bool inPolygon(const std::vector<cv::Point2i>& points_list, const cv::Point2i& point)
60 {
61  int nvert = points_list.size();
62  float vertx[nvert];
63  float verty[nvert];
64  float testx = point.x;
65  float testy = point.y;
66 
67  unsigned int ii = 0;
68  for(; ii < points_list.size(); ++ii){
69  vertx[ii] = points_list[ii].x;
70  verty[ii] = points_list[ii].y;
71  }
72 
73  int i, j, c = 0;
74  for (i = 0, j = nvert-1; i < nvert; j = i++) {
75  if ( ((verty[i]>testy) != (verty[j]>testy)) &&
76  (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
77  c = !c;
78  }
79  return c > 0;
80 }
81 
82 // ----------------------------------------------------------------------------------------------------
83 
84 int REDS[] = { 255, 0 , 255, 0, 255, 0 , 255};
85 int GREENS[] = { 255, 255, 0 , 0, 255, 255, 0 };
86 int BLUES[] = { 255, 255, 255, 255, 0, 0, 0 };
87 
88 // ----------------------------------------------------------------------------------------------------
89 
90 int hash(const char *str, int max_val)
91 {
92  unsigned long hash = 5381;
93  int c;
94 
95  while ((c = *str++))
96  hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
97 
98  return hash % max_val;
99 }
100 
101 // ----------------------------------------------------------------------------------------------------
102 
103 cv::Scalar idToColor(const ed::UUID& id)
104 {
105  int i = hash(id.c_str(), 7);
106  return cv::Scalar(BLUES[i], GREENS[i], REDS[i]);
107 }
108 
109 // ----------------------------------------------------------------------------------------------------
110 
112 {
115 };
116 
117 bool imageToBinary(const cv::Mat& image, std::vector<unsigned char>& data, ImageCompressionType compression_type)
118 {
119  if (compression_type == IMAGE_COMPRESSION_JPG)
120  {
121  // OpenCV compression settings
122  std::vector<int> rgb_params;
123  rgb_params.resize(3, 0);
124 
125  rgb_params[0] = CV_IMWRITE_JPEG_QUALITY;
126  rgb_params[1] = 95; // default is 95
127 
128  // Compress image
129  if (!cv::imencode(".jpg", image, data, rgb_params)) {
130  std::cout << "RGB image compression failed" << std::endl;
131  return false;
132  }
133  }
134  else if (compression_type == IMAGE_COMPRESSION_PNG)
135  {
136  std::vector<int> params;
137  params.resize(3, 0);
138 
139  params[0] = CV_IMWRITE_PNG_COMPRESSION;
140  params[1] = 1;
141 
142  if (!cv::imencode(".png", image, data, params)) {
143  std::cout << "PNG image compression failed" << std::endl;
144  return false;
145  }
146  }
147 
148  return true;
149 }
150 
151 // ----------------------------------------------------------------------------------------------------
152 
154 {
155  command_ = "explore";
157  t_command_ = ros::Time::now();
158 }
159 
160 // ----------------------------------------------------------------------------------------------------
161 
163 {
164 }
165 
166 // ----------------------------------------------------------------------------------------------------
167 
169 {
170  std::string srv_get_measurements, srv_set_label, srv_raise_event, srv_get_command, map_image_topic;
171 
172  config.value("srv_get_measurements", srv_get_measurements);
173  config.value("srv_set_label", srv_set_label);
174  config.value("srv_raise_event", srv_raise_event);
175  config.value("srv_get_command", srv_get_command);
176  config.value("map_image_topic", map_image_topic);
177 
178  // TODO: make configurable
180 
181  int image_width, image_height;
182  config.value("map_image_width", image_width);
183  config.value("map_image_height", image_height);
184 
185  double world_width, world_height;
186  config.value("world_width", world_width);
187  config.value("world_height", world_height);
188 
189  double cam_x, cam_y, cam_z;
190  config.value("cam_x", cam_x);
191  config.value("cam_y", cam_y);
192  config.value("cam_z", cam_z);
193 
194  if (config.hasError())
195  return;
196 
197  ros::NodeHandle nh;
198 
199  if (srv_get_measurements_.getService() != srv_get_measurements)
200  {
201  ros::AdvertiseServiceOptions opt_get_measurements =
202  ros::AdvertiseServiceOptions::create<ed_msgs::GetMeasurements>(
203  srv_get_measurements, boost::bind(&GUIPlugin::srvGetMeasurements, this, _1, _2), ros::VoidPtr(), &cb_queue_);
204  srv_get_measurements_ = nh.advertiseService(opt_get_measurements);
205  }
206 
207  if (srv_set_label_.getService() != srv_set_label)
208  {
209  ros::AdvertiseServiceOptions opt_set_label =
210  ros::AdvertiseServiceOptions::create<ed_msgs::SetLabel>(
211  srv_set_label, boost::bind(&GUIPlugin::srvSetLabel, this, _1, _2), ros::VoidPtr(), &cb_queue_);
212  srv_set_label_ = nh.advertiseService(opt_set_label);
213  }
214 
215  if (srv_raise_event_.getService() != srv_raise_event)
216  {
217  ros::AdvertiseServiceOptions opt_raise_event =
218  ros::AdvertiseServiceOptions::create<ed_msgs::RaiseEvent>(
219  srv_raise_event, boost::bind(&GUIPlugin::srvRaiseEvent, this, _1, _2), ros::VoidPtr(), &cb_queue_);
220  srv_raise_event_ = nh.advertiseService(opt_raise_event);
221  }
222 
223  if (srv_get_command_.getService() != srv_get_command)
224  {
225  ros::AdvertiseServiceOptions opt_get_command =
226  ros::AdvertiseServiceOptions::create<ed_msgs::GetGUICommand>(
227  srv_get_command, boost::bind(&GUIPlugin::srvGetCommand, this, _1, _2), ros::VoidPtr(), &cb_queue_);
228  srv_get_command_ = nh.advertiseService(opt_get_command);
229  }
230 
231  if (pub_image_map_.getTopic() != map_image_topic)
232  pub_image_map_ = nh.advertise<tue_serialization::Binary>("/ed/gui/map_image", 1);
233 
234  map_image_ = cv::Mat(image_width, image_height, CV_8UC3, cv::Scalar(50, 50, 50));
235 
236  projector_pose_.setOrigin(geo::Vector3(cam_x, cam_y, cam_z));
238 
239  projector_ = geo::DepthCamera(image_width, image_height,
240  image_width / (world_width / cam_z), image_height / (world_height / cam_z),
241  image_width / 2, image_height / 2,
242  0, 0);
243 }
244 
245 // ----------------------------------------------------------------------------------------------------
246 
248 {
249 }
250 
251 // ----------------------------------------------------------------------------------------------------
252 
254 {
255  world_model_ = &world;
256 
257  handleRequests();
258 
259  publishMapImage();
260 }
261 
262 // ----------------------------------------------------------------------------------------------------
263 
264 cv::Point2i GUIPlugin::coordinateToPixel(const geo::Vector3& p) const
265 {
267 }
268 
269 // ----------------------------------------------------------------------------------------------------
270 
271 ed::UUID GUIPlugin::getEntityFromClick(const cv::Point2i& p) const
272 {
273  for(ed::WorldModel::const_iterator it_entity = world_model_->begin(); it_entity != world_model_->end(); ++it_entity)
274  {
275  const ed::EntityConstPtr& e = *it_entity;
276  if (!e->visual())
277  {
278  const pcl::PointCloud<pcl::PointXYZ>& chull_points = e->convexHull().chull;
279 
280  if (!chull_points.empty())
281  {
282  std::vector<cv::Point2i> image_chull(chull_points.size());
283  for(unsigned int i = 0; i < chull_points.size(); ++i)
284  image_chull[i] = coordinateToPixel(chull_points[i]);
285 
286  if (inPolygon(image_chull, p))
287  return e->id();
288  }
289  }
290  }
291 
292  return "";
293 }
294 
295 // ----------------------------------------------------------------------------------------------------
296 
298 {
299  // clear image
300  map_image_ = cv::Mat(map_image_.rows, map_image_.cols, CV_8UC3, cv::Scalar(10, 10, 10));
301 
302  // Draw world model shapes
303 
304  cv::Mat z_buffer(map_image_.rows, map_image_.cols, CV_32FC1, 0.0);
305 
306  for(ed::WorldModel::const_iterator it_entity = world_model_->begin(); it_entity != world_model_->end(); ++it_entity)
307  {
308  const ed::EntityConstPtr& e = *it_entity;
309 
310  if (e->visual() && e->id() != "floor")
311  {
312  cv::Scalar color = idToColor(e->id());
313  cv::Vec3b color_vec(0.5 * color[0], 0.5 * color[1], 0.5 * color[2]);
314 
315  geo::Pose3D pose = projector_pose_.inverse() * e->pose();
316  geo::RenderOptions opt;
317  opt.setMesh(e->visual()->getMesh(), pose);
318 
319  ColorRenderResult res(map_image_, z_buffer, color_vec, projector_pose_.t.z - 3, projector_pose_.t.z + 1);
320 
321  // Render
322  projector_.render(opt, res);
323  }
324  }
325 
326  for(ed::WorldModel::const_iterator it_entity = world_model_->begin(); it_entity != world_model_->end(); ++it_entity)
327  {
328  const ed::EntityConstPtr& e = *it_entity;
329 
330  const pcl::PointCloud<pcl::PointXYZ>& chull_points = e->convexHull().chull;
331 
332  cv::Scalar color = idToColor(e->id());
333  int thickness = 1;
334  if (selected_id_ == e->id())
335  thickness = 3;
336 
337  // draw the polygon
338  if (!chull_points.empty())
339  {
340  // Lower polygon
341  for(unsigned int i = 0; i < chull_points.size(); ++i)
342  {
343  int j = (i + 1) % chull_points.size();
344 
345  const pcl::PointXYZ& p1 = chull_points[i];
346  const pcl::PointXYZ& p2 = chull_points[j];
347 
348  cv::line(map_image_,
349  coordinateToPixel(p1.x, p1.y, e->convexHull().min_z),
350  coordinateToPixel(p2.x, p2.y, e->convexHull().min_z),
351  0.3 * color, thickness);
352  }
353 
354  // Edges in between
355  for(unsigned int i = 0; i < chull_points.size(); ++i)
356  {
357  const pcl::PointXYZ p = chull_points[i];
358  cv::line(map_image_,
359  coordinateToPixel(p.x, p.y, e->convexHull().min_z),
360  coordinateToPixel(p.x, p.y, e->convexHull().max_z),
361  0.5 * color, thickness);
362  }
363 
364 
365  // Upper polygon
366  for(unsigned int i = 0; i < chull_points.size(); ++i)
367  {
368  int j = (i + 1) % chull_points.size();
369 
370  const pcl::PointXYZ& p1 = chull_points[i];
371  const pcl::PointXYZ& p2 = chull_points[j];
372 
373  cv::line(map_image_,
374  coordinateToPixel(p1.x, p1.y, e->convexHull().max_z),
375  coordinateToPixel(p2.x, p2.y, e->convexHull().max_z),
376  color, thickness);
377  }
378 
379  if (e->type() == "person")
380  {
381 
382  cv::circle(map_image_, coordinateToPixel(e->convexHull().center_point), 15, cv::Scalar(255, 0, 0), 10);
383  }
384  }
385  }
386 
387  // Find the global most recent measurement
388  ed::MeasurementConstPtr last_measurement;
389  for(ed::WorldModel::const_iterator it_entity = world_model_->begin(); it_entity != world_model_->end(); ++it_entity)
390  {
391  const ed::EntityConstPtr& e = *it_entity;
392  if (e->lastMeasurement() && (!last_measurement || e->lastMeasurement()->timestamp() > e->lastMeasurement()->timestamp()))
393  last_measurement = e->lastMeasurement();
394  }
395 
396  if (last_measurement)
397  {
398  const geo::Pose3D& sensor_pose = last_measurement->sensorPose();
399 
400  // Draw sensor origin
401  const geo::Vector3& p = sensor_pose.getOrigin();
402  cv::Point2i p_2d = coordinateToPixel(p);
403 
404  cv::circle(map_image_, p_2d, 10, cv::Scalar(255, 255, 255));
405 
406  rgbd::View view(*last_measurement->image(), 100); // width doesnt matter; we'll go back to world coordinates anyway
407  geo::Vector3 p1 = view.getRasterizer().project2Dto3D(0, 0) * 3;
408  geo::Vector3 p2 = view.getRasterizer().project2Dto3D(view.getWidth() - 1, 0) * 3;
409  geo::Vector3 p3 = view.getRasterizer().project2Dto3D(0, view.getHeight() - 1) * 3;
410  geo::Vector3 p4 = view.getRasterizer().project2Dto3D(view.getWidth() - 1, view.getHeight() - 1) * 3;
411 
412  cv::Point2i p1_2d = coordinateToPixel(sensor_pose * p1);
413  cv::Point2i p2_2d = coordinateToPixel(sensor_pose * p2);
414  cv::Point2i p3_2d = coordinateToPixel(sensor_pose * p3);
415  cv::Point2i p4_2d = coordinateToPixel(sensor_pose * p4);
416 
417  cv::Scalar fustrum_color(100, 100, 100);
418 
419  cv::line(map_image_, p_2d, p1_2d, fustrum_color);
420  cv::line(map_image_, p_2d, p2_2d, fustrum_color);
421  cv::line(map_image_, p_2d, p3_2d, fustrum_color);
422  cv::line(map_image_, p_2d, p4_2d, fustrum_color);
423 
424  cv::line(map_image_, p1_2d, p2_2d, fustrum_color);
425  cv::line(map_image_, p1_2d, p3_2d, fustrum_color);
426  cv::line(map_image_, p2_2d, p4_2d, fustrum_color);
427  cv::line(map_image_, p3_2d, p4_2d, fustrum_color);
428  }
429 
430  if (t_last_click_ > ros::Time(0) && t_last_click_ > ros::Time::now() - ros::Duration(1))
431  {
432  cv::circle(map_image_, p_click_, 20, cv::Scalar(0, 0, 255), 5);
433  }
434 
435  // Convert to binary
436  tue_serialization::Binary msg;
438  {
439  pub_image_map_.publish(msg);
440  }
441 
442 // cv::imshow("gui", map_image_);
443 // cv::waitKey(3);
444 }
445 
446 // ----------------------------------------------------------------------------------------------------
447 
449 {
450  cb_queue_.callAvailable();
451 }
452 
453 // ----------------------------------------------------------------------------------------------------
454 
455 // Returns measurement of currently selected id
456 bool GUIPlugin::srvGetMeasurements(ed_msgs::GetMeasurements::Request& req, ed_msgs::GetMeasurements::Response& res)
457 {
458  if (selected_id_.empty())
459  return true;
460 
462  if (!e)
463  return true;
464 
465  ed::MeasurementConstPtr m = e->bestMeasurement();
466  if (m)
467  {
468  const cv::Mat& rgb_image = m->image()->getRGBImage();
469  const ed::ImageMask& image_mask = m->imageMask();
470 
471  cv::Mat rgb_image_masked(rgb_image.rows, rgb_image.cols, CV_8UC3, cv::Scalar(0, 0, 0));
472 
473  for(ed::ImageMask::const_iterator it = image_mask.begin(rgb_image.cols); it != image_mask.end(); ++it)
474  {
475  cv::Point2i pt = it();
476  rgb_image_masked.at<cv::Vec3b>(pt) = rgb_image.at<cv::Vec3b>(pt);
477  }
478 
479  res.images.push_back(tue_serialization::Binary());
480  if (imageToBinary(rgb_image_masked, res.images.back().data, IMAGE_COMPRESSION_JPG))
481  {
482  res.ids.push_back(e->id());
483  res.images.back().info = e->type();
484  }
485  else
486  res.images.pop_back();
487  }
488 
489  return true;
490 }
491 
492 // ----------------------------------------------------------------------------------------------------
493 
494 bool GUIPlugin::srvSetLabel(ed_msgs::SetLabel::Request& req, ed_msgs::SetLabel::Response& res)
495 {
496  ed::UUID id = req.id;
497  if (id.empty())
498  id = selected_id_;
499 
500  if (id.empty())
501  {
502  std::cout << "GUIServer: srvSetLabel: no id given or selected" << std::endl;
503  return true;
504  }
505 
507  if (!e)
508  {
509  res.msg = "GUIServer: srvSetLabel: Id does not exist: " + id;
510  std::cout << res.msg << std::endl;
511  }
512  else
513  {
514  // Make a copy of the entity
515  ed::EntityPtr e_updated(new ed::Entity(*e));
516 
517  // Set the label
518  e_updated->setType(req.label);
519 
520  // TODO: fill update request to set the label
521  // ...
522 
523  res.msg = "[ED] GUI Plugin: srv SetLabel not yet implemented.";
524  std::cout << res.msg << std::endl;
525 
526 
527 // std::cout << "Setting entity '" << id << "' to type '" << req.label << "'" << std::endl;
528  }
529 
530  return true;
531 }
532 
533 // ----------------------------------------------------------------------------------------------------
534 
535 bool parseParam(const std::map<std::string, std::string>& params, const std::string& key, float& value)
536 {
538  if (it == params.end())
539  return false;
540  value = atof(it->second.c_str());
541  return true;
542 }
543 
544 // ----------------------------------------------------------------------------------------------------
545 
547 {
549  if (it == params.end())
550  return false;
551  value = it->second.c_str();
552  return true;
553 }
554 
555 // ----------------------------------------------------------------------------------------------------
556 
557 bool GUIPlugin::srvRaiseEvent(ed_msgs::RaiseEvent::Request& req, ed_msgs::RaiseEvent::Response& res)
558 {
560  for(unsigned int i = 0; i < req.param_names.size(); ++i)
561  params[req.param_names[i]] = req.param_values[i];
562 
563  if (req.name == "click")
564  {
565  float x, y;
566  std::string type;
567  if (parseParam(params, "x", x) && parseParam(params, "y", y) && parseParam(params, "type", type))
568  {
569  p_click_ = cv::Point2i(x, y);
570  t_last_click_ = ros::Time::now();
571  std::cout << "Detected click at " << params["x"] << ", " << params["y"] << std::endl;
572 
573  command_ = "";
575 
576  if (type == "delete")
577  {
578  if (!selected_id_.empty())
579  {
580  // TODO: implement deletion
581  res.msg = "Deletion not yet implemented";
582  std::cout << "[ED] GUI Plugin: " << res.msg << std::endl;
583 
584 
585 // world_model_->erase(selected_id_);
586 // res.msg = "Deleted object with id '" + selected_id_ + "'";
587  }
588  }
589  else if (type == "navigate")
590  {
591  command_ = "navigate";
593  res.msg = "Navigating to '" + selected_id_ + "'";
594  }
595  else if (type == "select")
596  {
597  res.msg = "Selected '" + selected_id_ + "'";
598  }
599  else
600  {
601  res.msg = "Unknown click type: " + type;
602  }
603 
604  if (!command_.empty())
605  {
606  t_command_ = ros::Time::now();
608  }
609  }
610  else
611  {
612  res.msg = "Could not parse click event";
613  }
614  }
615  else if (req.name == "zoom")
616  {
617  float f;
618  if (parseParam(params, "factor", f))
619  {
620  float z_current = projector_pose_.t.z;
621  projector_pose_.t.z = z_current / f;
622  }
623  }
624  else if (req.name == "pan")
625  {
626  float dx, dy;
627  if (parseParam(params, "dx", dx) && parseParam(params, "dy", dy))
628  {
629  projector_pose_.t.x += dx;
630  projector_pose_.t.y += dy;
631  }
632  }
633  else if (req.name == "explore")
634  {
635  command_ = "explore";
636  t_command_ = ros::Time::now();
638  }
639  else if (req.name == "wait")
640  {
641  command_ = "wait";
642  t_command_ = ros::Time::now();
644  }
645  else
646  {
647  res.msg = "Unknown event received: " + req.name;
648  }
649 
650  std::cout << "ServerGUI: RaiseEvent: " << res.msg << std::endl;
651 
652  return true;
653 }
654 
655 // ----------------------------------------------------------------------------------------------------
656 
657 bool GUIPlugin::srvGetCommand(ed_msgs::GetGUICommand::Request& req, ed_msgs::GetGUICommand::Response& res)
658 {
659  if (!command_.empty())
660  {
661  res.age = ros::Time::now() - t_command_;
662  res.command = command_;
663  res.command_id = command_id_;
664 
666  {
667  res.param_names.push_back(it->first);
668  res.param_values.push_back(it->second);
669  }
670  }
671 
672  return true;
673 }
674 
675 
GUIPlugin::trigger_map_publish_
ed::EventClock trigger_map_publish_
Definition: gui_plugin.h:44
geo::Mat3T::identity
static Mat3T identity()
GUIPlugin::srvGetCommand
bool srvGetCommand(ed_msgs::GetGUICommand::Request &req, ed_msgs::GetGUICommand::Response &res)
Definition: gui_plugin.cpp:657
GUIPlugin::srv_raise_event_
ros::ServiceServer srv_raise_event_
Definition: gui_plugin.h:65
GUIPlugin::initialize
void initialize()
Definition: gui_plugin.cpp:247
ed::WorldModel::getEntity
EntityConstPtr getEntity(const ed::UUID &id) const
Definition: world_model.h:76
std::vector::resize
T resize(T... args)
ed::WorldModel
Definition: world_model.h:21
ed::ImageMask::const_iterator
Definition: mask.h:112
ed::UpdateRequest
Definition: update_request.h:24
GUIPlugin::t_last_click_
ros::Time t_last_click_
Definition: gui_plugin.h:88
std::string
geo::Transform3T::setOrigin
void setOrigin(const Vec3T< T > &v)
geo::RenderOptions::setMesh
void setMesh(const geo::Mesh &mesh, const geo::Pose3D &pose=geo::Pose3D::identity())
idToColor
cv::Scalar idToColor(const ed::UUID &id)
Definition: gui_plugin.cpp:103
geo
imageToBinary
bool imageToBinary(const cv::Mat &image, std::vector< unsigned char > &data, ImageCompressionType compression_type)
Definition: gui_plugin.cpp:117
entity.h
GUIPlugin::srv_set_label_
ros::ServiceServer srv_set_label_
Definition: gui_plugin.h:63
BLUES
int BLUES[]
Definition: gui_plugin.cpp:86
ED_REGISTER_PLUGIN
#define ED_REGISTER_PLUGIN(Derived)
Definition: plugin.h:5
GUIPlugin::srvGetMeasurements
bool srvGetMeasurements(ed_msgs::GetMeasurements::Request &req, ed_msgs::GetMeasurements::Response &res)
Definition: gui_plugin.cpp:456
GUIPlugin::srvRaiseEvent
bool srvRaiseEvent(ed_msgs::RaiseEvent::Request &req, ed_msgs::RaiseEvent::Response &res)
Definition: gui_plugin.cpp:557
ColorRenderResult::image_
cv::Mat image_
Definition: gui_plugin.cpp:49
vector
std::map::find
T find(T... args)
std::vector::size
T size(T... args)
geo::Transform3T::setBasis
void setBasis(const Mat3T< T > &r)
GUIPlugin::p_click_
cv::Point2i p_click_
Definition: gui_plugin.h:86
geo::Transform3T::getOrigin
const Vec3T< T > & getOrigin() const
hash
int hash(const char *str, int max_val)
Definition: gui_plugin.cpp:90
rgbd::View::getWidth
const int & getWidth() const
rgb_image
cv::Mat rgb_image
Shape.h
geo::DepthCamera::render
void render(const RenderOptions &opt, RenderResult &res) const
GUIPlugin::selected_id_
ed::UUID selected_id_
Definition: gui_plugin.h:102
IMAGE_COMPRESSION_JPG
@ IMAGE_COMPRESSION_JPG
Definition: gui_plugin.cpp:113
geo::Transform3T
ed::WorldModel::begin
const_iterator begin() const
Definition: world_model.h:68
IMAGE_COMPRESSION_PNG
@ IMAGE_COMPRESSION_PNG
Definition: gui_plugin.cpp:114
ed::EntityConstPtr
shared_ptr< const Entity > EntityConstPtr
Definition: types.h:37
ed::WorldModel::end
const_iterator end() const
Definition: world_model.h:70
GUIPlugin::configure
void configure(tue::Configuration config)
Definition: gui_plugin.cpp:168
std::string::push_back
T push_back(T... args)
GUIPlugin::srv_get_measurements_
ros::ServiceServer srv_get_measurements_
Definition: gui_plugin.h:61
image
cv::Mat image
Definition: view_model.cpp:42
std::cout
geo::Vec3T::y
T y
tue::config::ReaderWriter
geo::Transform3T::inverse
Transform3T inverse() const
rgbd::View::getRasterizer
const geo::DepthCamera & getRasterizer() const
geo::RenderResult
ed::EventClock
Definition: event_clock.h:9
GUIPlugin::map_image_
cv::Mat map_image_
Definition: gui_plugin.h:55
geo::RenderOptions
ColorRenderResult::max_depth_
float max_depth_
Definition: gui_plugin.cpp:52
rgbd::View::getHeight
const int & getHeight() const
measurement.h
ColorRenderResult::ColorRenderResult
ColorRenderResult(cv::Mat &image, cv::Mat &z_buffer, const cv::Vec3b &color, float min_depth, float max_depth)
Definition: gui_plugin.cpp:27
gui_plugin.h
GUIPlugin::srv_get_command_
ros::ServiceServer srv_get_command_
Definition: gui_plugin.h:67
ColorRenderResult::color_
cv::Vec3b color_
Definition: gui_plugin.cpp:51
ed::Entity
Definition: entity.h:30
geo::Transform3T::t
Vec3T< T > t
GUIPlugin::GUIPlugin
GUIPlugin()
Definition: gui_plugin.cpp:153
GUIPlugin::projector_
geo::DepthCamera projector_
Definition: gui_plugin.h:51
GUIPlugin::publishMapImage
void publishMapImage()
Definition: gui_plugin.cpp:297
ed::UUID
Definition: uuid.h:10
GUIPlugin::projector_pose_
geo::Pose3D projector_pose_
Definition: gui_plugin.h:53
GUIPlugin::~GUIPlugin
virtual ~GUIPlugin()
Definition: gui_plugin.cpp:162
ColorRenderResult::min_depth_
float min_depth_
Definition: gui_plugin.cpp:52
geo::Vector3
map
geo::DepthCamera::project2Dto3D
geo::Vec3T< T > project2Dto3D(int x, int y) const
ed::WorldModel::EntityIterator
Definition: world_model.h:26
parseParam
bool parseParam(const std::map< std::string, std::string > &params, const std::string &key, float &value)
Definition: gui_plugin.cpp:535
GUIPlugin::command_params_
std::map< std::string, std::string > command_params_
Definition: gui_plugin.h:96
ed::MeasurementConstPtr
shared_ptr< const Measurement > MeasurementConstPtr
Definition: types.h:33
GUIPlugin
Definition: gui_plugin.h:29
std::min
T min(T... args)
GUIPlugin::process
void process(const ed::WorldModel &world, ed::UpdateRequest &req)
Definition: gui_plugin.cpp:253
ColorRenderResult::z_buffer_
cv::Mat z_buffer_
Definition: gui_plugin.cpp:50
ed::Entity::generateID
static UUID generateID()
Definition: entity.cpp:198
tue::config::ReaderWriter::value
bool value(const std::string &name, T &value, RequiredOrOptional opt=REQUIRED)
GUIPlugin::world_model_
const ed::WorldModel * world_model_
Definition: gui_plugin.h:46
inPolygon
bool inPolygon(const std::vector< cv::Point2i > &points_list, const cv::Point2i &point)
Definition: gui_plugin.cpp:59
GUIPlugin::cb_queue_
ros::CallbackQueue cb_queue_
Definition: gui_plugin.h:59
std::endl
T endl(T... args)
GUIPlugin::srvSetLabel
bool srvSetLabel(ed_msgs::SetLabel::Request &req, ed_msgs::SetLabel::Response &res)
Definition: gui_plugin.cpp:494
ColorRenderResult::renderPixel
void renderPixel(int x, int y, float depth, int)
Definition: gui_plugin.cpp:33
std::map::begin
T begin(T... args)
geo::DepthCamera::project3Dto2D
cv::Point_< Tout > project3Dto2D(const geo::Vec3T< Tin > &p) const
GUIPlugin::command_
std::string command_
Definition: gui_plugin.h:92
GREENS
int GREENS[]
Definition: gui_plugin.cpp:85
ed::ImageMask
Definition: mask.h:17
ColorRenderResult
Definition: gui_plugin.cpp:22
geo::Vec3T::z
T z
std::string::empty
T empty(T... args)
geo::DepthCamera
GUIPlugin::command_id_
std::string command_id_
Definition: gui_plugin.h:94
GUIPlugin::handleRequests
void handleRequests()
Definition: gui_plugin.cpp:448
std::map::end
T end(T... args)
ed::ImageMask::begin
const_iterator begin(int width=0) const
Definition: mask.h:180
geo::RenderResult::RenderResult
RenderResult(int width, int height)
std::max
T max(T... args)
GUIPlugin::pub_image_map_
ros::Publisher pub_image_map_
Definition: gui_plugin.h:69
c
void c()
ImageCompressionType
ImageCompressionType
Definition: gui_plugin.cpp:111
REDS
int REDS[]
Definition: gui_plugin.cpp:84
GUIPlugin::getEntityFromClick
ed::UUID getEntityFromClick(const cv::Point2i &p) const
Definition: gui_plugin.cpp:271
ed::ImageMask::end
const_iterator end() const
Definition: mask.h:188
GUIPlugin::t_command_
ros::Time t_command_
Definition: gui_plugin.h:98
rgbd::View
geo::Vec3T::x
T x
ed::EntityPtr
shared_ptr< Entity > EntityPtr
Definition: types.h:35
GUIPlugin::coordinateToPixel
cv::Point2i coordinateToPixel(const geo::Vector3 &p) const
Definition: gui_plugin.cpp:264
config
tue::config::ReaderWriter config
world_model.h
tue::config::ReaderWriter::hasError
bool hasError() const