image operations, skewness and kurtosis

57 ビュー (過去 30 日間)
ganesh s
ganesh s 2011 年 9 月 7 日
移動済み: DGM 2023 年 2 月 12 日
[EDIT: 20110907 11:03 CDT - merge duplicate - WDR]
1. How to find mean ,variance,standard deviation ,kurtosis & entropy of gray image? What will appear on the Figures? & how to analyze the output results?
[Information from duplicate]
I am in need of help... why we calculate the Skewness and Kurtosis of an image?? what is the logical meaning of calculating skewness of image??
pls reply.. i need in my project

回答 (3 件)

Image Analyst
Image Analyst 2011 年 11 月 14 日
I had occasion to need them myself today. Try this function I just wrote.
%------------------------------------------------------------------------------------------------------
% Get the skew and kurtosis from the histogram bin values.
% Uses formulas from http://itl.nist.gov/div898/handbook/eda/section3/eda35b.htm
function [skew kurtosis] = GetSkewAndKurtosis(GLs, pixelCounts)
try
% Get the number of pixels in the histogram.
numberOfPixels = sum(pixelCounts);
% Get the mean gray lavel.
meanGL = sum(GLs .* pixelCounts) / numberOfPixels;
% Get the variance, which is the second central moment.
varianceGL = sum((GLs - meanGL) .^ 2 .* pixelCounts) / (numberOfPixels-1);
% Get the standard deviation.
sd = sqrt(varianceGL);
% Get the skew.
skew = sum((GLs - meanGL) .^ 3 .* pixelCounts) / ((numberOfPixels - 1) * sd^3);
% Get the kurtosis.
kurtosis = sum((GLs - meanGL) .^ 4 .* pixelCounts) / ((numberOfPixels - 1) * sd^4);
catch ME
errorMessage = sprintf('Error in GetSkewAndKurtosis().\nThe error reported by MATLAB is:\n\n%s', ME.message);
uiwait(warndlg(errorMessage));
set(handles.txtInfo, 'String', errorMessage);
end
return; % from GetSkewAndKurtosis
From the website mentioned above, these are the definitions/interpretations:
*"Skewness is a measure of symmetry, or more precisely, the lack of symmetry. A distribution, or data set, is symmetric if it looks the same to the left and right of the center point. The skewness for a normal distribution is zero, and any symmetric data should have a skewness near zero. Negative values for the skewness indicate data that are skewed left and positive values for the skewness indicate data that are skewed right. By skewed left, we mean that the left tail is long relative to the right tail.
Kurtosis is a measure of whether the data are peaked or flat relative to a normal distribution. That is, data sets with high kurtosis tend to have a distinct peak near the mean, decline rather rapidly, and have heavy tails. Data sets with low kurtosis tend to have a flat top near the mean rather than a sharp peak. A uniform distribution would be the extreme case."*
  8 件のコメント
Rik
Rik 2017 年 8 月 31 日
The second question is mute, since the webpage you refer to had a different formula at the time you looked at it compared to the current version
Johanna THAI
Johanna THAI 2021 年 6 月 14 日
HI
please, how to apply the code to my grayscale image ? I didn't succeed..
Thank you very much

サインインしてコメントする。


Frb
Frb 2012 年 4 月 9 日
Hello,
Thanks for your useful code, can I ask what is GLs and pixelCounts?
Kind Regards,
Fariba
  11 件のコメント
SHRUTI SINGH
SHRUTI SINGH 2016 年 10 月 14 日
移動済み: DGM 2023 年 2 月 12 日
please help, getting this error! >> GetSkewAndKurtosis(GLs, pixelCounts) ??? Undefined function or method 'GetSkewAndKurtosis' for input arguments of type 'double'.
Image Analyst
Image Analyst 2016 年 10 月 14 日
移動済み: DGM 2023 年 2 月 12 日
You forgot to download that function, which I gave above in my answer (nor frb's answer). Copy that code into your code or a new m-file.

サインインしてコメントする。


Olalekan Ogunmolu
Olalekan Ogunmolu 2012 年 8 月 23 日
編集済み: DGM 2023 年 2 月 12 日
I wrote a code recently: Help yourself!
% Calculate Ordinary Moments
% Format: Moment = mom(Image, p, q)
% Image = Input Image
% p,q = (p+q)th order or moment
% Author: Olalekan P. Ogunmolu
% © 2012
function [ord_mom] = mom(image,p,q)
ord_mom = sum(sum( ((1:size(image,1))'.^p *...
(1:size(image,2)).^q) .* image ));
end
% Calculate Central Moments
% Format: Moment = Cent_Mom(image, p, q)
% image = Input Image
% p,q = (p+q)th order or moment
% Author: Olalekan P. Ogunmolu
% © 2012
function [Central] = centmom(image,p,q)
Ord_Mom00 = mom(image,0,0);
Ord_Mom10 = mom(image,1,0);
Ord_Mom01 = mom(image,0,1);
x_bar = Ord_Mom10/Ord_Mom00; % Calculates X-center of gravity
y_bar = Ord_Mom01/Ord_Mom00; % Calculates Y-center of gravity
[row, col] = size(image);
Central = sum(sum( (((1:row)-x_bar)'.^p * ...
((1:col)-y_bar).^q) .* image ));
return
% Normalize Moments
% Format: Moment = normmom(image, p, q)
% image = Input Image
% p,q = (p+q)th order or moment
% Author: Olalekan P. Ogunmolu
% © 2012
function [Normalized] = normmom(image, p, q)
gamma = (0.5*(p+q)) + 1;
Normalized = (centmom(image, p, q))/...
(mom(image, 0, 0)^gamma);
return

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by