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

Function harrisTest

test/harris.cpp:62–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61template<typename T>
62void harrisTest(string pTestFile, float sigma, unsigned block_size) {
63 SUPPORTED_TYPE_CHECK(T);
64 IMAGEIO_ENABLED_CHECK();
65
66 vector<dim4> inDims;
67 vector<string> inFiles;
68 vector<vector<float>> gold;
69
70 readImageTests(pTestFile, inDims, inFiles, gold);
71
72 size_t testCount = inDims.size();
73
74 for (size_t testId = 0; testId < testCount; ++testId) {
75 dim_t nElems = 0;
76 af_array inArray_f32 = 0;
77 af_array inArray = 0;
78 af_features out;
79
80 inFiles[testId].insert(0, string(TEST_DIR "/harris/"));
81
82 ASSERT_SUCCESS(
83 af_load_image(&inArray_f32, inFiles[testId].c_str(), false));
84
85 ASSERT_SUCCESS(conv_image<T>(&inArray, inArray_f32));
86
87 ASSERT_SUCCESS(
88 af_harris(&out, inArray, 500, 1e5f, sigma, block_size, 0.04f));
89
90 dim_t n = 0;
91 af_array x, y, score, orientation, size;
92
93 ASSERT_SUCCESS(af_get_features_num(&n, out));
94 ASSERT_SUCCESS(af_get_features_xpos(&x, out));
95 ASSERT_SUCCESS(af_get_features_ypos(&y, out));
96 ASSERT_SUCCESS(af_get_features_score(&score, out));
97 ASSERT_SUCCESS(af_get_features_orientation(&orientation, out));
98 ASSERT_SUCCESS(af_get_features_size(&size, out));
99
100 ASSERT_SUCCESS(af_get_elements(&nElems, x));
101
102 vector<float> outX(gold[0].size());
103 vector<float> outY(gold[1].size());
104 vector<float> outScore(gold[2].size());
105 vector<float> outOrientation(gold[3].size());
106 vector<float> outSize(gold[4].size());
107 ASSERT_SUCCESS(af_get_data_ptr((void *)&outX.front(), x));
108 ASSERT_SUCCESS(af_get_data_ptr((void *)&outY.front(), y));
109 ASSERT_SUCCESS(af_get_data_ptr((void *)&outScore.front(), score));
110 ASSERT_SUCCESS(
111 af_get_data_ptr((void *)&outOrientation.front(), orientation));
112 ASSERT_SUCCESS(af_get_data_ptr((void *)&outSize.front(), size));
113
114 vector<feat_t> out_feat;
115 array_to_feat(out_feat, &outX.front(), &outY.front(), &outScore.front(),
116 &outOrientation.front(), &outSize.front(), n);
117
118 vector<feat_t> gold_feat;
119 array_to_feat(gold_feat, &gold[0].front(), &gold[1].front(),

Callers

nothing calls this directly

Calls 15

readImageTestsFunction · 0.85
af_get_features_xposFunction · 0.85
af_get_features_yposFunction · 0.85
af_get_features_scoreFunction · 0.85
af_get_features_sizeFunction · 0.85
af_get_elementsFunction · 0.85
fabsFunction · 0.85
array_to_featFunction · 0.70
af_load_imageFunction · 0.50
af_harrisFunction · 0.50
af_get_features_numFunction · 0.50

Tested by

no test coverage detected