import numpy as np
import matplotlib.pyplot as plt
files = ### 100 portrait photos
imgs = [ plt.imread(f_i) for f_i in files ] # We read all file compositions into imgs
data = np.array(imgs) # Turn everything into np.array format
mean_imgs = np.mean(data, axis= 0) # Takes the mean of the entire data set
plt.imshow(mean_imgs) # imgs_mean = array of floats
Ergebnis: Warum bekomme ich eine Farbrauschkarte, wenn ich ein Array von Floats mit imshow() verwende, aber wenn ich uint8 verwende, bekomme ich das Bild, das ich will?
plt.imshow(mean_imgs.astype(np.uint8)) # Cast mean_imgs into type uint
Dies ist wohl eher eine Computer Vision Frage, sowieso versuche ich, den Unterschied zwischen imshow() ein Array mit allen Schwimmern zu verstehen und ein Array mit dem Typ uint8. Kann mir jemand freundlicherweise erklären, was im Backend zwischen diesen beiden Operationen passiert ist?
Bitte ignorieren Sie die Variablenmischung in den Bildern. Man denke nur an sie als eine gleiche Variable mit unterschiedlichem Typ.