### Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#" onclick="window._kiq.push(['set', { 'event': 'Turn off MT' }]);">ここ</a>」をクリックしてください。

## How can I compute the probability of a pixel intensity of the image in Matlab??

さんによって質問されました 2019 年 3 月 19 日

### KALYAN ACHARJYA (view profile)

さんによって 編集されました 2019 年 3 月 20 日
Image Analyst

### Image Analyst (view profile)

さんの 回答が採用されました
I have an enhanced image and I want to measure the amount of information in the enhanced image using the following metric:
where p(Ie) denotes the probability of a pixel intensity in the enhanced image Ie . now I want to know how to estimate the probability of a pixel intensity. Does anyone know how to do this in Matlab??

#### 2 件のコメント

2019 年 3 月 19 日
Which pixel intensity? The probablity of being exactly a given intensity or of being higher than a given intensity or lower? It doesn't make sense without additional context.of what Ie is

2019 年 3 月 19 日
Ie is the enhanced image of dimmed image. Ie is color image. and I want to measure the amount of enhancement in the enhanced image by using DE which measures the amount of information in the enhanced image by estimating the probability of a pixel intensty in this image. but I didn't know how to make this in matlab.

サインイン to comment.

## 2 件の回答

### Image Analyst (view profile)

2019 年 3 月 19 日
採用された回答

Use histogram() with the 'Normalization' option of 'probability'.
You might also be interested in the entropy() function (which computes your formula directly from the image), or entropyfilt() function (which does an entropy computation in a moving window).
Demo below:
subplot(2, 1, 1);
imshow(grayImage);
subplot(2, 1, 2);
histObject = histogram(grayImage, 256, 'Normalization', 'probability')
grid on;
xlabel('Gray Level', 'FontSize', 20);
ylabel('Probability', 'FontSize', 20);
% Extract probabililty of each gray level into a vector "p".
p = histObject.Values;

#### 2 件のコメント

2019 年 3 月 19 日
Thanks alot. but can I use the entropy() on the color image (enhanced image) directely and it will results in a correct operation or the entropy() applied on grayscale images only??
Image Analyst

### Image Analyst (view profile)

2019 年 3 月 19 日
You can use it on color images if you just want the entropy of every pixel regardless of what color it is. It's more of an interpretation issue than a functional/syntax/code issue.

サインイン to comment.

2019 年 3 月 19 日

### KALYAN ACHARJYA (view profile)

2019 年 3 月 19 日

[rows colm]=size(gray_image);
[pixelCounts, gray_value]=imhist(gray_image);
prob=pixelCounts(:)./(rows*colm);
prob=nonzeros(prob);
log_prob=log(prob);
DE=-sum(prob.*log_prob);
fprintf('\n The DE value is: %.2f',DE);
Command Window:
The DE value is: 3.50>>

2019 年 3 月 19 日
Thanks alot
KALYAN ACHARJYA

### KALYAN ACHARJYA (view profile)

2019 年 3 月 20 日
Is the problem solved? I have written simple code based on your question. If not. Check the comment of Image Anaalyst sir

サインイン to comment.

Translated by