public static double Bhattacharyya ( double [ ] histogram1 , double [ ] histogram2 ) { int bins = histogram1 . length ; // histogram bins double b = 0 ; // Bhattacharyya's coefficient for ( int i = 0 ; i < bins ; i ++ ) b += Math . sqrt ( histogram1 [ i ] ) * Math . sqrt ( histogram2 [ i ] ) ; // Bhattacharyya distance between the two distributions return Math . sqrt ( 1.0 - b ) ; }
Bhattacharyya distance between two normalized histograms .