|
- import os
- import cv2
- # from skimage.measure import compare_ssim
- # from skimage.metrics import _structural_similarity
- from skimage.metrics import structural_similarity as ssim
-
-
- if __name__ == '__main__':
- img00 = cv2.imread('image/AI.jpg')
- img10 = cv2.imread('image/AI3.jpg')
- img0 = cv2.cvtColor(img00,cv2.COLOR_BGR2GRAY) # 将图像转换为灰度图
- img1 = cv2.cvtColor(img10,cv2.COLOR_BGR2GRAY) # 将图像转换为灰度图
- #进行结构性相似度判断
- # ssim_value = _structural_similarity.structural_similarity(img,img1,multichannel=True)
- score= ssim(img0, img1)
- print(score)
-
|