I’m trying to display a PNG file using matplotlib and of course, python. For this test, I’ve generated the following image:

Now, I load and transform the image into a multidimensional numpy matrix:
import numpy as np
import cv2
from matplotlib import pyplot as plt
cube = cv2.imread('Graphics/Display.png')
plt.imshow(cube)
plt.ion()
When I try to plot that image in matplotlib, the colors are inverted:
If the matrix does not have any modifications, why the colors in the plot are wrong?
Thanks in advance.
It appears that you may somehow have
RGBswitched withBGR. Notice that your greens are retained but all the blues turned to red. Ifcubehas shape (M,N,3), try swappingcube[:,:,0]withcube[:,:,2]. You can do that withnumpylike so:From the OpenCV documentation: