[136] | 1 | #ifndef _3DV_DISPLAY_H
|
---|
| 2 | #define _3DV_DISPLAY_H
|
---|
| 3 |
|
---|
| 4 | /* 3dv-client/display.h
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2013 VisLab
|
---|
| 7 | *
|
---|
| 8 | * This file is part of lib3dv; you can redistribute it and/or modify
|
---|
| 9 | * it under the terms of the GNU Lesser General Public License as published by
|
---|
| 10 | * the Free Software Foundation; either version 3 of the License, or (at
|
---|
| 11 | * your option) any later version.
|
---|
| 12 | *
|
---|
| 13 | * This program is distributed in the hope that it will be useful, but
|
---|
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 16 | * General Public License for more details.
|
---|
| 17 | *
|
---|
| 18 | * You should have received a copy of the GNU Lesser General Public License
|
---|
| 19 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | #include <lib3dv/calibration.h>
|
---|
| 23 | #include <lib3dv/image.h>
|
---|
| 24 | #include <lib3dv/motion.h>
|
---|
| 25 | #include <lib3dv/obstacle.h>
|
---|
| 26 | #include <lib3dv/classification.h>
|
---|
| 27 | #include <lib3dv/terrain.h>
|
---|
| 28 |
|
---|
| 29 | #include <boost/array.hpp>
|
---|
| 30 | #include <boost/shared_ptr.hpp>
|
---|
| 31 | #include <boost/thread/condition.hpp>
|
---|
| 32 | #include <boost/thread/mutex.hpp>
|
---|
| 33 |
|
---|
| 34 | #include <stdint.h>
|
---|
| 35 |
|
---|
| 36 | #include <bitset>
|
---|
| 37 | #include <string>
|
---|
| 38 | #include <utility>
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | namespace lib3dv { struct image; struct terrain; struct obstacle; struct pose; class inverse_perspective_mapping; class pose_utils; }
|
---|
| 43 | namespace pcl { namespace visualization { class ImageViewer; class PCLVisualizer; } }
|
---|
| 44 |
|
---|
| 45 | class display
|
---|
| 46 | {
|
---|
| 47 | public:
|
---|
| 48 |
|
---|
| 49 | display(const lib3dv::calibration::camera_intrinsics& intrinsics, const lib3dv::calibration::position& position, const lib3dv::calibration::orientation& orientation, float baseline, uint8_t downsample, double area_step, uint8_t log_level);
|
---|
| 50 |
|
---|
| 51 | void update(boost::shared_ptr<const lib3dv::image> image);
|
---|
| 52 |
|
---|
| 53 | void update(boost::shared_ptr<const lib3dv::terrain> terrain);
|
---|
| 54 |
|
---|
| 55 | void update(boost::shared_ptr<const std::vector<lib3dv::obstacle> > obstacles);
|
---|
| 56 |
|
---|
| 57 | void update(boost::shared_ptr<const lib3dv::motion> motion);
|
---|
| 58 |
|
---|
| 59 | void update(boost::shared_ptr<const lib3dv::classification > classification);
|
---|
| 60 |
|
---|
| 61 | void run();
|
---|
| 62 |
|
---|
| 63 | void stop();
|
---|
| 64 |
|
---|
| 65 | void toggle_points_display() { m_show_points = !m_show_points; }
|
---|
| 66 |
|
---|
| 67 | void toggle_terrain_display() { m_show_terrain = !m_show_terrain; }
|
---|
| 68 |
|
---|
| 69 | void toggle_terrain_gm_display() { m_show_terrain_gm = !m_show_terrain_gm; }
|
---|
| 70 |
|
---|
| 71 | void toggle_obstacles_display() { m_show_obstacles = !m_show_obstacles; }
|
---|
| 72 |
|
---|
| 73 | void toggle_motion_display() { m_show_motion = !m_show_motion; }
|
---|
| 74 |
|
---|
| 75 | void toggle_classification_display() { m_show_classification = !m_show_classification; }
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | private:
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | boost::shared_ptr<lib3dv::inverse_perspective_mapping> m_ipm;
|
---|
| 82 | boost::shared_ptr<lib3dv::pose_utils> m_pose_utils;
|
---|
| 83 |
|
---|
| 84 | uint8_t m_downsample;
|
---|
| 85 | uint8_t m_log_level;
|
---|
| 86 |
|
---|
| 87 | boost::array<boost::shared_ptr<pcl::visualization::ImageViewer>, lib3dv::image::type::NUM - 1> m_image_viewers;
|
---|
| 88 | std::bitset<lib3dv::image::type::NUM - 1> m_image_viewers_closed;
|
---|
| 89 | boost::shared_ptr<pcl::visualization::PCLVisualizer> m_3d_viewer;
|
---|
| 90 | bool m_3d_viewer_closed;
|
---|
| 91 |
|
---|
| 92 | boost::array<std::pair<boost::shared_ptr<const lib3dv::image>, boost::shared_ptr<const lib3dv::image> >, lib3dv::image::type::NUM - 1> m_image_buffers;
|
---|
| 93 | std::pair<boost::shared_ptr<const lib3dv::terrain>, boost::shared_ptr<const lib3dv::terrain> > m_terrain_buffers;
|
---|
| 94 | std::pair<boost::shared_ptr<const std::vector<lib3dv::obstacle> >, boost::shared_ptr<const std::vector<lib3dv::obstacle> > > m_obstacles_buffers;
|
---|
| 95 | std::pair<boost::shared_ptr<const lib3dv::motion>, boost::shared_ptr<const lib3dv::motion> > m_motion_buffers;
|
---|
| 96 | std::pair<boost::shared_ptr<const lib3dv::classification>, boost::shared_ptr<const lib3dv::classification> > m_classification_buffers;
|
---|
| 97 |
|
---|
| 98 | // 3d viewer stuff
|
---|
| 99 | boost::shared_ptr<const lib3dv::image> m_dsi;
|
---|
| 100 | boost::shared_ptr<const lib3dv::image> m_right_rectified;
|
---|
| 101 | bool m_show_points;
|
---|
| 102 | bool m_show_terrain;
|
---|
| 103 | bool m_show_terrain_gm;
|
---|
| 104 | bool m_show_obstacles;
|
---|
| 105 | bool m_show_motion;
|
---|
| 106 | bool m_show_classification;
|
---|
| 107 |
|
---|
| 108 | bool m_stopped;
|
---|
| 109 | bool m_updated;
|
---|
| 110 | boost::condition_variable m_update_condition;
|
---|
| 111 | boost::mutex m_update_mutex;
|
---|
| 112 | std::pair<lib3dv::calibration::orientation, lib3dv::calibration::orientation> m_me_orientations;
|
---|
| 113 | std::pair<boost::posix_time::time_duration, boost::posix_time::time_duration> m_td_orientations;
|
---|
| 114 |
|
---|
| 115 | double m_area_step;
|
---|
| 116 |
|
---|
| 117 | int screen_width;
|
---|
| 118 | int screen_height;
|
---|
| 119 | };
|
---|
| 120 |
|
---|
| 121 | #endif
|
---|