Unrecognized image encoding [nv12]
I am very new to depthai and am trying to interface the OAK1 camera.
For now, I want to publish the video stream on a particular topic which I was able to do by remapping it in the rgb_publisher .launch in the depthai_example package. However, when I try to view the stream using rqt_image_view it throws the following error:
ImageView.callback_image() while trying to convert image from 'nv12' to 'rgb8' an exception was thrown (Unrecognized image encoding [nv12])
How do I convert the nv12 image frame into something that rqt will understand?
Any help would be appreciated.
Can anyone help?
Sorry about the delay. I don't personally know on this one. I will need @saching13 's help. Will ask him offline.
Hey @VineetTambe , Sorry for the delay. I missed this one.
So device sends out the rgb image stream as NV12 format and to allow the idea of being able to record the rosbag and feed it back to the device I left it to be published as NV12 format.
But I am working on the new update to make it to rgb8 and make it optional and have user input the encoding when want to feedback.
I Will add an update by tomorrow
Hi @saching13, how is the update going?
For now, I used part of the function daiUtility::rosImageBridge() in the depthai-ros-examples github to convert the image to a usable rgb image.
cv::Mat nv_frame(inData->getHeight() * 3 / 2, inData->getWidth(), CV_8UC1, inData->getData().data());
cv::Mat rgb(inData->getHeight(), inData->getWidth(), CV_8UC3);
cv::cvtColor(nv_frame, rgb, cv::COLOR_YUV2BGR_NV12);
cv_bridge::CvImage cvRgbImg(imgHeader, sensor_msgs::image_encodings::BGR8, rgb);
cvRgbImg.toImageMsg(outImageMsg);
Might be useful for other people that come across this issue.
This issue is fixed on ROS1. don't need to do this. Will get back to you when the merge update is ready.
Hi @saching13 ,
I see, i was using ros2, for which is what not the case, but it looks all clean in ros1 indeed! also just now discovered the noetic-foxy-integrate-wip branch which looks nice!
Closing due to inactivity, if you think this should remain open, please tag me in a comment here.