In the following code, I first convert the image to a Numpy array:
import numpy as np
from PIL import Image
sceneImage = Image.open('peppers.tif')
arrImage = np.array(sceneImage)
Now I define a new array and put in it arrImageaccording to the following code:
import matplotlib.pyplot as plt
final_image = np.zeros((N,N,3))
final_image[...,0] = arrImage[...,0]
final_image[...,1] = arrImage[...,1]
final_image[...,2] = arrImage[...,2]
plt.imshow(final_image)
plt.show()
In other words, I have a copy of the separately inserted components R, G and B (although this can be done much easier, I do it on purpose).
Now the problem is that fianl_imagethey arrImagedo not display the same image for me. The forms are as follows:
arrImage:

final_image:

What is the problem that these 2 are not the same?
source
share