You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
620B

  1. import os
  2. import cv2
  3. # from skimage.measure import compare_ssim
  4. # from skimage.metrics import _structural_similarity
  5. from skimage.metrics import structural_similarity as ssim
  6. if __name__ == '__main__':
  7. img00 = cv2.imread('image/AI.jpg')
  8. img10 = cv2.imread('image/AI3.jpg')
  9. img0 = cv2.cvtColor(img00,cv2.COLOR_BGR2GRAY) # 将图像转换为灰度图
  10. img1 = cv2.cvtColor(img10,cv2.COLOR_BGR2GRAY) # 将图像转换为灰度图
  11. #进行结构性相似度判断
  12. # ssim_value = _structural_similarity.structural_similarity(img,img1,multichannel=True)
  13. score= ssim(img0, img1)
  14. print(score)