星期六, 3月 05, 2022

Mutual Information Python

 


https://www.codeleading.com/article/31721058116/

  1. from sklearn import metrics as mr
  2. from scipy.misc import imread
  3. import numpy as np
  4. img1 = imread('1.jpg')
  5. img2 = imread('2.jpg')
  6. img2 = np.resize(img2, (img1.shape[0], img1.shape[1], img1.shape[2]))
  7. img1 = np.reshape(img1, -1)
  8. img2 = np.reshape(img2, -1)
  9. print(img2.shape)
  10. print(img1.shape)
  11. mutual_infor = mr.mutual_info_score(img1, img2)
  12. print(mutual_infor)


https://vimsky.com/zh-tw/examples/detail/python-method-sklearn.metrics.mutual_info_score.html

沒有留言: