0
$\begingroup$

Rosanswers logo

I am working on ubuntu platform and I have an ueye usb camera. Using ueye_api I have managed to write a .cpp program which captures a frame and stores it in a memory space allocated according to image size and bit depth. The program returns pointer to this memory space (say ppcImgMem) and it is of char type. ppcImgMem is a single array with ppcImgMem[0] corresponding to the pixel value of the first image pixel in unsigned format.

Now, I want to publish this image as sensor message (sensor_msgs) using image_transport. I have created a package which successfully does the same for frames captured by my webcam using gscam driver. But I do not have a driver for the ueye usb cam. I also tried to publish the array as a standard message and it is working but I think it would be better if I can publish it as sensor_msgs/Image form for further processing. Can somebody tell me how can I proceed from here onwards ?

-Abhinav


Originally posted by abhinav on ROS Answers with karma: 141 on 2011-09-13

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The easiest way to do this is to load your image data into a CvMat, and use cv_bridge to convert that to a sensor_msgs/Image, which can then easily be published using image_transport.


Originally posted by Dan Lazewatsky with karma: 9115 on 2011-09-14

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by abhinav on 2011-09-14:
Regarding loading image data into CvMat, since I have image data in vector form I think I have two options : 1) I can create a 1D CvMat and reshape it after loading data into it, OR 2) I can create a 2D CvMat and load my image data using a for loop. Can you tell me which one looks better to you ?

Comment by abhinav on 2011-09-14:
But I still have some doubts regarding header information of sensor_msgs/Image which I think can extract using some functions from ueye_api but they are not part of image vector for which I have the pointer. Is this header information mandatory or can it be skipped ?

Comment by abhinav on 2011-09-14:
yes, I agree with you. Yesterday after going through some more tutorials from ros and opencv I reached the same conclusion. But thanks for reply now I am confident that I am on right track.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.