00001 00006 /***************************************************************************** 00007 ** Ifdefs 00008 *****************************************************************************/ 00009 00010 #ifndef mm_vision_msgs_IMAGE_HPP_ 00011 #define mm_vision_msgs_IMAGE_HPP_ 00012 00013 /***************************************************************************** 00014 ** Includes 00015 *****************************************************************************/ 00016 00017 //#include <ecl/utilities/parameters.hpp> 00018 #include <ecl/time/timestamp.hpp> 00019 #include <mm_messages/message.hpp> 00020 #include <memory> 00021 #include <string> 00022 #include <vector> 00023 00024 /***************************************************************************** 00025 ** Namespaces 00026 *****************************************************************************/ 00027 00028 namespace mm_vision_msgs { 00029 00037 enum ImageType { 00038 QVGA, 00039 CQVGA, 00040 VGA, 00041 CVGA, 00042 }; 00043 00044 std::string imageType2String(const ImageType& image_type); 00045 00046 /***************************************************************************** 00047 ** Image Definitions 00048 *****************************************************************************/ 00055 struct Image { 00056 Image() {} 00057 std::vector<unsigned char> data; 00058 bool colour; 00059 unsigned int width, height, size; // calculate from incoming buffer sizes 00060 // use this as a semantic identifer for this image - doesn't need to be defined 00061 // here, use your own id/enum list to identify it within your programs. 00062 unsigned int semantic_id; 00063 ecl::TimeStamp timestamp; 00064 }; 00065 00066 typedef std::shared_ptr<Image> ImagePtr; 00067 00068 } // namespace mm_vision_msgs 00069 00070 /***************************************************************************** 00071 ** Namespaces 00072 *****************************************************************************/ 00073 00074 namespace mm_messages { 00075 00076 /***************************************************************************** 00077 ** Serialisation 00078 *****************************************************************************/ 00079 00080 template<> 00081 struct Message<mm_vision_msgs::ImagePtr> { 00082 static void encode(const mm_vision_msgs::ImagePtr& s, ByteArray& buffer); 00083 static mm_vision_msgs::ImagePtr decode(const unsigned char* buffer, const unsigned int& size); 00084 }; 00085 00086 } // namespace mm_messages 00087 00088 #endif /* mm_vision_msgs_IMAGE_HPP_ */