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
549 stars 68 forks source link

Fixed a bug in which gray images cause crash #32

Closed CallShaul closed 1 year ago

CallShaul commented 2 years ago

Now functions support 2 dimensions gray images, not only 3 dimensions color images.

nekhtiari commented 2 years ago

Nice, LGTM

chrieke commented 1 year ago

Hey @CallShaul, thank you for the PR and sorry about the longer inactivity.

Wouldn't this also need to be applied on the second image?

CallShaul commented 1 year ago

@chrieke Hi, I'm not sure what you mean by "second image".

nikooc2s commented 1 year ago

@chrieke Hi, I'm not sure what you mean by "second image".

I think he meant the predicted one. Your changes are only for original image.

CallShaul commented 1 year ago

@nikooc2s @chrieke No, there is no need to do anything else, using the expand_dims this way, adds a third dimension with size 1, so the argument in the for loop org_img.shape[2] will not fail, yet the number of iterations will be 1 in the case of a gray image. (image size will change from [row, col] to [row, col, 1])