| 136 | |
| 137 | template<typename T> |
| 138 | void glohTest(string pTestFile) { |
| 139 | SUPPORTED_TYPE_CHECK(T); |
| 140 | IMAGEIO_ENABLED_CHECK(); |
| 141 | |
| 142 | vector<dim4> inDims; |
| 143 | vector<string> inFiles; |
| 144 | vector<vector<float>> goldFeat; |
| 145 | vector<vector<float>> goldDesc; |
| 146 | |
| 147 | readImageFeaturesDescriptors<float>(pTestFile, inDims, inFiles, goldFeat, |
| 148 | goldDesc); |
| 149 | |
| 150 | size_t testCount = inDims.size(); |
| 151 | |
| 152 | for (size_t testId = 0; testId < testCount; ++testId) { |
| 153 | af_array inArray_f32 = 0; |
| 154 | af_array inArray = 0; |
| 155 | af_array desc = 0; |
| 156 | af_features feat; |
| 157 | |
| 158 | inFiles[testId].insert(0, string(TEST_DIR "/gloh/")); |
| 159 | |
| 160 | ASSERT_SUCCESS( |
| 161 | af_load_image(&inArray_f32, inFiles[testId].c_str(), false)); |
| 162 | ASSERT_SUCCESS(conv_image<T>(&inArray, inArray_f32)); |
| 163 | |
| 164 | ASSERT_SUCCESS(af_gloh(&feat, &desc, inArray, 3, |
| 165 | 0.04f, 10.0f, 1.6f, |
| 166 | true, 1.f / 256.f, 0.05f)); |
| 167 | |
| 168 | dim_t n = 0; |
| 169 | af_array x, y, score, orientation, size; |
| 170 | |
| 171 | ASSERT_SUCCESS(af_get_features_num(&n, feat)); |
| 172 | ASSERT_SUCCESS(af_get_features_xpos(&x, feat)); |
| 173 | ASSERT_SUCCESS(af_get_features_ypos(&y, feat)); |
| 174 | ASSERT_SUCCESS(af_get_features_score(&score, feat)); |
| 175 | ASSERT_SUCCESS(af_get_features_orientation(&orientation, feat)); |
| 176 | ASSERT_SUCCESS(af_get_features_size(&size, feat)); |
| 177 | |
| 178 | float* outX = new float[n]; |
| 179 | float* outY = new float[n]; |
| 180 | float* outScore = new float[n]; |
| 181 | float* outOrientation = new float[n]; |
| 182 | float* outSize = new float[n]; |
| 183 | dim_t descSize; |
| 184 | dim_t descDims[4]; |
| 185 | ASSERT_SUCCESS(af_get_elements(&descSize, desc)); |
| 186 | ASSERT_SUCCESS(af_get_dims(&descDims[0], &descDims[1], &descDims[2], |
| 187 | &descDims[3], desc)); |
| 188 | float* outDesc = new float[descSize]; |
| 189 | ASSERT_SUCCESS(af_get_data_ptr((void*)outX, x)); |
| 190 | ASSERT_SUCCESS(af_get_data_ptr((void*)outY, y)); |
| 191 | ASSERT_SUCCESS(af_get_data_ptr((void*)outScore, score)); |
| 192 | ASSERT_SUCCESS(af_get_data_ptr((void*)outOrientation, orientation)); |
| 193 | ASSERT_SUCCESS(af_get_data_ptr((void*)outSize, size)); |
| 194 | ASSERT_SUCCESS(af_get_data_ptr((void*)outDesc, desc)); |
| 195 |
nothing calls this directly
no test coverage detected