Skip to content

Instantly share code, notes, and snippets.

@f0ti
Created December 21, 2020 21:25
Show Gist options
  • Save f0ti/2dd766b4a39f30cd7af78b235dde534b to your computer and use it in GitHub Desktop.
Save f0ti/2dd766b4a39f30cd7af78b235dde534b to your computer and use it in GitHub Desktop.
RGB2BGR, BGR2RGB
import cv2
import numpy as np
from PIL import Image
def RGB2BGR(image):
return cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
def BGR2RGB(image):
return Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment