opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
79.09k stars 55.83k forks source link

IMREAD_LOAD_GDAL produces images with RGB band order #9809

Open voinSR opened 7 years ago

voinSR commented 7 years ago

System information (version)

Detailed description

Hello, when reading color raster image using GDAL (IMREAD_LOAD_GDAL flag), the band order is RGB, which is reversed from opencv standart one -> BGR. This is not a big problem, but still challenging when I want to save image after some manipulation/or overlay something on it and then write it using imwrite.

Steps to reproduce

just open any image with IMREAD_LOAD_GDAL flag - imread(file, IMREAD_LOAD_GDAL).

Thank you

sturkmen72 commented 7 years ago
image = imread( imageName, IMREAD_LOAD_GDAL ); // Read the file
cvtColor(image, image, COLOR_RGB2BGR); // convert it to BGR