Robotics StackExchange | Archived questions

Strange color cv_bridge

I subscribe to the topic camera/rgb/imageraw and convert the image taken to opencv, when I run cv2.imshow to show the image it shows the right color. But when I tried to converted the image using the following line the color becomes strange after I show it cv2.cvtColor(image,cv2.COLORRGB2BGR)

Asked by tsw on 2017-11-01 21:09:09 UTC

Comments

Doesn't opencv use BGR as default? If so then this convert wouldn't make sense in my opinion.

Asked by l4ncelot on 2017-11-02 02:05:48 UTC

I agree. If the image displays with the correct color first, why are you attempting to change it from what you know is right?

Asked by PeteBlackerThe3rd on 2019-02-18 04:11:45 UTC

Answers

Read part 2 (Converting ROS image messages to OpenCV images) in this tutorial: http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython Then change the encoding passthrough to a suitable encoding.

Asked by tungngo on 2019-02-18 03:13:10 UTC

Comments