Probability of gray level in an Image
조회 수: 15 (최근 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
댓글 수: 0
채택된 답변
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
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.
추가 답변 (1개)
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
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
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!