From e7995b4d5d8f0497b1afb2dd8d302d3eb9885d55 Mon Sep 17 00:00:00 2001 From: ericgreveson Date: Sat, 18 May 2013 23:31:22 +0200 Subject: [PATCH] Take account of multi-channel matrices when comparing histograms Ensure that all channels are considered when comparing multi-channel histograms --- modules/imgproc/src/histogram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index da50a404d6..5ae1db6a9f 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1980,7 +1980,7 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method ) { const float* h1 = (const float*)it.planes[0].data; const float* h2 = (const float*)it.planes[1].data; - len = it.planes[0].rows*it.planes[0].cols; + len = it.planes[0].rows*it.planes[0].cols*H1.channels(); if( method == CV_COMP_CHISQR ) {