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?
Asked
Active
Viewed 4,724 times
3
-
1Never heard of such functions in OpenCV. May be you can implement it yourself. I think entropy = -sigma(p*log p) where p is probability. OpenCV has log, histogram functions. So try them. – Abid Rahman K Feb 15 '13 at 16:16
-
The guy at http://stackoverflow.com/questions/13920828/wierd-output-while-finding-entropy-of-frames-of-a-video-in-opencv is doing all you are after. – mmgp Feb 15 '13 at 19:12
1 Answers
1
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.

Max Allan
- 2,375
- 1
- 17
- 18
-
Can i use the same approach of image difference through entropy to ignore the empty frames and only getting the frames which contain object – Rocket Aug 31 '13 at 20:49
-
@Ahmad This would probably work if you were sure the object appearance and position wouldn't change too much between frames. There are *much* better methods of object detection however. – Max Allan Sep 01 '13 at 11:48
-
i already use surf and bow with svm , now i want to detect the car from movie , so there are much unrelevant and empty frames so i want to ignore them , i want to use it for that purpose – Rocket Sep 01 '13 at 17:02