diff --git a/datasets/raise/find_consecutive_most_similar_images.py b/datasets/raise/find_consecutive_most_similar_images.py old mode 100644 new mode 100755 index 0f312fc..7b6ad15 --- a/datasets/raise/find_consecutive_most_similar_images.py +++ b/datasets/raise/find_consecutive_most_similar_images.py @@ -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}') \ No newline at end of file +print(f'{extremeCorrelationFile} (and previous file) have the lowest correlation with a correlation of {extremeCorrelation}') \ No newline at end of file