grasp
All Data Structures Namespaces Functions Modules
reconstructionRoutine.h
1 /* Copyright: (C) 2014 iCub Facility - Istituto Italiano di Tecnologia
2  * Authors: Ilaria Gori
3  * email: ilaria.gori@iit.it
4  * Permission is granted to copy, distribute, and/or modify this program
5  * under the terms of the GNU General Public License, version 2 or any
6  * later version published by the Free Software Foundation.
7  *
8  * A copy of the license can be found in the file LICENSE located in the
9  * root directory.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details
15 */
16 
17 #ifndef __RECONSTRUCTION_ROUTINE_H__
18 #define __RECONSTRUCTION_ROUTINE_H__
19 
20 #include <sstream>
21 
22 #include <pcl/common/common_headers.h>
23 #include <pcl/visualization/pcl_visualizer.h>
24 #include <pcl/filters/statistical_outlier_removal.h>
25 #include <pcl/filters/voxel_grid.h>
26 
27 #include <yarp/sig/Image.h>
28 #include <iCub/stereoVision/disparityThread.h>
29 
30 class ReconstructionRoutine
31 {
32 private:
33 
34  DisparityThread* disp;
35 
36  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelMono> > disparityOut;
37 
38  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud;
39  pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudComplete;
40 
41  void triangulation(IplImage* imgL, pcl::PointCloud<pcl::PointXYZRGB>::Ptr input, yarp::os::Bottle& pixelList);
42  void filter(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_in,pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_in_filtered);
43 
44 public:
45 
46  ReconstructionRoutine();
47  ~ReconstructionRoutine() {};
48 
49  void resetClouds();
50  bool reconstruct(IplImage* imgL, IplImage* imgR, yarp::os::Bottle& pixelList);
51  bool updateDisparity(IplImage* imgL, IplImage* imgR);
52  bool triangulateSinglePoint(IplImage* imgL, IplImage* imgR, yarp::sig::Vector &point2D, yarp::sig::Vector &point3D);
53  pcl::PointCloud<pcl::PointXYZRGB>::Ptr getPointCloud();
54  pcl::PointCloud<pcl::PointXYZRGB>::Ptr getPointCloudComplete();
55 
56  void close();
57  bool open(const yarp::os::Property &options);
58 };
59 
60 #endif