shannon entropy and entropy of grayscale
3 次查看(过去 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
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))
% Built-in entropy function
entropy(I)
0 个评论
更多回答(1 个)
埃博拉酱
2023-4-8
Entropy.m is open source, why don't you just check out its source code?
edit entropy