Updated Tutorial PSNR for identical images

This commit is contained in:
D00E
2025-10-02 00:03:28 +01:00
parent e9bded6ff3
commit acc76304d5
3 changed files with 24 additions and 27 deletions

View File

@@ -16,7 +16,7 @@ def getPSNR(I1, I2):
s1 = s1 * s1 # |I1 - I2|^2
sse = s1.sum() # sum elements per channel
if sse <= 1e-10: # sum channels
return 0 # for small values return zero
return 360 # For very small SSE, return 360 to cap PSNR (theoretical value is infinity)
else:
shape = I1.shape
mse = 1.0 * sse / (shape[0] * shape[1] * shape[2])