필터 지우기
필터 지우기

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

조회 수: 24 (최근 30일)
I have an enhanced image and I want to measure the amount of information in the enhanced image using the following metric:
Capture.JPG
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
Adam
Adam 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
ghada sandoub
ghada sandoub 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.

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

채택된 답변

Image Analyst
Image Analyst 2019년 3월 19일
ghada:
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:
grayImage = imread('cameraman.tif');
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;
0001 Screenshot.png
  댓글 수: 4
Aaron Charles Alday
Aaron Charles Alday 2020년 2월 20일
Your code didn't work to my matlab sorftware the command window shows this message....why?
"Error in imhist (line 60)
[a, n, isScaled, top, map] = parse_inputs(varargin{:});
Error in Test_Run_2 (line 8)
[pixelCounts, white_value] = imhist(grayImage, 256, 'Normalization', 'probability')"
Image Analyst
Image Analyst 2022년 5월 28일
@Aaron Charles Alday, that's not my code. I didn't use imhist, I used histogram. imhist does not take those arguments.

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

추가 답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 3월 19일
편집: KALYAN ACHARJYA 2019년 3월 19일
gray_image=rgb2gray(imread('test.jpg'));
[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>>
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 3월 20일
편집: KALYAN ACHARJYA 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

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


Ganesha Thondilege
Ganesha Thondilege 2022년 5월 28일
I hope this will help you.
grayImage = imread('cameraman.jpg');
subplot(1,2, 1);
imshow(grayImage);
subplot(1,2, 2);
imhist(grayImage);
  댓글 수: 3
Ganesha Thondilege
Ganesha Thondilege 2022년 5월 28일
Try this to get the probabilities of each gray_value
grayImage = imread('cameraman.jpg');
[l,m]=size(grayImage);
subplot(1,2, 1);
imshow(grayImage);
[pixelCounts, gray_value]=imhist(grayImage);
prob=pixelCounts(:)./(l*m);
subplot(1,2,2);
plot(gray_value,prob);
Walter Roberson
Walter Roberson 2022년 5월 29일
what advantages would this have compared to https://www.mathworks.com/matlabcentral/answers/450942-how-can-i-compute-the-probability-of-a-pixel-intensity-of-the-image-in-matlab#answer_366112

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

카테고리

Help CenterFile Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by