Compare commits
	
		
			4 Commits
		
	
	
		
			3a4f774e28
			...
			a6ef3977dd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | a6ef3977dd | ||
|  | 8ca1972ddb | ||
|  | 817c016815 | ||
|  | 04e0de4d33 | 
| @@ -9,7 +9,7 @@ from tqdm import tqdm | ||||
| import csv | ||||
| import rawpy | ||||
|  | ||||
| imagesFolderPath = 'flat-field/nef' | ||||
| imagesFolderPath = '/mnt/HDD0/raise' | ||||
| imagesFolderPathFileName = imagesFolderPath.replace('/', '_') | ||||
| denoiser = 'wavelet' | ||||
| npArrayFilePath = f'mean_{imagesFolderPathFileName}_{denoiser}.npy' | ||||
| @@ -19,9 +19,9 @@ denoise = getattr(skimage.restoration, f'denoise_{denoiser}') | ||||
| mean = None | ||||
| numberOfImagesInMean = 0 | ||||
|  | ||||
| imagesFileNames = os.listdir(imagesFolderPath) | ||||
| imagesFileNames = os.listdir(imagesFolderPath + '/png') | ||||
|  | ||||
| requiresRaiseFiltering = False | ||||
| requiresRaiseFiltering = True | ||||
| if requiresRaiseFiltering: | ||||
|     files = {} | ||||
|  | ||||
| @@ -31,15 +31,17 @@ if requiresRaiseFiltering: | ||||
|             file = row['File'] + '.png' | ||||
|             files[file] = row | ||||
|  | ||||
|     imagesFileNames = [imageFileName for imageFileName in tqdm(imagesFileNames, 'Filtering images') if files[imageFileName]['Device'] == 'Nikon D7000' and Image.open(f'{imagesFolderPath}/{imageFileName}').size == (4946, 3278)] | ||||
|     imagesFileNames = [imageFileName for imageFileName in tqdm(imagesFileNames, 'Filtering images') if files[imageFileName]['Device'] == 'Nikon D7000' and Image.open(f'{imagesFolderPath}/png/{imageFileName}').size == (4946, 3278)] | ||||
| #imagesFileNames = [f'DSC0{imageIndex}.ARW' for imageIndex in range(2807, 2911)] | ||||
|  | ||||
| minColor = None | ||||
| maxColor = None | ||||
|  | ||||
| def treatImage(imageFileName, computeExtremes = False): | ||||
|     global mean, numberOfImagesInMean, minColor, maxColor | ||||
|     imageFilePath = f'{imagesFolderPath}/{imageFileName}' | ||||
|     if imageFileName.endswith('.NEF'): | ||||
|     imageFileName = imageFileName.replace('.png', '.NEF') | ||||
|     imageFilePath = f'{imagesFolderPath}/nef/{imageFileName}' | ||||
|     if imageFileName.endswith('.NEF') or imageFileName.endswith('.ARW'): | ||||
|         with rawpy.imread(imageFilePath) as raw: | ||||
|             colorDesc = raw.color_desc.decode('ascii') | ||||
|             assert colorDesc == 'RGBG' | ||||
| @@ -78,6 +80,11 @@ def treatImage(imageFileName, computeExtremes = False): | ||||
| for imageFileName in tqdm(imagesFileNames, 'Computing extremes of images'): | ||||
|     treatImage(imageFileName, computeExtremes = True) | ||||
|  | ||||
| # To skip this step next time. | ||||
| # Maybe thanks to `rawpy.RawPy` fields, possibly stating device maximal value, can avoid doing so to some extent. | ||||
| print(f'{minColor=}') | ||||
| print(f'{maxColor=}') | ||||
|  | ||||
| for imageFileName in tqdm(imagesFileNames, 'Denoising images'): | ||||
|     treatImage(imageFileName) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user