I am trying to read images in a folder and save them after doing some processes.
I using following code to save my images:
import cv2
i = 0
while i < len(bright_images):
cv2.imwrite(f'/path/image_{i}.png', cv2.cvtColor(bright_images[i],cv2.COLOR_BGR2RGB)
i += 1
But the problem is that when writing images all red colors in my images turn to be blue, colors change completely, it seems as if it saves based on BGR color instead of RGB.
How do I fix this issue?
FYI, I am reading images using this code:
def load_images(path):
image_list=[]
images= glob.glob(path)
images = natsorted(images)
for index in range(len(images)):
image= cv2.cvtColor(cv2.imread(images[index]),cv2.COLOR_BGR2RGB)
image_list.append(cv2.resize(image,(1920,1080)))
return image_list