Created
March 28, 2020 14:16
-
-
Save miki998/d6c57a56bd53171a92277954618498dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array_to_color(array, cmap="Oranges"): | |
s_m = plt.cm.ScalarMappable(cmap=cmap) | |
return s_m.to_rgba(array)[:,:-1] | |
def rgb_data_transform(data): | |
data_t = [] | |
for i in range(data.shape[0]): | |
data_t.append(array_to_color(data[i]).reshape(16, 16, 16, 3)) | |
return np.asarray(data_t, dtype=np.float32) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment