ros-perception / vision_opencv

Apache License 2.0
536 stars 599 forks source link

Support for passing parameters to cv::imencode through "toCompressedImageMsg" function. #521

Open emrekuru97 opened 4 months ago

emrekuru97 commented 4 months ago

Support for passing parameters to cv::imencode through toCompressedImageMsg function, i need this functionality so that the compression quality can be passed through toCompressedImageMsg function, other pepople can pass other options too. Tried to keep current functionality and generated possible other signatures for the function toCompressedImageMsg. Could not find a formatter in the repo so did not formatting, the default ros formatter changed a lot so i let it.

emrekuru97 commented 4 months ago

Hello again, How should i proceed? With swapping(support for passing cv::imencode params without explicitly specifying dst_format) or without? Best regards

ijnek commented 3 months ago

Hey @emrekuru97, thanks for opening this PR, and thanks for reviewing @christianrauch!

Despite the method "toCompressedImageMsg" existing in this package, moving forward, I don't think we should be extending cv_bridge's capability to compress images. cv_bridge's responsibility is to convert ROS Image msg <-> OpenCV image.

The thing that immediately came to mind when I read this was the compressed transport plugin, which is used to transport compressed image messages over a topic. In that plugin, the conversion takes place, and then the compression is called afterwards. Would this work for your use case? (or could you just use the compressed publisher?