Display the statistical features of an image
Show older comments

I would like to calculate the mean, variance, contrast, energy, diagonal moment, directivity and entropy using MatLab. After that, I want to display those images like in the attached figure. Can anybody help me.
8 Comments
Image Analyst
on 30 Sep 2015
Most likely. First read this then attach the figure and tell us if you want help with the calculations or the display, or both or something else.
Abdelkhalek Bakkari
on 30 Sep 2015
Edited: Walter Roberson
on 11 May 2017
Salma Hassan
on 7 May 2017
did you found the solution for your problem . i have the same
Walter Roberson
on 11 May 2017
When you ask to calculate the mean of an RGB image, you typically intend to find the mean color. The way to do that is:
I = imread('bee.jpg');
m = mean( reshape(I, [], 3) );
and you could display that as an image by:
image( cast( reshape(m, 1, 1, 3), class(I)) )
When you ask to calculate the mean of a grayscale image, you typically intend to find the mean intensity. The way to do that is
I = imread('bee.jpg');
m = mean(I(:));
and you can display that as an image by:
image( cast(m, class(I)) )
colormap(gray(256))
Salma Hassan
on 17 Jul 2017
plz sir i did as you explained but it gave me a black image in all the properties ( contrast , homogenity ...)
Walter Roberson
on 17 Jul 2017
Edited: Walter Roberson
on 19 Jul 2017
I did write one misleading bit above; I talked about the mean of a grayscale image, but I gave the example,
I = imread('bee.jpg');
This is a little misleading because .jpg images are seldom grayscale images. jpg images might appear to be grayscale, but they are much more likely to be RGB images that look grayscale because their Red, Green, and Blue components are all (very close to) equal.
On the other hand, it happens to be the case that when all of the components are equal, that mean(I(:)) would come out the same as mean(I(:,:,1)) to within round-off error, so for the purpose of calculating mean intensity, it should not matter.
The difference between true grayscale and RGB that appears gray could make a difference for contrast or homogenity, depending how those are calculated. Therefore if you read in a .jpg that you expect to be grayscale, it is much safer to add in an rgb2gray call to force it to be grayscale for sure.
Salma Hassan
on 19 Jul 2017
thanks for your explanation . plz sir can you guide me in this :- i have a gray level lung image and i want to extract the features from it but i don't know which method is useful for it and how i will be sure that this method is good
Walter Roberson
on 19 Jul 2017
Sorry, I am not familiar with features such as homogenity
Answers (0)
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!