I’m trying to send to RVIZ the image captured from jetson-inference.
The problem is the format of the image.
RVIZ support RGB8 and the image who provide from the jetson-inference library offer FLOAT32 with 4 channels image.
I’m trying to use this code:
cv::Mat image = cv::Mat(camera->GetWidth(),camera->GetHeight(),CV_32FC4, imgRGBA);
cv::Mat imgrgb; cv::cvtColor(image,imgrgb, cv::COLOR_RGBA2BGR); header.seq = count; // user defined counter header.stamp = ros::Time::now(); // time img_bridge = cv_bridge::CvImage(header, sensor_msgs::image_encodings::BGR8, imgrgb); img_bridge.toImageMsg(img_msg); // from cv_bridge to sensor_msgs::Image