How can I apply the "lillietest" function to data from a grayscale image to see how the data fits a normal distribution?

1 view (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 1 Sep 2016
In order to apply the "lillietest" function to your image data, please use the following workflow replacing 'download.jpg' with your image name:
img = imread('download.jpg'); % Read the image (either grayscale or not).
grayScaleImg = rgb2gray(img); % Convert to grayscale.
grayScaleImg = reshape(grayScaleImg,1,[]); % Reshape into a column vector.
grayScaleImg = double(grayScaleImg); % Convert to double since lillietest requires double or single.
[h,p,k,c] = lillietest(grayScaleImg); % Apply Lillefors test to get parameters.
 
It is important to know that the  "lillietest" function requires a single vector of raw data instead of separate vectors for the frequency of data points and the data points themselves.

More Answers (0)

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!