00001 00018 #include <sensor_msgs/Image.h> 00019 #include <HalconCpp.h> 00020 #include <stdexcept> 00021 00022 namespace halcon_bridge { 00023 00024 class Exception: public std::runtime_error { 00025 public: 00026 Exception(const std::string& description) : 00027 std::runtime_error(description) { 00028 } 00029 }; 00030 00031 00032 class HalconImage; 00033 00034 typedef boost::shared_ptr<HalconImage> HalconImagePtr; 00035 00041 class HalconImage { 00042 public: 00043 std_msgs::Header header; 00044 std::string encoding; 00045 HalconCpp::HImage *image; 00046 00047 ~HalconImage(); 00048 00054 sensor_msgs::ImagePtr toImageMsg() const; 00055 00062 void toImageMsg(sensor_msgs::Image& ros_image) const; 00063 }; 00064 00065 00072 HalconImagePtr toHalconCopy(const sensor_msgs::ImageConstPtr& source); 00073 00080 HalconImagePtr toHalconCopy(const sensor_msgs::Image& source); 00081 00082 00083 00084 }