Skip to content

fix(python): align MSSIM with MATLAB implementation (#782) - #788

Open
Cid-oe wants to merge 2 commits into
CERN:masterfrom
Cid-oe:fix/782-mssim-matlab-compat
Open

Cid-oe wants to merge 2 commits into
CERN:masterfrom
Cid-oe:fix/782-mssim-matlab-compat

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 24, 2026

Copy link
Copy Markdown

Closes #782

Description

Aligns the Python MSSIM Measure_Quality code with its MATLAB counterpart (MSSIM.m) to ensure the metric correctly yields a maximum value of 1.0 for identical images.

  • Fixed stabilization term evaluation by parenthesizing (K1 * d) ** 2 and (K2 * d) ** 2 in denominators.
  • Changed K2 from 0.02 to 0.03.
  • Replaced std() with std(ddof=1) to apply N-1 normalization, matching MATLAB.

Siddharth U added 2 commits September 19, 2026 17:23
…d OS_* equivalents to remove code repetition
…ERN#782)

Corrects the Python MSSIM implementation to match MATLAB:
- Fixes parenthesis scoping in denominators: uses `(K1*d)**2` and `(K2*d)**2` instead of `K1*d**2` and `K2*d**2`
- Updates K2 constant from 0.02 to 0.03 to match MSSIM.m
- Applies ddof=1 to np.std() to use sample standard deviation as MATLAB does

Closes CERN#782

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python MSSIM in Measure_Quality does not match MATLAB's MSSIM.m

1 participant