Skip to content
Snippets Groups Projects
Commit 137a5d40 authored by Mathieu Westphal (Kitware)'s avatar Mathieu Westphal (Kitware) :zap:
Browse files

ImageSSIM: Fix a rounding error in SSIM computation

parent f5c87446
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,9 @@ struct SSIMWorker
double c2 = C[dim][1];
// Computing SSIM
double ssim = (2 * mean1 * mean2 + c1) * (2 * covar + c2) /
// The order of computation matters for 2 * (mean1 * mean2) in order to reduce rounding
// error
double ssim = (2 * (mean1 * mean2) + c1) * (2 * covar + c2) /
((mean1 * mean1 + mean2 * mean2 + c1) * (var1 + var2 + c2));
// Clamping negative values if requested
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment