ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you very much for the response. I found a much simpler way to do it though. I just converted the array into a matrix and then published the matrix like this:

Mat matrixarray = Mat(11,20,CV_32FC1,deptharray); diff.PubDepthArray(matrixarray);

Thank you very much for the response. I found a much simpler way to do it though. I just converted the array into a matrix and then published the matrix like this:

Mat matrixarray = Mat(11,20,CV_32FC1,deptharray); Mat(11,20,CV_32FC1,deptharray);

diff.PubDepthArray(matrixarray);

where the method to publish the array looks like this:

void GetDiffImg::PubDepthArray(Mat depthArray){

cv_bridge::CvImage diffImgMsg;
diffImgMsg.encoding  = sensor_msgs::image_encodings::TYPE_32FC1;
diffImgMsg.image    = depthArray;

depthArrayPub.publish(diffImgMsg.toImageMsg());

Thank you very much for the response. I found a much simpler way to do it though. I just converted the array into a matrix and then published the matrix like this:

Mat matrixarray = Mat(11,20,CV_32FC1,deptharray);

Mat(11,20,CV_32FC1,deptharray);

diff.PubDepthArray(matrixarray);

diff.PubDepthArray(matrixarray);

where the method to publish the array looks like this:

void GetDiffImg::PubDepthArray(Mat depthArray){

depthArray){
 cv_bridge::CvImage diffImgMsg;
 diffImgMsg.encoding  = sensor_msgs::image_encodings::TYPE_32FC1;
 diffImgMsg.image    = depthArray;

 depthArrayPub.publish(diffImgMsg.toImageMsg());