vision_opencv
vision_opencv copied to clipboard
error in cv_bridge_nosetests
Issue: I am trying to migrate from ros kinetic to melodic. I compiled the vision_opencv since I am using a gpu-enabled version of opencv for my code. The vision_opencv tests runs ok in kinetic but when I migrated to melodic, an error occurs in the cv_bridge_nosetests. I am using the same opencv version for both kinetic and melodic version and the code is the same. Can anyone please point me to any solution for the following error:
My system config: (inside docker container) Ubuntu 18.04 ROS melodic gcc 7.4.0 OpenCV 3.4.7
Error log:
$ catkin_make run_tests_cv_bridge_nosetests
...
======================================================================
ERROR: test_encode_decode_cv2_compressed (conversions.TestConversions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/od-automower/base/src/vision_opencv/cv_bridge/test/conversions.py", line 66, in test_encode_decode_cv2_compressed
compress_rosmsg = cvb_en.cv2_to_compressed_imgmsg(original, f)
File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 219, in cv2_to_compressed_imgmsg
cmprs_img_msg.data = np.array(cv2.imencode(ext_format, cvim)[1]).tostring()
error: OpenCV(3.4.7) /root/opencv-3.4.7/modules/imgcodecs/src/grfmt_pxm.cpp:431: error: (-5:Bad argument) Portable bitmap(.ppm) expects BGR image in function 'write'
----------------------------------------------------------------------
Ran 4 tests in 3.543s
FAILED (errors=1)