MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / susanTest

Function susanTest

test/susan.cpp:69–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68template<typename T>
69void susanTest(string pTestFile, float t, float g) {
70 SUPPORTED_TYPE_CHECK(T);
71 IMAGEIO_ENABLED_CHECK();
72
73 vector<dim4> inDims;
74 vector<string> inFiles;
75 vector<vector<float>> gold;
76
77 readImageTests(pTestFile, inDims, inFiles, gold);
78
79 size_t testCount = inDims.size();
80
81 for (size_t testId = 0; testId < testCount; ++testId) {
82 inFiles[testId].insert(0, string(TEST_DIR "/susan/"));
83
84 array in = loadImage(inFiles[testId].c_str(), false);
85
86 features out = susan(in, 3, t, g, 0.05f, 3);
87
88 vector<float> outX(gold[0].size());
89 vector<float> outY(gold[1].size());
90 vector<float> outScore(gold[2].size());
91 vector<float> outOrientation(gold[3].size());
92 vector<float> outSize(gold[4].size());
93 out.getX().host(outX.data());
94 out.getY().host(outY.data());
95 out.getScore().host(outScore.data());
96 out.getOrientation().host(outOrientation.data());
97 out.getSize().host(outSize.data());
98
99 vector<feat_t> out_feat;
100 array_to_feat(out_feat, outX.data(), outY.data(), outScore.data(),
101 outOrientation.data(), outSize.data(),
102 out.getNumFeatures());
103
104 vector<feat_t> gold_feat;
105 array_to_feat(gold_feat, &gold[0].front(), &gold[1].front(),
106 &gold[2].front(), &gold[3].front(), &gold[4].front(),
107 gold[0].size());
108
109 std::sort(out_feat.begin(), out_feat.end(), feat_cmp);
110 std::sort(gold_feat.begin(), gold_feat.end(), feat_cmp);
111
112 for (int elIter = 0; elIter < (int)out.getNumFeatures(); elIter++) {
113 ASSERT_EQ(out_feat[elIter].f[0], gold_feat[elIter].f[0])
114 << "at: " << elIter << endl;
115 ASSERT_EQ(out_feat[elIter].f[1], gold_feat[elIter].f[1])
116 << "at: " << elIter << endl;
117 ASSERT_LE(fabs(out_feat[elIter].f[2] - gold_feat[elIter].f[2]), 1e2)
118 << "at: " << elIter << endl;
119 ASSERT_EQ(out_feat[elIter].f[3], gold_feat[elIter].f[3])
120 << "at: " << elIter << endl;
121 ASSERT_EQ(out_feat[elIter].f[4], gold_feat[elIter].f[4])
122 << "at: " << elIter << endl;
123 }
124 }
125}
126

Callers

nothing calls this directly

Calls 13

readImageTestsFunction · 0.85
loadImageFunction · 0.85
fabsFunction · 0.85
hostMethod · 0.80
getXMethod · 0.80
getYMethod · 0.80
getScoreMethod · 0.80
getOrientationMethod · 0.80
getSizeMethod · 0.80
getNumFeaturesMethod · 0.80
array_to_featFunction · 0.70
susanFunction · 0.50

Tested by

no test coverage detected