Probability of gray level in an Image

2 次查看(过去 30 天)
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