shannon entropy and entropy of grayscale

9 次查看(过去 30 天)
How can i find the entropy of a gray image without using the "entropy(I)" , "entropy" command? with just codes and arrays?

采纳的回答

the cyclist
the cyclist 2023-4-8
I = imread('image.png');
figure
imagesc(I)
% Using histogram from imhist
p = imhist(I);
p = p/numel(I);
p(p==0) = [];
entropyFromImhist = -sum(p.*log2(p))
entropyFromImhist = 4.3978
% Built-in entropy function
entropy(I)
ans = 4.3978

更多回答(1 个)

埃博拉酱
埃博拉酱 2023-4-8
Entropy.m is open source, why don't you just check out its source code?
edit entropy

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by