problem with compatreHist function need help
Dear OpenCV Community,
I had tried to work with compareHist built-in function using CV_64F to compare a personalized MatND variables as follow
MatND matTest(Size(1,8), CV_64F, Scalar(0));
for(int i= 0; i < 8 ;i++){
matTest.at<double>(i,0) = exp(i);
}
cout <<compareHist( matTest, matTest,3)<<endl;
I got this
OpenCV Error: Assertion failed (H1.type() == H2.type() && H1.type() == CV_32F) in cv::compareHist, file C:\buildslave64\win64_amdocl\2_4_PackSlave-win64-vc11-shared\opencv\modules\imgproc\src\histogram.cpp, line 1985
however, CV_32F changes my the results the exponential function exp(); that s why I'm using CV_64F
I need to fix this issue, glad for help
You can cast to float after the exp() function. That should cut down on the error.
unrelated, but rather use plain cv::Mat for clarity. MatND is just another typedef for Mat.
Yes @berak I knew that MatND is another kind of Mat, however, by using Mat CV_32F I lose data, regarding the Size(1,8) is just an example, actually, I'm dealing with lot of numbers
maybe compareHist() accepts only CV_32F, which causes me to lose data
but when I try with Mat CV_64F it works by saving data, but using compareHist() gives the above OpenCV Error
i understand your problem, unfortunately the internal code for BHATTACHARYYA is sse optimized for 32bit floats only.