SSIM calculation for webp images

57 views
Skip to first unread message

Naseer Ahmad

unread,
Apr 3, 2015, 2:54:44 AM4/3/15
to webp-d...@webmproject.org
i  want to calculate ssim of output webp image as compared to original web image (got after applying any distortion on original webp image.Can anyone please give the pre-compiled .exe like available here --> C++ SSIM implementation available at http://mehdi.rabah.free.fr/SSIM/. but it donot work with webp images.
Thanks

Pascal Massimino

unread,
Apr 3, 2015, 8:56:10 AM4/3/15
to WebP Discussion
Hi,

On Fri, Apr 3, 2015 at 8:54 AM, Naseer Ahmad <nasee...@gmail.com> wrote:
i  want to calculate ssim of output webp image as compared to original web image (got after applying any distortion on original webp image.Can anyone please give the pre-compiled .exe like available here --> C++ SSIM implementation available at http://mehdi.rabah.free.fr/SSIM/. but it donot work with webp images.

.. but it should work with PNG input, thanks to cvLoadImage(). So, you can convert the webp images to PNG first,
simply using 'dwebp in.webp -o out.png' , or using ImageMagick's 'convert in.webp out.png' if you have a recent version.
(there are other ways to convert webp to png, of course).

hope it helps,
skal/

Naseer Ahmad

unread,
Apr 3, 2015, 10:51:10 AM4/3/15
to webp-d...@webmproject.org
you are right this option is available. But converting to png image will not fulfill the purpose.. as it will give similarity of two images of png format.  and i think results will be different when same will be calculated in webp format ? is it so?

Pascal Massimino

unread,
Apr 3, 2015, 11:43:29 AM4/3/15
to WebP Discussion
On Fri, Apr 3, 2015 at 4:51 PM, Naseer Ahmad <nasee...@gmail.com> wrote:
you are right this option is available. But converting to png image will not fulfill the purpose.. as it will give similarity of two images of png format.  and i think results will be different when same will be calculated in webp format ? is it so?

PNG is lossless in RGB colorspace. So you will be comparing the same RGB output than if it was decoded from WebP directly.
So you should be fine, unless you want to compute SSIM in YCbCr-colorspace, which is a different problem.



On Friday, April 3, 2015 at 5:56:10 PM UTC+5, skal wrote:
Hi,


On Fri, Apr 3, 2015 at 8:54 AM, Naseer Ahmad <nasee...@gmail.com> wrote:
i  want to calculate ssim of output webp image as compared to original web image (got after applying any distortion on original webp image.Can anyone please give the pre-compiled .exe like available here --> C++ SSIM implementation available at http://mehdi.rabah.free.fr/SSIM/. but it donot work with webp images.

.. but it should work with PNG input, thanks to cvLoadImage(). So, you can convert the webp images to PNG first,
simply using 'dwebp in.webp -o out.png' , or using ImageMagick's 'convert in.webp out.png' if you have a recent version.
(there are other ways to convert webp to png, of course).

hope it helps,
skal/

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To post to this group, send email to webp-d...@webmproject.org.
Visit this group at http://groups.google.com/a/webmproject.org/group/webp-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.

Naseer Ahmad

unread,
Apr 3, 2015, 12:02:01 PM4/3/15
to webp-d...@webmproject.org
i have distorted the Alpha component of webp image also in addition to  RGB...  even then the results will be same? actually in png when i distort the alpha component even slightly i.e changig alpha value from 255 to 252 or else png  give worst results.

Pascal Massimino

unread,
Apr 4, 2015, 12:03:33 PM4/4/15
to WebP Discussion
Hi,

On Fri, Apr 3, 2015 at 9:02 AM, Naseer Ahmad <nasee...@gmail.com> wrote:
i have distorted the Alpha component of webp image also in addition to  RGB...  even then the results will be same? actually in png when i distort the alpha component even slightly i.e changig alpha value from 255 to 252 or else png  give worst results.

On Friday, April 3, 2015 at 8:43:29 PM UTC+5, skal wrote:


On Fri, Apr 3, 2015 at 4:51 PM, Naseer Ahmad <nasee...@gmail.com> wrote:
you are right this option is available. But converting to png image will not fulfill the purpose.. as it will give similarity of two images of png format.  and i think results will be different when same will be calculated in webp format ? is it so?

PNG is lossless in RGB colorspace. So you will be comparing the same RGB output than if it was decoded from WebP directly.
So you should be fine, unless you want to compute SSIM in YCbCr-colorspace, which is a different problem.


Sorry for the confusion, i meant: PNG is lossless is ARGB colorspace. That includes alpha, yes.

skal/

Jyrki Alakuijala

unread,
Apr 7, 2015, 7:29:36 AM4/7/15
to webp-d...@webmproject.org
If you have distorted alpha in an RGBA and you want to have a psychovisual comparison of this, you will first have to blend your image on top of RGB images. This is because we cannot observe alpha direclty, only through RGB.

Since the impact depends on the target images that you blend your image on, you may need to try out multiple target images. If you want to be thorough, you could try all corners of the RGB color space, but it is probably reasonably good to just blend the RGBA image on top of a white RGB image and a RGB black image and compute SSIM separately for these two resulting RGB images (compared to images where you blended the original on top of the white and black RGB images). Average the two SSIMs you get in the end -- or take maximum if the worst case matters more.
Reply all
Reply to author
Forward
0 new messages