Skip to content

Instantly share code, notes, and snippets.

@aobond2
Last active January 28, 2026 15:58
Show Gist options
  • Select an option

  • Save aobond2/170c70af96e2e33ed8bb500ffa74968b to your computer and use it in GitHub Desktop.

Select an option

Save aobond2/170c70af96e2e33ed8bb500ffa74968b to your computer and use it in GitHub Desktop.
Testing out ssim between 2 images, then visualise the difference. Using scikit-image
from skimage.metrics import structural_similarity as ssim
import cv2
import matplotlib.pyplot as plt
imgGold = cv2.imread("C:/Users/aobon_ktnb1ku/Documents/SSIM Test/Screenshot_1.png", 0)
imgTest = cv2.imread("C:/Users/aobon_ktnb1ku/Documents/SSIM Test/Screenshot_2.png", 0)
ssimScore, diff = ssim(imgGold, imgTest, full=True)
# diff here is image array
diff = (diff * 255).astype("uint8")
print (ssimScore)
plt.imshow(diff, cmap='jet')
plt.colorbar()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment