How to use built-in entropy function

4 次查看(过去 30 天)
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)))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by