viqa.fr_metrics.gsm.gradient_similarity

viqa.fr_metrics.gsm.gradient_similarity(img_r, img_m, data_range=255, c=200, p=0.1)[source]

Calculate the gradient similarity between two images.

Parameters:
  • img_r (np.ndarray) – Reference image to calculate score against

  • img_m (np.ndarray) – Distorted image to calculate score of

  • data_range ({1, 255, 65535}) – Data range of the input images

  • c (int, default=200) – Constant as masking parameter. Typically, \(200 \leq c \leq 1000\). See [1] for details.

  • p (float, default=0.1) – Constant for weighting between luminance and structure similarity. Can be \(0 \leq p \leq 1\). Higher p means more accentuation of luminance. Should be \(p \ll 0.5\). See [1] for details.

Returns:

gsm_score – GSM score value.

Return type:

float

Raises:

ValueError – If the images are neither 2D nor 3D.

Warning

This metric is not yet tested. The metric should be only used for experimental purposes.

See also

viqa.fr_metrics.gsm.gradient_similarity_3d

Calculate the gradient similarity

between

References