ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
disparity_view expects disparities to have type float
, so you'll need to convert your uint8_t
disparity values. In your DisparityImage
message, resize image.data
to width * size * sizeof(float)
, and get a float pointer to your data buffer: float* ptr = reinterpret_cast<float*>(&image.data[0])
. Then copy the disparities over one by one. You may need to scale the uint8_t
disparities down by some factor if the custom SDK does sub-pixel correspondence like OpenCV's block matcher. The float
disparities are in pixels. Don't forget to set image.encoding = sensor_msgs::image_encodings::TYPE_32FC1
.