ShapeTracker.h
Go to the documentation of this file.
00001 /*
00002  * ShapeTracker.h
00003  *
00004  *      Author: roberto
00005  *
00006  * This is a modified implementation of the method for online estimation of kinematic structures described in our paper
00007  * "Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors"
00008  * (Martín-Martín and Brock, 2014) and the extension to segment, reconstruct and track shapes introduced in our paper
00009  * "An Integrated Approach to Visual Perception of Articulated Objects" (Martín-Martín, Höfer and Brock, 2016)
00010  * This implementation can be used to reproduce the results of the paper and to be applied to new research.
00011  * The implementation allows also to be extended to perceive different information/models or to use additional sources of information.
00012  * A detail explanation of the method and the system can be found in our paper.
00013  *
00014  * If you are using this implementation in your research, please consider citing our work:
00015  *
00016 @inproceedings{martinmartin_ip_iros_2014,
00017 Title = {Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors},
00018 Author = {Roberto {Mart\'in-Mart\'in} and Oliver Brock},
00019 Booktitle = {Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems},
00020 Pages = {2494-2501},
00021 Year = {2014},
00022 Location = {Chicago, Illinois, USA},
00023 Note = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00024 Url = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00025 Projectname = {Interactive Perception}
00026 }
00027 
00028 @inproceedings{martinmartin_hoefer_iros_2016,
00029 Title = {An Integrated Approach to Visual Perception of Articulated Objects},
00030 Author = {Roberto {Mart\'{i}n-Mart\'{i}n} and Sebastian H\"ofer and Oliver Brock},
00031 Booktitle = {Proceedings of the IEEE International Conference on Robotics and Automation},
00032 Pages = {5091 - 5097},
00033 Year = {2016},
00034 Doi = {10.1109/ICRA.2016.7487714},
00035 Location = {Stockholm, Sweden},
00036 Month = {05},
00037 Note = {http://www.redaktion.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martin_hoefer_15_iros_sr_opt.pdf},
00038 Url = {http://www.redaktion.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martin_hoefer_15_iros_sr_opt.pdf},
00039 Url2 = {http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=7487714},
00040 Projectname = {Interactive Perception}
00041 }
00042  * If you have questions or suggestions, contact us:
00043  * roberto.martinmartin@tu-berlin.de
00044  *
00045  * Enjoy!
00046  */
00047 
00048 #ifndef SHAPE_TRACKER_H_
00049 #define SHAPE_TRACKER_H_
00050 
00051 #include <omip_common/OMIPTypeDefs.h>
00052 
00053 //ROS and OpenCV
00054 #include <opencv2/core/core.hpp>
00055 #include <camera_info_manager/camera_info_manager.h>
00056 
00057 #include <omip_common/OMIPUtils.h>
00058 
00059 #include <omip_msgs/ShapeTrackerState.h>
00060 
00061 #include <opencv2/highgui/highgui.hpp>
00062 
00063 #include <pcl/filters/extract_indices.h>
00064 #include <pcl/registration/icp.h>
00065 
00066 #ifdef USE_LIBPOINTMATCHER_ICP
00067 #include "shape_tracker/point_cloud_conversions.h"
00068 typedef PointMatcher<float> PM;
00069 typedef PM::DataPoints DP;
00070 #endif
00071 
00072 namespace omip
00073 {
00074 
00075 void calculate_ICP_COV(pcl::PointCloud<pcl::PointXYZ>& data_pi, pcl::PointCloud<pcl::PointXYZ>& model_qi, Eigen::Matrix4f& transform, Eigen::MatrixXd& ICP_COV);
00076 
00077 class ShapeTracker;
00078 typedef boost::shared_ptr<ShapeTracker> ShapeTrackerPtr;
00079 
00080 class ShapeTracker
00081 {
00082 public:
00083     ShapeTracker(omip::RB_id_t rb_id);
00084 
00085     ShapeTrackerPtr clone() const
00086     {
00087         return (ShapeTrackerPtr(doClone()));
00088     }
00089 
00090     ShapeTracker(const ShapeTracker &sr);
00091 
00092     virtual ~ShapeTracker();
00093 
00094     virtual void step(const sensor_msgs::PointCloud2ConstPtr& pc_msg,
00095                       const omip_msgs::RigidBodyPoseAndVelMsg& tracked_rbm,
00096                       omip_msgs::ShapeTrackerState& st_state);
00097 
00098     virtual void setShapeModel(const sensor_msgs::PointCloud2& model);
00099 
00100     virtual void setCameraInfo(const sensor_msgs::CameraInfo& camera_info);
00101 
00102 protected:
00103 
00104     virtual void _RemoveInconsistentPointsFromRBModel(pcl::PointCloud<pcl::PointXYZ >::Ptr model_current_pose,
00105                                                       pcl::PointCloud<pcl::PointXYZ >::Ptr current_pc,
00106                                                       pcl::PointCloud<pcl::PointXYZ >::Ptr& rb_segment_depth,
00107                                                       pcl::PointCloud<pcl::PointXYZ >::Ptr &current_pc_extended_segment);
00108 
00109 
00110     virtual void _FindInconsistentPoints(const pcl::PointCloud<pcl::PointXYZ >::Ptr& pc_source,
00111                                             const cv::Mat & dm_true,
00112                                             pcl::PointIndicesPtr& indices_to_remove,
00113                                             pcl::PointIndicesPtr& indices_matching_in_true,
00114                                             pcl::PointIndicesPtr& indices_matching_in_dm,
00115                                             const double min_depth_error=0.03);
00116 
00118     virtual ShapeTracker* doClone() const
00119     {
00120         return (new ShapeTracker(*this));
00121     }
00122 
00123     omip::RB_id_t                                                       _rb_id;
00124     pcl::PointCloud<pcl::PointXYZ >::Ptr                             _rb_model;
00125 
00126     sensor_msgs::CameraInfo _ci;
00127 
00128     pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> _icp;
00129 
00130     ros::NodeHandle _nh;
00131     ros::Publisher _segment_pub;
00132 
00133     bool _new_model;
00134 
00135     cv::Mat _current_dm;
00136     cv::Mat _segment_of_current;
00137     cv::Mat _segment_of_current_dilated;
00138     cv::Mat _dilation_element;
00139 
00140     pcl::ExtractIndices<pcl::PointXYZ>        _extractor;
00141 
00142 #ifdef USE_LIBPOINTMATCHER_ICP
00143     boost::shared_ptr<DP> _cloud_lpm;
00144     PM::ICP* _icp_lpm;
00145     boost::shared_ptr<DP> _rb_model_lpm;
00146 #endif
00147 };
00148 }
00149 
00150 #endif /* SHAPE_TRACKER_H_ */
00151 


shape_tracker
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:54:11