Closed Yadunund closed 1 year ago
@Yadunund thanks for raising an issue and the PR too. Could you create an issue as an alternative to a todo comment. The changes itself look good.
Thanks for the quick review. I've removed the todo comment and opened this ticket instead https://github.com/ros-perception/vision_opencv/issues/506
Thanks for the contribution!
Fixes #504
The implementation here relies on using an
std::optional<std::string> encoding_override
argument which can be supplied during instantiation ofROSCVMatContainer
. If provided, the value will be used, else default to the existing behavior of inferring the encoding fromcv::Mat::type()
. In order to usestd::optional
, I also had to bump the C++ version to C++17.Also it looks like
ROSCvMatContainer::get_sensor_msgs_msg_image_copy()
has duplicate code fromconvert_to_ros_message()
. I've left a TODO to explore reusing the latter within this function. Happy to implement it if the change is acceptable.Signed-off-by: Yadunund yadunund@openrobotics.org