OpenCV how to import RGB image

How to write an image RGBusing a function cv::imwrite()? So far, all my attempts have led to the writing of an image BGR.

My matrix object is this cv::Mat.

+5
source share
1 answer

The function cv::imwrite()correctly writes the image file if the input cv::Matis in BGR order (this is so if you allow OpenCV to create it). If you created the image yourself, you need to first convert the color order, for example, by calling bamboove cv::cvtColor(in, out, CV_RGB2BGR);if you created the RGB image.

(Pay attention to the color conversion code, it is slightly different from bamboo.)

+10
source

All Articles