Load lazily images (#62)

This commit is contained in:
Benjamin Loison
2024-05-13 20:06:47 +02:00
parent 10f8766793
commit ce64450101
2 changed files with 14 additions and 11 deletions

View File

@@ -90,11 +90,9 @@ def isARawImage(imageFilePath):
def getColorChannel(imageFilePath, color):
if isARawImage(imageFilePath):
numpyFilePath = f'{imageFilePath}.npy'
numpyFilePath = f'{imageFilePath}.{color}.npy'
if os.path.isfile(numpyFilePath):
imageNpArray = np.load(numpyFilePath, allow_pickle = True).item()#[color]
print(imageNpArray)
#exit(1)
imageNpArray = np.load(numpyFilePath)
else:
with rawpy.imread(imageFilePath) as raw:
imageNpArray = getRawColorChannel(raw, color)