How to use built-in entropy function

1 回表示 (過去 30 日間)
Mustafa Uysal
Mustafa Uysal 2019 年 12 月 24 日
コメント済み: Mustafa Uysal 2020 年 2 月 3 日
Hi,
i would like to calculate entropy of an image using entropy function. when use this function like this
E = entropy(uint8(output_image)
i can see a value. But when i remove uint8, i see 0 as a result. type of output_image is double. Also when i try to calculate entropy like described in this link
E = -sum(histogram_of_output_image.*log2(histogram_of_output_image));
i see NAN (not a number) as a result
  2 件のコメント
Image Analyst
Image Analyst 2019 年 12 月 24 日
Make sure there are no zeros in your image.
Mustafa Uysal
Mustafa Uysal 2019 年 12 月 24 日
But it can be zero in any image. Why it is a problem?

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

採用された回答

Subhadeep Koley
Subhadeep Koley 2020 年 2 月 1 日
Hi, Can you attach your "output_image" ? So that we can reproduce the issue.
Otherwise you can try the code below.
E = entropy(uint8(rescale(output_image, 0, 255)))
  1 件のコメント
Mustafa Uysal
Mustafa Uysal 2020 年 2 月 3 日
I tried and it worked

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by