Cv2 Jupyter Notebook Matplotlib Inversé Couleurs Fix

from PIL import Image
import cv2 
from IPython.display import display

img = cv2.imread('image.png') # with the OpenCV function imread(), the order of colors is BGR (blue, green, red).

# In Pillow, the order of colors is assumed to be RGB (red, green, blue).
# As we are using Image.fromarray() of PIL module, we need to convert BGR to RGB.

img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # Converting BGR to RGB

display(Image.fromarray(img))
Thoughtful Toad