Created
July 13, 2022 03:30
-
-
Save 338rajesh/05f407695b9ed51b400799fd8ea08992 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
import numpy as np | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
import os | |
num_chunks = 6 | |
img_size = (64, 64) | |
container_ID = "CIRCLES_VF10_RS10_R5" | |
cfd = os.path.dirname(__vsc_ipynb_file__) | |
container_dir = os.path.join(cfd, "containers", "rve", f"container_{container_ID}") | |
channel_ID = "GS" | |
if channel_ID=="BS": | |
immode="1" | |
elif channel_ID=="GS": | |
immode="L" | |
else: | |
raise Warning() | |
images = [] | |
for i in range(num_chunks): | |
chunk_dir = os.path.join(container_dir, f"images_{channel_ID}", f"chunk{i+1}") | |
for aimg_name in os.listdir(chunk_dir): | |
aimg = np.asarray(Image.open(os.path.join(chunk_dir, aimg_name)).resize(size=img_size, resample=Image.Resampling.BICUBIC)) # .convert(mode="L") | |
images.append(aimg) | |
images = np.array(images) | |
np.savez_compressed( | |
os.path.join(container_dir, f"rves_{img_size[0]}x{img_size[1]}_{channel_ID}_{container_ID}_data_{len(images)}.npz"), | |
images = images, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment