Probability of gray level in an Image

조회 수: 15 (최근 30일)
Fabian
Fabian 2014년 8월 22일
댓글: Image Analyst 2014년 8월 22일
Hi all I want to know how to get the probability of one gray-level in my image samples.
I have 5 different images and I have computed the greylevel probability density function for each as the image histogram divided by the number of pixels in the image:
[pixelcount greylevel] = imhist(image); pdf = pixelcount/nPix;
So now I have the probability of all greyvalues to be found in each image, but what I really want to know is the propability to find a greyvalue in any image.
How can I combine the 5 different pdfs (one for each image) to have only one pdf.
Can I use the mean, max or min of the probability functions to combine them? If this is so, which one is better to use? Are there any other methods to combine the pdfs?
All my images have 256 graylevel. The images are not equally sized. I´m not sure if the pdfs can be described as a normal distribution.
Thanks

채택된 답변

Michael Haderlein
Michael Haderlein 2014년 8월 22일
편집: Michael Haderlein 2014년 8월 22일
Are all images equally sized? If so, if I didn't get you wrong, you can just use the mean of the 5 pdfs. Otherwise, you have to weight them according to the nPix of each image.
  댓글 수: 3
Ahmet Cecen
Ahmet Cecen 2014년 8월 22일
Doing it this way, yes it would matter. You are more "confident" in the information in a bigger image because you have a bigger sample size, so you would want to weight the bigger image pdfs higher.
Fabian
Fabian 2014년 8월 22일
Ok so if I understand, if the image is big it would describe better the probability function than a small image. So bigger images should have more weight in the mean probability.
How should I weight the probability by its size? Should I give the bigger image a weight 1 and then go down?
Thanks

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

추가 답변 (1개)

Ahmet Cecen
Ahmet Cecen 2014년 8월 22일
편집: Ahmet Cecen 2014년 8월 22일
npx=0;
count=0;
for i = 1:5
[pixelcount greylevel] = imhist(image(i));
count=count+pixelcount;
npx=npx+numel(image(i));
end
CombinedPdf=count/npx;
  댓글 수: 3
Ahmet Cecen
Ahmet Cecen 2014년 8월 22일
편집: Ahmet Cecen 2014년 8월 22일
Nope the above will give you the correct answer, without the need of additional weights. I am calculating the number of pixels at each image separately, so the inconsistency of dimensions between images are already accounted for.
Image Analyst
Image Analyst 2014년 8월 22일
Fabian: what Ahmet says is correct and in perfect agreement with what Michael said - the weighting is taken into account.
You should replace image(i) in his code with yourImage(:) or yourImage{i} (depending on how your image is stored) since you should not use image as the name of a variable.

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

Community Treasure Hunt

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

Start Hunting!

Translated by