@UnstableApi
public final class MssimCalculator


Image comparison tool that calculates the Mean Structural Similarity (MSSIM) of two images, developed by Wang, Bovik, Sheikh, and Simoncelli.

MSSIM divides the image into windows, calculates SSIM of each, then returns the average.

See the SSIM paper.

Summary

Public methods

static double
calculate(
    byte[] referenceBuffer,
    byte[] distortedBuffer,
    int width,
    int height
)

Calculates the Mean Structural Similarity (MSSIM) between two images with window skipping.

static double
calculate(
    byte[] referenceBuffer,
    byte[] distortedBuffer,
    int width,
    int height,
    boolean enableWindowSkipping
)

Calculates the Mean Structural Similarity (MSSIM) between two images.

Public methods

calculate

public static double calculate(
    byte[] referenceBuffer,
    byte[] distortedBuffer,
    int width,
    int height
)

Calculates the Mean Structural Similarity (MSSIM) between two images with window skipping.

See also
calculate

calculate

public static double calculate(
    byte[] referenceBuffer,
    byte[] distortedBuffer,
    int width,
    int height,
    boolean enableWindowSkipping
)

Calculates the Mean Structural Similarity (MSSIM) between two images.

The images are split into a grid of windows. For each window, the structural similarity (SSIM) is calculated. The MSSIM returned from this method is the mean of these SSIM values. If window skipping is enabled, only every other row and column are considered, thereby only one in four windows are evaluated.

Parameters
byte[] referenceBuffer

The luma channel (Y) buffer of the reference image.

byte[] distortedBuffer

The luma channel (Y) buffer of the distorted image.

int width

The image width in pixels.

int height

The image height in pixels.

boolean enableWindowSkipping

Whether to skip every other row and column when evaluating windows for SSIM calculation.

Returns
double

The MSSIM score between the input images.