Regarding Publishing Kinect Depth Image
Hi All,
I have kinect Depth image as mentioned below. I am trying to publish this from my node. I am having problem in converting my image to buffer which is needed to send it as a message. Please find below my code. I would be glad if somecan guide where I am doing a mistake.
///////////////////////////---code--////////////////////////////////////////////////
image_transport::Publisher publisher_depth = it.advertise("kinectcamera/depth", 1);
kinectDepthImage = cvCreateImage( cvSize(640,480),IPL_DEPTH_16U,1);
/*
here I store the image from Kinect
*/
cvShowImage("Depth", kinectDepthImage); // This shows me fine the image. I have no issue.
//Now I try to publish it i any of the two ways And this is where It fails.
cv::WImageBuffer_16u depthBufer(kinectDepthImage);
or
cv::WImageBuffer1_16u depthBufer(kinectDepthImage);
sensor_msgs::ImagePtr depth_msg = sensor_msgs::CvBridge::cvToImgMsg(depthBufer.Ipl(), "mono16");
publisher_depth.publish(depth_msg);
my error is " /opt/ros/fuerte/include/opencv2/core/wimage.hpp:243: cv::WImage<T>::WImage(IplImage*) [with T = short unsigned int, IplImage = _IplImage]: Assertion `!img || img->depth == Depth()' failed.
pass1Aborted (core dumped) "
Please help me with this.