#66: Add Distance Enum to choose between ROOT_MEAN_SQUARE and PEARSON_CORRELATION

This commit is contained in:
2024-05-15 19:51:30 +02:00
parent 7ed6ff5adb
commit 6a9900df91
3 changed files with 56 additions and 21 deletions

View File

@@ -33,6 +33,19 @@ class Denoiser(Enum):
def __str__(self):
return self.name.lower()
class Distance(Enum)
ROOT_MEAN_SQUARE = auto()
PEARSON_CORRELATION = auto()
def __str__(self):
return self.name.lower()
def getEndUserName(self):
return self.name.replace('_', '').title()
def getPearsonCorrelation(firstImage, secondImage):
return abs(scipy.stats.pearsonr(firstImage.flatten(), secondImage.flatten()).statistic - 1)
# Source: https://stackoverflow.com/a/43346070
def getGaussianKernel(size, sigma):
axis = np.linspace(-(size - 1) / 2., (size - 1) / 2., size)