ros-perception / image_transport_plugins

A set of plugins for publishing and subscribing to sensor_msgs/Image topics in representations other than raw pixel data.
BSD 3-Clause "New" or "Revised" License
58 stars 119 forks source link

Problem to use the image transport compressed plugin #121

Closed Cavalletta98 closed 1 year ago

Cavalletta98 commented 1 year ago

Hi, i'm trying to compres an image publish on a topic but i'm getting this error when i run this command rosrun image_transport republish raw in:=/webcam/image_raw compressed out:=/webcam/image_compressed:

[ERROR] [1671541709.318842973]: OpenCV(4.6.0-dev) /home/pi/opencv/opencv/modules/imgcodecs/src/loadsave.cpp:1145: error: (-2:Unspecified error) in function 'bool cv::imencode(const String&, cv::InputArray, std::vector&, const std::vector&)'

Encoding 'params' must be key-value pairs: '(params.size() & 1) == 0' where 'params.size()' is 9

Can someone please help me?

peci1 commented 1 year ago

You're probably using a custom-built OpenCV version that is too new for this package. Please, use the version of OpenCV distributed by your operating system (you can build it yourself to get better optimizations, but it should be the same version as the one provided by the OS).

Cavalletta98 commented 1 year ago

Yes i did as you suggested. Thanks