C++ version of SSIM is available at https://github.com/utlive/ConsoleSSIM.git . Notice that to build this code by Visual Studio you need to install MFC.

The code was developed by Laboratory for Image and Video Engineering at the University of Texas at Austin (a trustful source)

The exe-file (conSSIM.exe) accepts only jpg-files are input (an annoying restriction).  

 

In the Python module ‘skimage.metrics‘ there is a function ‘structural_similarity‘ which computes SSIM (sliding window size is configurable as well as other parameters). 

I wrote a script GetSSIM.py which reads reference and distorted yuv sequences frame after frame, converts each frame to gray and computes the SSIM score (with default parameters) per frame. Finally the average SSIM score over all frames and 5% percentile are printed.

Usage of GetSSIM.py:

  –ref                  reference input yuv-file (yuv420p)

  –dist                distorted input yuv-file (yuv420p)

  –width            width

  –height            height

  -n                     number of frames to process, if 0 the whole sequence  (default 0)

  -v                     print SSIM of each frame,  (default false)

 

Example [ compute SSIM scores for the first 10 frames]:

python GetSSIM.py --ref test_1920x1080.yuv --dist test_15M.yuv --width 1920 --height 1080 -v -n 10

frame 0,  SSIM  0.847

frame 1,  SSIM  0.890

frame 2,  SSIM  0.906

frame 3,  SSIM  0.924

frame 4,  SSIM  0.916

frame 5,  SSIM  0.911

frame 6,  SSIM  0.909

frame 7,  SSIM  0.908

frame 8,  SSIM  0.907

frame 9,  SSIM  0.906

Number of frames:           10

average SSIM    :         0.902

std SSIM:                     0.020

5-percentile SSIM:            0.867

 

 

Let’s suppose we have output h264 stream and the reference yuv or y4m stream and we wish to compare frame number 100 from both streams.

With ffmpeg we can take the frame number 100 from both streams and convert them to jpg:

ffmpeg -i test.h264    -vf select=’eq(n\,100)’ -vsync 0    enc_frame.jpg

ffmpeg  -s 1920×1080 -i  test1080p.yuv  –vf select=’eq(n\,100)’ -vsync 0 ref_frame.jpg

 

Then we apply conSSIM.exe  as follows:

conSSIM.exe -bv -r ref_frame.jpg  -t enc_frame.jpg

  …  0.854043

The SSIM score is 0.854043

 

Notes:

Multi-scale SSIM (MS-SSIM) is an extension of the SSIM method. MS-SSIM is tailored for both still images and video.

According to technical literature MS-SSIM  was found to make better correlation to MOS than SSIM

  1. A Statistical Evaluation of Recent Full Reference Image Quality Assessment Algorithms”, H.R. Sheik et al., 2006
  2. MULTI-SCALE STRUCTURAL SIMILARITY FOR IMAGE QUALITY ASSESSMENT”, Zhou Wang et al., 2003.   

Matlab version of MS-SSIM is available at https://github.com/utlive/ms_ssim.git

According to the Table II of the paper “On the Use of SSIM in HEVC”, Tiesong Zhao et al., 2013, the video quality metric MS-SSIM provides a small improvement relative to SSIM in correlation with subjective quality.
According to the paper MS-SSIM requires 2x cycles than SSIM.


Here
PLCC – Pearson Linear Correlation Coefficient
SRCC  – Spearman Rank-order Correlation Coefficient 
KRCC – Kendall Rank-order Correlation Coefficient

10 Responses

    1. i am not familiar with other free sources. You can purchase Elecard VQ Analyzer to get MS-SSIM and SSIM and other metrics.

  1. The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.

Leave a Reply

Your email address will not be published. Required fields are marked *