I\'m trying to display a PNG file using matplotlib and of course, python. For this test, I\'ve generated the following image:
It appears that you may somehow have RGB
switched with BGR
. Notice that your greens are retained but all the blues turned to red. If cube
has shape (M,N,3), try swapping cube[:,:,0]
with cube[:,:,2]
. You can do that with numpy
like so:
rgb = numpy.fliplr(cube.reshape(-1,3)).reshape(cube.shape)
From the OpenCV documentation:
Note: In the case of color images, the decoded images will have the channels stored in B G R order.