00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00035 #ifndef _CLASS_PINHOLE_PROJECTION_H_ 00036 #define _CLASS_PINHOLE_PROJECTION_H_ 00037 00038 #include <ros/ros.h> 00039 00040 #include <opencv2/imgproc/imgproc.hpp> 00041 #include <opencv2/highgui/highgui.hpp> 00042 #include <opencv2/core/core.hpp> 00043 00044 #include <sensor_msgs/PointCloud2.h> 00045 #include <pcl/ros/conversions.h> 00046 #include <pcl/point_cloud.h> 00047 #include <pcl/point_types.h> 00048 00049 #include <tf/tf.h> 00050 00051 #include "camera_parameters.h" 00052 00053 #ifndef PFLN 00054 #define PFLN {printf("File %s Line %d\n",__FILE__, __LINE__);} 00055 #endif 00056 class class_pinhole_projection: virtual public class_camera_parameters 00057 { 00058 public: 00059 00060 class_pinhole_projection(void) 00061 { 00062 } 00063 00064 ~class_pinhole_projection(void) 00065 { 00066 } 00067 00069 int set_projection_plane(double a, double b, double c, double d); 00070 00071 00073 int project_vertex_to_pixel(const pcl::PointCloud<pcl::PointXYZ>::Ptr v, std::vector<pcl::PointXY>* p); 00074 int project_pixel_to_vertex(const std::vector<pcl::PointXY>* p, pcl::PointCloud<pcl::PointXYZ>* v); 00075 00076 int project_pixel_with_color_to_vertex(const pcl::PointCloud<pcl::PointXYZRGB>* p, pcl::PointCloud<pcl::PointXYZRGB>* v); 00077 00078 00080 int compute_transformation_matrix(void); 00081 00083 int print_CvMat(cv::Mat *mat, const char* name); 00084 00085 00086 struct 00087 { 00088 double a,b,c,d; 00089 }projection_plane; 00090 00091 00092 private: 00093 00094 00095 }; 00096 00097 00098 00099 #endif 00100