Reputation: 31
I have to calculate the Mutual Information between two gray scaled images. For that I have to calculate Entropy and Joint-Entropy of the images. But I cannot find any function of Entropy and Joint Entropy in Opencv .Can any one help me to find Entropy and Joint Entropy functions in Opencv?
Upvotes: 3
Views: 4864
Reputation: 2395
To do this you need to compute the image histogram which you can do in OpenCV with the calcHist()
function. You then normalize your histogram to get probabilities by dividing the value in each bin by the total number of pixels in your image(s). The image entropy is then given by:
where each element is a value from your histogram (assuming that your histogram is over the range [0-255]). You will need to be careful with zero values as these evaluate to -infinity when the log is taken.
Upvotes: 1