Different answer using inbuilt function and own code for entropy

20 ビュー (過去 30 日間)
Amy Wong
Amy Wong 2017 年 10 月 19 日
コメント済み: Amy Wong 2017 年 10 月 20 日
When I use the inbuilt function and my own code for entropy, the answer is different.
E = -sum(Rarray(Rarray>0) .* log2(Rarray(Rarray>0)));
E2 = entropy(Rarray);
Entropy with Writen code = -768.0522
Entropy wth Function = 1.7366

採用された回答

Image Analyst
Image Analyst 2017 年 10 月 19 日
Simply edit entropy.m and you'll see exactly how they do it:
% calculate histogram counts
p = imhist(I(:));
% remove zero entries in p
p(p==0) = [];
% normalize p so that sum(p) is one.
p = p ./ numel(I);
E = -sum(p.*log2(p));
  1 件のコメント
Amy Wong
Amy Wong 2017 年 10 月 20 日
Thank you. I realise one of my commands is wrong.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by