From 19794e6857f3409d2d0288f8d46aeaa6aef4abbc Mon Sep 17 00:00:00 2001 From: ericgreveson Date: Mon, 29 Apr 2013 19:52:41 +0200 Subject: [PATCH] Fix for spurious assert in cv::compareHist When comparing histograms that look like multi-channel images (e.g a 3D histogram, of 4x4x4 bins, might appear as a CV_32FC4 matrix), cv::compareHist would complain because it was expecting the matrix type() == CV_32F. Now we test matrix depth() == CV_32F instead. --- 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 6357147df..da50a404d 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1970,7 +1970,7 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method ) double result = 0; int j, len = (int)it.size; - CV_Assert( H1.type() == H2.type() && H1.type() == CV_32F ); + CV_Assert( H1.type() == H2.type() && H1.depth() == CV_32F ); double s1 = 0, s2 = 0, s11 = 0, s12 = 0, s22 = 0;