Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion of Image's Colorspace? #27

Open
akashsara opened this issue Mar 26, 2021 · 3 comments
Open

Conversion of Image's Colorspace? #27

akashsara opened this issue Mar 26, 2021 · 3 comments

Comments

@akashsara
Copy link

Hi, I came across this while looking for a PyTorch implementation of SSIM. On the Tensorflow page for SSIM it's mentioned that "Note: The true SSIM is only defined on grayscale. This function does not perform any colorspace transform. (If the input is already YUV, then it will compute YUV SSIM average.)"

I was wondering if there are any conversions (either to YUV or to grayscale) that I would have to do to use this. My images are all RGB images.

@VainF
Copy link
Owner

VainF commented Mar 26, 2021

Hi @akashsara , the repo is consistent with tensorflow's ssim. So, it does not requires any conversions if RGB ssim is what you want.

@VainF
Copy link
Owner

VainF commented Mar 26, 2021

BTW, the benckmark in readme was based on RGB ssim/ms-ssim.

@akashsara
Copy link
Author

akashsara commented Mar 26, 2021

Hi @VainF, thank you for the response! Please correct me if I'm mistaken but my understanding of SSIM is that we should calculate it based on luminance. In the case of a YUV image we consider only the Y (luminance) channel and in the case of a grayscale image, we only have luminance to work with. If you are calculating SSIM separately for each channel and then taking the mean, then I think the results are slightly off since converting RGB to luminance follows a different formula (Ref: https://en.wikipedia.org/wiki/Relative_luminance)

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

No branches or pull requests

2 participants