Display the statistical features of an image

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

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.
Thank you Image Analyst for your help. If I calculated the mean of an input image, it would be like
I=imread('bee.jpg');
m = mean(I);
But, How can I display the mean of the input image as an image.
did you found the solution for your problem . i have the same
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))
plz sir i did as you explained but it gave me a black image in all the properties ( contrast , homogenity ...)
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.
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
Sorry, I am not familiar with features such as homogenity

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Asked:

on 30 Sep 2015

Commented:

on 19 Jul 2017

Community Treasure Hunt

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

Start Hunting!