MATLAB: Entropy Associated with Intensity Gradient Joint Histogram

One of the most widely used measurements of homogeneity is Shannon's entropy: enter image description here

where p is the normalized histogram of the L gray levels image.

We can measure such entropy using not only image intensities but also local image gradients, since homogeneous images not only have well-ordered intensities, but very low gradient values ​​in homogeneous regions are also well grouped (JV Manjon et al., " A Nonparametric MRI Method for Correcting Nonuniformity ", Medical Image Analysis, 2007).

Let Y be an image with M pixel and L1 levels, and G an associated image corresponding to the local gradient value with L2 gray levels. An intensity gradient narrowing histogram is defined as: enter image description here

where Ξ΄ is the Kronecker delta function. Thus, the normalized histogram of the intensity gradient joint is: enter image description here

Therefore, the entropy associated with the histogram of the intensity-gradient histogram is: enter image description here

I need to calculate the above entropy for biomedical image data: http://i.stack.imgur.com/I4hf4.png , I found this discussion helpful: Mutual information and joint entropy of two images - MATLAB , but I don't know if there was calculated the joint histogram and total entropy (by @rayryeng) in this discussion are the same as what I need, and if not, how could I calculate this entropy using Matlab? Any help is always appreciated.

+3


source to share


1 answer


Yes, you can still use my post.

Looking at your question above, the Delta Kronecker function is used so that for each i

and j

in your joint histogram, you want to look for all the values ​​where we encounter the intensity i

in the image, as well as the gradient value j

at the same spatial location . We count how many times they occur and that goes into the i

th and j

th row of the bar graph.

The post you linked does the same, but the second image is just a constant intensity image. All you have to do is replace the second image with a gradient image so you can definitely use my post.

The only thing you need to do is install im1 = Y

and im2 = G

. If you look at the post you linked to, I just changed the post that calculates the total histogram to make it more efficient. I unnecessarily declared a vector of everyone ones

when I didn't have to.

The post you link to assumes both Y

and G

will be integers. However, if your gradient values ​​in G

are not integers (which most likely will be the case), you can still use my post, but you will have to assign each unique value double

to a unique ID and use that ID array as input in accumarray

... Therefore, you will need to make a third conclusion unique

to help you with this. This third output will give a unique identifier for every unique floating point value that occurs in G

. Borrowing code from my post, this is what you would do for each situation:

Integer gradient



indrow = double(Y(:)) + 1;
indcol = double(G(:)) + 1;
jointHistogram = accumarray([indrow indcol], 1);
jointProb = jointHistogram / length(indrow);
indNoZero = jointHistogram ~= 0;
jointProb1DNoZero = jointProb(indNoZero);
jointEntropy = -sum(jointProb1DNoZero.*log2(jointProb1DNoZero));

      

Floating point gradient

indrow = double(Y(:)) + 1;
[~,~,indcol] = unique(G(:)); %// Change
jointHistogram = accumarray([indrow indcol], 1);
jointProb = jointHistogram / length(indrow);
indNoZero = jointHistogram ~= 0;
jointProb1DNoZero = jointProb(indNoZero);
jointEntropy = -sum(jointProb1DNoZero.*log2(jointProb1DNoZero));

      

Notice the above where id

will be automatically added to double

and it will automatically start at 1, so there is no need to offset by 1 as it did for our image intensities.


Good luck!

+2


source







All Articles