You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a suggestion of a test case: perform intensity rescaling of one image to match the intensity distribution of another image, by linear rescaling. This can be done by simple explicit minimisation of the mean square error, which leads to this expression:
def linear_intensity_matching(imA: np.ndarray, imB: np.ndarray) -> np.ndarray:
"""
Perform a linear intensity match between 2 images so that they are in
the same intensity range, assuming: imB ~ slope*imA + intercept
Arguments:
- imA: first image, the one that will be adjusted
- imB: the second image, the one that sets the range to match
Output:
- a rescaled version of imA such that
"""
meanA = imA.mean()
meanB = imB.mean()
meanAB = (imA*imB).mean()
meanA2 = (imA**2).mean()
slope = (meanAB-meanA*meanB)/(meanA2-meanA*meanB)
intercept = meanB - slope*meanA
return slope*imA+intercept
The use case for instance is to compare images through MSE afterwards once they're intensity matched, or applying other metrics to compare similarity.
The text was updated successfully, but these errors were encountered:
Romain-Laine
changed the title
Potential test case: Linear intensity mathing
Potential test case: Linear intensity matching
Nov 29, 2024
Here's a suggestion of a test case: perform intensity rescaling of one image to match the intensity distribution of another image, by linear rescaling. This can be done by simple explicit minimisation of the mean square error, which leads to this expression:
The use case for instance is to compare images through MSE afterwards once they're intensity matched, or applying other metrics to compare similarity.
The text was updated successfully, but these errors were encountered: