points_to_camera.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 
28 #include <ros/ros.h>
29 #include <tf/transform_broadcaster.h>
30 #include <geometry_msgs/TransformStamped.h>
31 #include <image_transport/image_transport.h>
32 #include <cv_bridge/cv_bridge.h>
33 #include <sensor_msgs/image_encodings.h>
34 #include <opencv2/imgproc/imgproc.hpp>
35 #include <opencv2/highgui/highgui.hpp>
36 #include <sensor_msgs/image_encodings.h>
37 #include <driver_base/driver.h>
38 #include <camera_info_manager/camera_info_manager.h>
39 #include <tf/transform_broadcaster.h>
40 
41 using namespace std;
42 
44 {
45  public:
46 
47  CameraProjection(ros::NodeHandle& nh_):
48  nh(nh_),
49  it(nh_)
50  {
51  sub_image = it.subscribe("image_raw", 1, &CameraProjection::imageHandler,this);
52 
53  }
54 
55  void imageHandler(const sensor_msgs::ImageConstPtr& msg)
56  {
57  cout<<"Received image: short/left"<<endl;
58 
59  cv_bridge::CvImagePtr cv_ptr;
60 
61  try
62  {
63  cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
64  }
65  catch (cv_bridge::Exception& e)
66  {
67  ROS_ERROR("cv_bridge exception: %s", e.what());
68  return;
69  }
70 
71 
72 
73 
74 
75  }
76 
77  ros::NodeHandle nh;
78  image_transport::ImageTransport it;
79 
80  sensor_msgs::Image image;
81 
82  image_transport::Subscriber sub_image;
83 };
84 
85 int main(int argc, char** argv)
86 {
87  ros::init(argc, argv, "camera_projection");
88  ros::NodeHandle node;
89 
90  CameraProjection camera_projection(node);
91 
92  ros::spin();
93 
94  return 0;
95 }
image_transport::ImageTransport it
CameraProjection(ros::NodeHandle &nh_)
sensor_msgs::Image image
image_transport::Subscriber sub_image
int main(int argc, char **argv)
void imageHandler(const sensor_msgs::ImageConstPtr &msg)
ros::NodeHandle nh


multisensor_aquisition
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:32:28