cv_bridge exception Image is wrongly formed
Hi all, I am using OpenCV to do Aruco detection. I can successfully get everything working using BGR8, but wanted to change to MONO8 to improve performance. However, Nvvidconv uses Gray8 instead, but it seems to launch correctly, but throws an error related to the number of channels.
I am launching my camera node with the following line of code:
file: "nvarguscamerasrc sensor-id=2 ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=(string)GRAY8 ! nvvidconv ! appsink"
This correctly launches, but my Aruco action server is throwing an error here (added a fun print message to make sure I knew where it is):
cv_bridge::CvImagePtr imageHolder;
try {
imageHolder = cv_bridge::toCvCopy(goal->image, sensor_msgs::image_encodings::MONO8);
}
catch (cv_bridge::Exception& e) {
ROS_ERROR("I HATE ROBOTS cv_bridge exception: %s", e.what());
The error says the Image is wrongly formed: step < width * byte_depth * num_channels or 1920 != 1920 *1 * 3.
I am setting the encoding to Mono8 though, which should only have one channel though, so why is my num_channels 3?
Any tips to solve this absolutely maddening issue would be helpful.
Aruco Action Server: https://github.com/TrickfireRobotics/...
Launch File: https://github.com/TrickfireRobotics/... return; }