idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.71k stars 1.04k forks source link

ImageDiff and Structrual Similarity #13902

Open aeslaughter opened 5 years ago

aeslaughter commented 5 years ago

The ImageDiff test object uses skimage python package to compute the "Structural Similarity" (SSIM). This is a large dependency for a rather simple calculation.

https://en.wikipedia.org/wiki/Structural_similarity

Design

I would like to add a ssim function to mooseutils, so that we can do the following.

import mooseutils
index = mooseutils.ssim('file0.png', 'file1.png')

Impact

This should be drop-in replacement for our current function so no API will change, but it will allow us to remove a large python dependency.

@LSWells

aeslaughter commented 5 years ago

Here is the implementation in skimage, which includes a bunch of stuff we don't need, at least at this point. The only option we used is "multichannel=True"

https://github.com/scikit-image/scikit-image/blob/7875d332f63e1e69b45d8efc2ade97f7a9d14767/skimage/metrics/_structural_similarity.py