Probability of gray level in an Image
古いコメントを表示
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
採用された回答
その他の回答 (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 件のコメント
Fabian
2014 年 8 月 22 日
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.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!