Comparehist assertion failed
Hi,
I am comparing two histograms in my Android project and every time I get this
OpenCV Error: Assertion failed (A.size == arrays[i0]->size) in void cv::NAryMatIterator::init(const cv::Mat, cv::Mat, uchar, int), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/matrix.cpp, line 3210*
My code looks like this
Mat faceMat0 = mGray.submat(faces_filtered.get(0).getRect());
Mat faceMat1 = mGray.submat(faces_filtered.get(1).getRect());
Mat hist0 = histogram(mGray);
Mat hist1 = histogram(mGray);
Imgproc.compareHist(faceMat0, faceMat1, Imgproc.CV_COMP_CORREL);
And histogram function is following
Vector<Mat> bgr_planes = new Vector<Mat>();
Core.split(src, bgr_planes);
MatOfInt histSize = new MatOfInt(256);
final MatOfFloat histRange = new MatOfFloat(0f, 256f);
boolean accumulate = false;
Mat b_hist = new Mat();
Imgproc.calcHist(bgr_planes, new MatOfInt(0),new Mat(), b_hist, histSize, histRange, accumulate);
return b_hist;
Even if I try two same histograms with the same size, the result is always this error. Could you please tell me what I am doing wrong?
Thanks
Imgproc.compareHist(faceMat0, faceMat1, Imgproc.CV_COMP_CORREL);
- - - - - - - - - - - - - - - - - ^^
you are using the grayscale -submats here, not your histograms