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

The array members in messages are std::vectors. I suspect your image data is a pointer to a buffer, and you can't assign from a pointer into a std::vector; you'll have to copy the data manually. (This is what the 'no viable overload' message is trying to tell you)

Something like this might work:

const int image_size = pFrameData->height * pFrameData->width;
leftImage.data.reserve(image_size);
for( int i=0; i < image_size; i++ ) {
    leftImage.data.push_back(pFrameData->leftData[i]); // do pixel format translation here if necessary
}

Of course, this assumes that your image buffer is in the same format as the output image. If it isn't, you'll have to do some sort of conversion.