hi i have mean and standard deviation in one image now i want to find entropy for RGB color and skewness..

 Akzeptierte Antwort

To find the entropy, you have two ways, using predefined function or by programming :
H=imread('autumn.tif'); % RGB sample
E1=entropy(H)
Using program here is way :
H=im2double(H(:));
P=hist(H,length(H));
P(P==0)=[];
P=P/sum(P);
E2=-sum(P.*log2(P));

9 Kommentare

thanks..RGB sample mean we need to change this picture to each color(RGB)and test this code for each RGB or just take the picture that have color....and how about skewness..any idea for this code?
You can handle the entropy using different ways, you can average for each channel :
H=imread('autumn.tif');
ER=entropy(H(:,:,1)); % Red
EG=entropy(H(:,:,2)); % Green
EB=entropy(H(:,:,3)); % Blue
The average is
E=(ER+EG+EB)/3
The same concepts can be used for skewness :
SK=skewness(im2double(H(:)));
i see..so its same with the code that u give before?..let say im use predefined fucntion, i need extract 3 color channel RGB to test for each color?..what is different with new one..its run simulataneously..
do u know skewness using program?
It is possible to use program, map the matrix into a vector r and compute the skewness :
mean( ((r-mean(r))/std(r)).^3)
zach, not sure what that means, but if you mean to compute it yourself, did you look at the program I posted for you where one of the lines is:
% Get the skew.
skew = sum((GLs - meanGL) .^ 3 .* pixelCounts) / ((numberOfPixels - 1) * stdDev^3);
can u gv me details about variable r..its the row from which one matrix of pixel.and what should i put for pixelcounts and numberofpixel from my pixel image.
H=imread('autumn.tif');
r=im2double(H(:));

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

For entropy you can use entropy(). If you want a local entropy to give an image of how much the entropy is around the image, you can use entropyfilt(). If you want image moments, see the attached demo of mine.
A color image is three color channels. You can take the entropy of each.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
redEntropy = entropy(redChannel);
greenEntropy = entropy(greenChannel);
blueEntropy = entropy(blueChannel);

3 Kommentare

image moments mean its only take entropy for RGB only?because i dont need in grayscale..i have see ur attached file but cannot find for entropy code..
thanks..may i know from this code skew = sum((GLs - meanGL) .^ 3 .* pixelCounts) / ((numberOfPixels - 1) * stdDev^3);,where can i get pixelcounts and number of pixel from my image pixel..and i can still have no idea to get entropy for RGB..appreciate ur help.:)
Was this comment posted before you used Youssef's code and accepted it? He only did entropy and you accepted it so I assume that it does what you need.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 16 Mai 2014

Kommentiert:

am 19 Mai 2014

Community Treasure Hunt

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

Start Hunting!

Translated by