ros-perception / vision_opencv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ROSCvMatContainer assumes encoding string for cv::Mat type CV_8UC3

Yadunund opened this issue · comments

commented

The implementation of convert_to_ros_message sets the encoding string to bgr8 if the cv::Mat is of type CV_8UC3. But in reality the same type, ie 8bit 3 channel, could also be used for rgb8 encodings.

This is acknowledged in encoding2mat_type(..) where both bgr8 and rgb8 return type CV_8UC3.

When implementing camera drivers using this type adapter, the choice of encoding should be left to the user. The auto-inference of the encoding based on cv::Mat type is useful but having an override in the ROSCvMatContainer API would be ideal.