Skip to content

Commit 737fa51

Browse files
committed
test: use relative error in HOG tests
1 parent ceb5210 commit 737fa51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/objdetect/test/test_cascadeandhog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ void HOGDescriptorTester::detect(const Mat& img,
10871087
}
10881088

10891089
const double eps = FLT_EPSILON * 100;
1090-
double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2);
1090+
double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2 + NORM_RELATIVE);
10911091
if (diff_norm > eps)
10921092
{
10931093
ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n"
@@ -1167,7 +1167,7 @@ void HOGDescriptorTester::compute(InputArray _img, vector<float>& descriptors,
11671167
std::vector<float> actual_descriptors;
11681168
actual_hog->compute(img, actual_descriptors, winStride, padding, locations);
11691169

1170-
double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2);
1170+
double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2 + NORM_RELATIVE);
11711171
const double eps = FLT_EPSILON * 100;
11721172
if (diff_norm > eps)
11731173
{
@@ -1316,7 +1316,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle
13161316
const double eps = FLT_EPSILON * 100;
13171317
for (i = 0; i < 2; ++i)
13181318
{
1319-
double diff_norm = cvtest::norm(reference_mats[i], actual_mats[i], NORM_L2);
1319+
double diff_norm = cvtest::norm(actual_mats[i], reference_mats[i], NORM_L2 + NORM_RELATIVE);
13201320
if (diff_norm > eps)
13211321
{
13221322
ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n"

0 commit comments

Comments
 (0)