fix dev by 0 in KL-Divergence
authorgleb.sternharz <gleb.sternharz@gmail.com>
Mon, 17 Feb 2014 03:08:30 +0000 (04:08 +0100)
committergleb.sternharz <gleb.sternharz@gmail.com>
Mon, 17 Feb 2014 03:08:30 +0000 (04:08 +0100)
modules/flann/include/opencv2/flann/dist.h

index 80ae2dc..d293984 100644 (file)
@@ -741,7 +741,7 @@ struct KL_Divergence
         Iterator1 last = a + size;
 
         while (a < last) {
-            if (* a != 0) {
+            if (* b != 0) {
                 ResultType ratio = (ResultType)(*a / *b);
                 if (ratio>0) {
                     result += *a * log(ratio);