Add and use isARawImage

This commit is contained in:
2024-04-27 21:46:40 +02:00
parent a0fc38d023
commit b50f013234
2 changed files with 12 additions and 4 deletions

View File

@@ -38,7 +38,12 @@ class iterativeMean:
self.mean = ((self.mean * self.numberOfElementsInMean) + element) / (self.numberOfElementsInMean + 1)
self.numberOfElementsInMean += 1
def getRawColorChannel(raw):
RAW_IMAGE_FILE_EXTENSIONS = [
'arw',
'nef',
]
def getRawColorChannel(raw, color):
colorDesc = raw.color_desc.decode('ascii')
assert colorDesc == 'RGBG'
assert np.array_equal(raw.raw_pattern, np.array([[0, 1], [3, 2]], dtype = np.uint8))
@@ -61,4 +66,7 @@ def getRawColorChannel(raw):
imageNpArray = greenBottomRawImageVisible
case Color.BLUE:
imageNpArray = blueRawImageVisible
return imageNpArray
return imageNpArray
def isARawImage(imageFilePath):
return any([imageFileName.lower().endswith(f'.{rawImageFileExtension}') for rawImageFileExtension in RAW_IMAGE_FILE_EXTENSIONS])