how can I write the image.h in my own data type
I want to publish an image and some other info , to ensure data sync. So I create mydata.msg
like this
sensor_msgs/Image my_img
float64 x
float64 y
float64 z
How can I set the data of my_img?
my_package::my_data my_img_info;
my_img_info.my_img.data = ?
maybe I should write data to my_img.data, but I dont know how to write it. so are there any tutorials that can help me? Or other methods can ensure that images and data are one-to-one? Thanks.
Asked by wangxy on 2020-10-11 06:32:04 UTC
Comments
Since data is a one-dimensional array of uint8, for example, if we had the 2-dimensional image data original_img[height][width], we could copy it with the following
Asked by miura on 2020-10-12 08:50:31 UTC
Thanks for your answer I have another question,if I want to read image with subscriber,Should I also use a two-dimensional loop to store image as a cv::Mat?
Asked by wangxy on 2020-10-15 23:34:10 UTC
I'm glad I was able to help you. If you have a new question, you should create a new question page. If it is something that can be answered, we will respond to it.
Asked by miura on 2020-10-16 06:48:28 UTC