Last active
January 28, 2026 15:58
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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