Destination encoding for ros image to opencv image conversion [closed]
I am trying to create an OpenCV image from a ros image using this . I am subscribing to a topic /camera/depth/img_rect_color
which is of the type sensor_msgs/Image
with 32FC1
encoding. How do I specify destination encoding in the following line:
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::32FC1);
If I specify 32FC1
, it gives the error :
error: invalid suffix "FC1" on integer constant
cv_ptr = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::32FC1);
^
/home/ubuntu/tst_ws/src/roscv_conv/src/roscv_conv_node.cpp: In member function 'void ImageConverter::imageCb(const ImageConstPtr&)':
/home/ubuntu/tst_ws/src/roscv_conv/src/roscv_conv_node.cpp:39:71: error: expected unqualified-id before numeric constant
How can I rectify this?