up42 / image-similarity-measures

:chart_with_upwards_trend: Implementation of eight evaluation metrics to access the similarity between two images. The eight metrics are as follows: RMSE, PSNR, SSIM, ISSM, FSIM, SRE, SAM, and UIQ.
MIT License
550 stars 68 forks source link

Question: SSIM difference #26

Closed sinievanderben closed 3 years ago

sinievanderben commented 3 years ago

Hi there!

I had a quick question. The skimage.metrics also has a structural similarity index measure. If I apply yours and the one of skimage to the same image, I get different results. Do you might know why this is the case?

Kind regards!

sinievanderben commented 3 years ago

Maybe I have to mention that I tried to adjust the parameters of skimage ssim, such as data range, sigma, K1 and K2, gaussian weight, sample covariance etc.

markusuwe commented 3 years ago

Maybe I have to mention that I tried to adjust the parameters of skimage ssim, such as data range, sigma, K1 and K2, gaussian weight, sample covariance etc.

Hi. For SSIM we use the skimage implementation under the hood. See https://github.com/up42/image-similarity-measures/blob/master/image_similarity_measures/quality_metrics.py#L191 . So if there is any difference then it is caused by the parameters. As you can see in the code we set both data_range and multichannel.

sinievanderben commented 3 years ago

Thank you for the response! (: Is there a specific reason why max_p=4095 and therefore the datarange is 4095?

markusuwe commented 3 years ago

Thank you for the response! (: Is there a specific reason why max_p=4095 and therefore the datarange is 4095?

Radiance and reflectance is usually stored in 12 bit, 2**12 is 4096, so the value range is theoretically 0..4095