| 68 | |
| 69 | template<typename T> |
| 70 | void fastTest(string pTestFile, bool nonmax) { |
| 71 | SUPPORTED_TYPE_CHECK(T); |
| 72 | IMAGEIO_ENABLED_CHECK(); |
| 73 | |
| 74 | vector<dim4> inDims; |
| 75 | vector<string> inFiles; |
| 76 | vector<vector<float>> gold; |
| 77 | |
| 78 | readImageTests(pTestFile, inDims, inFiles, gold); |
| 79 | |
| 80 | size_t testCount = inDims.size(); |
| 81 | |
| 82 | for (size_t testId = 0; testId < testCount; ++testId) { |
| 83 | dim_t nElems = 0; |
| 84 | af_array inArray_f32 = 0; |
| 85 | af_array inArray = 0; |
| 86 | af_features out; |
| 87 | |
| 88 | inFiles[testId].insert(0, string(TEST_DIR "/fast/")); |
| 89 | |
| 90 | ASSERT_SUCCESS( |
| 91 | af_load_image(&inArray_f32, inFiles[testId].c_str(), false)); |
| 92 | |
| 93 | ASSERT_SUCCESS(conv_image<T>(&inArray, inArray_f32)); |
| 94 | |
| 95 | ASSERT_SUCCESS(af_fast(&out, inArray, 20.0f, 9, nonmax, 0.05f, 3)); |
| 96 | |
| 97 | dim_t n = 0; |
| 98 | af_array x, y, score, orientation, size; |
| 99 | |
| 100 | ASSERT_SUCCESS(af_get_features_num(&n, out)); |
| 101 | ASSERT_SUCCESS(af_get_features_xpos(&x, out)); |
| 102 | ASSERT_SUCCESS(af_get_features_ypos(&y, out)); |
| 103 | ASSERT_SUCCESS(af_get_features_score(&score, out)); |
| 104 | ASSERT_SUCCESS(af_get_features_orientation(&orientation, out)); |
| 105 | ASSERT_SUCCESS(af_get_features_size(&size, out)); |
| 106 | |
| 107 | ASSERT_SUCCESS(af_get_elements(&nElems, x)); |
| 108 | |
| 109 | float *outX = new float[gold[0].size()]; |
| 110 | float *outY = new float[gold[1].size()]; |
| 111 | float *outScore = new float[gold[2].size()]; |
| 112 | float *outOrientation = new float[gold[3].size()]; |
| 113 | float *outSize = new float[gold[4].size()]; |
| 114 | ASSERT_SUCCESS(af_get_data_ptr((void *)outX, x)); |
| 115 | ASSERT_SUCCESS(af_get_data_ptr((void *)outY, y)); |
| 116 | ASSERT_SUCCESS(af_get_data_ptr((void *)outScore, score)); |
| 117 | ASSERT_SUCCESS(af_get_data_ptr((void *)outOrientation, orientation)); |
| 118 | ASSERT_SUCCESS(af_get_data_ptr((void *)outSize, size)); |
| 119 | |
| 120 | vector<feat_t> out_feat; |
| 121 | array_to_feat(out_feat, outX, outY, outScore, outOrientation, outSize, |
| 122 | n); |
| 123 | |
| 124 | vector<feat_t> gold_feat; |
| 125 | array_to_feat(gold_feat, &gold[0].front(), &gold[1].front(), |
| 126 | &gold[2].front(), &gold[3].front(), &gold[4].front(), |
| 127 | gold[0].size()); |
nothing calls this directly
no test coverage detected