| 128 | |
| 129 | template<typename T> |
| 130 | void orbTest(string pTestFile) { |
| 131 | SUPPORTED_TYPE_CHECK(T); |
| 132 | IMAGEIO_ENABLED_CHECK(); |
| 133 | |
| 134 | vector<dim4> inDims; |
| 135 | vector<string> inFiles; |
| 136 | vector<vector<float>> goldFeat; |
| 137 | vector<vector<unsigned>> goldDesc; |
| 138 | |
| 139 | readImageFeaturesDescriptors<unsigned>(pTestFile, inDims, inFiles, goldFeat, |
| 140 | goldDesc); |
| 141 | |
| 142 | size_t testCount = inDims.size(); |
| 143 | |
| 144 | for (size_t testId = 0; testId < testCount; ++testId) { |
| 145 | af_array inArray_f32 = 0; |
| 146 | af_array inArray = 0; |
| 147 | af_array desc = 0; |
| 148 | af_features feat; |
| 149 | |
| 150 | inFiles[testId].insert(0, string(TEST_DIR "/orb/")); |
| 151 | |
| 152 | ASSERT_SUCCESS( |
| 153 | af_load_image(&inArray_f32, inFiles[testId].c_str(), false)); |
| 154 | ASSERT_SUCCESS(conv_image<T>(&inArray, inArray_f32)); |
| 155 | |
| 156 | ASSERT_SUCCESS( |
| 157 | af_orb(&feat, &desc, inArray, 20.0f, 400, 1.2f, 8, true)); |
| 158 | |
| 159 | dim_t n = 0; |
| 160 | af_array x, y, score, orientation, size; |
| 161 | |
| 162 | ASSERT_SUCCESS(af_get_features_num(&n, feat)); |
| 163 | ASSERT_SUCCESS(af_get_features_xpos(&x, feat)); |
| 164 | ASSERT_SUCCESS(af_get_features_ypos(&y, feat)); |
| 165 | ASSERT_SUCCESS(af_get_features_score(&score, feat)); |
| 166 | ASSERT_SUCCESS(af_get_features_orientation(&orientation, feat)); |
| 167 | ASSERT_SUCCESS(af_get_features_size(&size, feat)); |
| 168 | |
| 169 | float* outX = new float[n]; |
| 170 | float* outY = new float[n]; |
| 171 | float* outScore = new float[n]; |
| 172 | float* outOrientation = new float[n]; |
| 173 | float* outSize = new float[n]; |
| 174 | dim_t descSize; |
| 175 | ASSERT_SUCCESS(af_get_elements(&descSize, desc)); |
| 176 | unsigned* outDesc = new unsigned[descSize]; |
| 177 | ASSERT_SUCCESS(af_get_data_ptr((void*)outX, x)); |
| 178 | ASSERT_SUCCESS(af_get_data_ptr((void*)outY, y)); |
| 179 | ASSERT_SUCCESS(af_get_data_ptr((void*)outScore, score)); |
| 180 | ASSERT_SUCCESS(af_get_data_ptr((void*)outOrientation, orientation)); |
| 181 | ASSERT_SUCCESS(af_get_data_ptr((void*)outSize, size)); |
| 182 | ASSERT_SUCCESS(af_get_data_ptr((void*)outDesc, desc)); |
| 183 | |
| 184 | vector<feat_desc_t> out_feat_desc; |
| 185 | array_to_feat_desc(out_feat_desc, outX, outY, outScore, outOrientation, |
| 186 | outSize, outDesc, n); |
| 187 |
nothing calls this directly
no test coverage detected