Created
December 21, 2020 21:25
-
-
Save f0ti/2dd766b4a39f30cd7af78b235dde534b to your computer and use it in GitHub Desktop.
RGB2BGR, BGR2RGB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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