Support lowest correlation in find_consecutive_most_similar_images.py
This commit is contained in:
parent
7f7e78cafb
commit
fbd7cb01e1
15
datasets/raise/find_consecutive_most_similar_images.py
Normal file → Executable file
15
datasets/raise/find_consecutive_most_similar_images.py
Normal file → Executable file
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
from utils import getColorChannel, Color, mergeSingleColorChannelImagesAccordingToBayerFilter, isARawImage
|
||||
from tqdm import tqdm
|
||||
@ -22,8 +24,9 @@ def crop(image, yRange, xRange):
|
||||
lastMergedSingleColorChannelImage = None
|
||||
lastCorrelation = None
|
||||
|
||||
highestCorrelation = None
|
||||
highestCorrelationFile = None
|
||||
# Supports both highest and lowest.
|
||||
extremeCorrelation = None
|
||||
extremeCorrelationFile = None
|
||||
|
||||
files = [file for file in sorted(os.listdir(folder)) if isARawImage(file)]
|
||||
|
||||
@ -36,10 +39,10 @@ for file in tqdm(files, 'File'):
|
||||
mergedSingleColorChannelImage = mergeSingleColorChannelImagesAccordingToBayerFilter(colorChannels)
|
||||
if lastMergedSingleColorChannelImage is not None:
|
||||
correlation = corr(mergedSingleColorChannelImage, lastMergedSingleColorChannelImage)
|
||||
if highestCorrelation is None or correlation > highestCorrelation:
|
||||
highestCorrelation = correlation
|
||||
highestCorrelationFile = file
|
||||
if extremeCorrelation is None or correlation < extremeCorrelation:
|
||||
extremeCorrelation = correlation
|
||||
extremeCorrelationFile = file
|
||||
|
||||
lastMergedSingleColorChannelImage = mergedSingleColorChannelImage
|
||||
|
||||
print(f'{highestCorrelationFile} (and previous file) have the highest correlation with a correlation of {highestCorrelation}')
|
||||
print(f'{extremeCorrelationFile} (and previous file) have the lowest correlation with a correlation of {extremeCorrelation}')
|
Loading…
x
Reference in New Issue
Block a user