src/k4a_ros_device.cpp
// Helper function that renders any BGRA K4A frame to a ROS ImagePtr. Useful for rendering intermediary frames
// during debugging of image processing functions
Helper function that renders any BGRA K4A frame to a ROS ImagePtr. Useful for rendering intermediary frames
during debugging of image processing functions
Helper function that renders any BGRA K4A frame to a ROS ImagePtr . Useful for rendering intermediary frames during debugging of image processing functions
k4a_result_t K4AROSDevice::renderBGRA32ToROS(sensor_msgs::ImagePtr& rgb_image, k4a::image& k4a_bgra_frame)
{
  cv::Mat rgb_buffer_mat(k4a_bgra_frame.get_height_pixels(), k4a_bgra_frame.get_width_pixels(), CV_8UC4,
                         k4a_bgra_frame.get_buffer());
  rgb_image = cv_bridge::CvImage(std_msgs::Header(), sensor_msgs::image_encodings::BGRA8, rgb_buffer_mat).toImageMsg();
  return K4A_RESULT_SUCCEEDED;
}
k4a_result_t K4AROSDevice :: renderBGRA32ToROS ( sensor_msgs :: ImagePtr & rgb_image , k4a :: image & k4a_bgra_frame ) { cv :: Mat rgb_buffer_mat ( k4a_bgra_frame . get_height_pixels ( ) , k4a_bgra_frame . get_width_pixels ( ) , CV_8UC4 , k4a_bgra_frame . get_buffer ( ) ) ; rgb_image = cv_bridge :: CvImage ( std_msgs :: Header ( ) , sensor_msgs :: image_encodings :: BGRA8 , rgb_buffer_mat ) . toImageMsg ( ) ; return K4A_RESULT_SUCCEEDED ; }
Helper function that renders any BGRA K4A frame to a ROS ImagePtr.
Helper function that renders any BGRA K4A frame to a ROS ImagePtr .