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

Function readImageFeaturesDescriptors

test/arrayfire_test.cpp:1016–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014
1015template<typename descType>
1016void readImageFeaturesDescriptors(
1017 const std::string &pFileName, std::vector<af::dim4> &pInputDims,
1018 std::vector<std::string> &pTestInputs,
1019 std::vector<std::vector<float>> &pTestFeats,
1020 std::vector<std::vector<descType>> &pTestDescs) {
1021 using std::vector;
1022
1023 std::ifstream testFile(pFileName.c_str());
1024 if (testFile.good()) {
1025 unsigned inputCount;
1026 testFile >> inputCount;
1027 for (unsigned i = 0; i < inputCount; i++) {
1028 af::dim4 temp(1);
1029 testFile >> temp;
1030 pInputDims.push_back(temp);
1031 }
1032
1033 unsigned attrCount, featCount, descLen;
1034 testFile >> featCount;
1035 testFile >> attrCount;
1036 testFile >> descLen;
1037 pTestFeats.resize(attrCount);
1038
1039 pTestInputs.resize(inputCount, "");
1040 for (unsigned k = 0; k < inputCount; k++) {
1041 pTestInputs[k] = readNextNonEmptyLine(testFile);
1042 }
1043
1044 pTestFeats.resize(attrCount, vector<float>(0));
1045 for (unsigned i = 0; i < attrCount; i++) {
1046 pTestFeats[i].resize(featCount);
1047 float tmp;
1048 for (unsigned j = 0; j < featCount; j++) {
1049 testFile >> tmp;
1050 pTestFeats[i][j] = tmp;
1051 }
1052 }
1053
1054 pTestDescs.resize(featCount, vector<descType>(0));
1055 for (unsigned i = 0; i < featCount; i++) {
1056 pTestDescs[i].resize(descLen);
1057 descType tmp;
1058 for (unsigned j = 0; j < descLen; j++) {
1059 testFile >> tmp;
1060 pTestDescs[i][j] = tmp;
1061 }
1062 }
1063 } else {
1064 FAIL() << "TEST FILE NOT FOUND";
1065 }
1066}
1067
1068#define INSTANTIATE(TYPE) \
1069 template void readImageFeaturesDescriptors<TYPE>( \

Callers

nothing calls this directly

Calls 1

readNextNonEmptyLineFunction · 0.85

Tested by

no test coverage detected