mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
Correct handling when IPP is enabled
This commit is contained in:
parent
58d28061a4
commit
229e8b1b18
@ -821,6 +821,10 @@ static bool ipp_calchist(const Mat &image, Mat &hist, int histSize, const float*
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// IPP_DISABLE_HISTOGRAM - https://github.com/opencv/opencv/issues/11544
|
||||
if (uniform && (ranges[0][1] - ranges[0][0]) != histSize)
|
||||
return false;
|
||||
|
||||
Mat ihist = hist;
|
||||
if(accumulate)
|
||||
ihist.create(1, &histSize, CV_32S);
|
||||
|
@ -1918,5 +1918,35 @@ TEST(Imgproc_Hist_CalcBackProject, accuracy) { CV_CalcBackProjectTest test; test
|
||||
TEST(Imgproc_Hist_CalcBackProjectPatch, accuracy) { CV_CalcBackProjectPatchTest test; test.safe_run(); }
|
||||
TEST(Imgproc_Hist_BayesianProb, accuracy) { CV_BayesianProbTest test; test.safe_run(); }
|
||||
|
||||
TEST(Imgproc_Hist_Calc, calcHist_regression_11544)
|
||||
{
|
||||
cv::Mat1w m = cv::Mat1w::zeros(10, 10);
|
||||
int n_images = 1;
|
||||
int channels[] = { 0 };
|
||||
cv::Mat mask;
|
||||
cv::MatND hist1, hist2;
|
||||
cv::MatND hist1_opt, hist2_opt;
|
||||
int dims = 1;
|
||||
int hist_size[] = { 1000 };
|
||||
float range1[] = { 0, 900 };
|
||||
float range2[] = { 0, 1000 };
|
||||
const float* ranges1[] = { range1 };
|
||||
const float* ranges2[] = { range2 };
|
||||
|
||||
setUseOptimized(false);
|
||||
cv::calcHist(&m, n_images, channels, mask, hist1, dims, hist_size, ranges1);
|
||||
cv::calcHist(&m, n_images, channels, mask, hist2, dims, hist_size, ranges2);
|
||||
|
||||
setUseOptimized(true);
|
||||
cv::calcHist(&m, n_images, channels, mask, hist1_opt, dims, hist_size, ranges1);
|
||||
cv::calcHist(&m, n_images, channels, mask, hist2_opt, dims, hist_size, ranges2);
|
||||
|
||||
for(int i = 0; i < 1000; i++)
|
||||
{
|
||||
EXPECT_EQ(hist1.at<float>(i, 0), hist1_opt.at<float>(i, 0)) << i;
|
||||
EXPECT_EQ(hist2.at<float>(i, 0), hist2_opt.at<float>(i, 0)) << i;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
/* End Of File */
|
||||
|
Loading…
Reference in New Issue
Block a user