shannon entropy and entropy of grayscale

조회 수: 15 (최근 30일)
elTurco
elTurco 2023년 4월 7일
답변: the cyclist 2023년 4월 8일
How can i find the entropy of a gray image without using the "entropy(I)" , "entropy" command? with just codes and arrays?
  댓글 수: 2
the cyclist
the cyclist 2023년 4월 7일
Sounds like homework.
Can you use imhist?
elTurco
elTurco 2023년 4월 8일
Yes i can

댓글을 달려면 로그인하십시오.

채택된 답변

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

Community Treasure Hunt

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

Start Hunting!

Translated by