How can I implement mutual information?

2 ビュー (過去 30 日間)
Carmen Alabart Gutierrez del Olmo
Carmen Alabart Gutierrez del Olmo 2016 年 12 月 10 日
編集済み: Nirav Sharda 2016 年 12 月 15 日
I have been trying to implement Mutual Information equation, but the code seems that its not working fine. Can anyone help me?
fixed_current = uint8(fixed_current);
moving_current = uint8(moving_current);
v_x_y = zeros (256);
for i = 1:256
for j = 1:256
coord_r = fixed_current(i,j)+1;
coord_c = moving_current(i,j)+1;
v_x_y (coord_r,coord_c) = v_x_y (coord_r,coord_c) + 1;
end
end
p_x_y = v_x_y./ (256*256);
indNoZero = v_x_y ~= 0;
p_x_y_n0 = p_x_y(indNoZero);
% Define the entropy
H_x = entropy(fixed_current);
H_y = entropy(moving_current);
H_x_y = -sum(sum(p_x_y_n0.*log2(p_x_y_n0)));
% Define the MI
res = (H_x + H_y - H_x_y)/(max(H_x,H_y));
  1 件のコメント
Nirav Sharda
Nirav Sharda 2016 年 12 月 15 日
編集済み: Nirav Sharda 2016 年 12 月 15 日
Are you getting any error messages or is the code giving incorrect results? Also, I was able to find some file exchange examples on this link .

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by