-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupport.h
More file actions
53 lines (43 loc) · 1.79 KB
/
Copy pathsupport.h
File metadata and controls
53 lines (43 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __SUPPORT_H__
#define __SUPPORT_H__
#include <vector>
#include <cstdint>
#include <string>
#include <tuple>
#include <iostream>
// Simple CUDA error check macro
#define CUDA_CHECK(err) \
if (err != cudaSuccess) { \
std::cerr << "CUDA error: " << cudaGetErrorString(err) \
<< " at " << __FILE__ << ":" << __LINE__ << std::endl; \
std::exit(1); \
}
// Match result structure
struct MatchResult {
int frameI;
int frameJ;
int numMatches;
double timeMs;
std::vector<int> bestIdx;
std::vector<int> bestDist;
};
// Load metadata: returns (num_images, num_features, dim)
std::tuple<int, int, int> loadMetaInfo(const std::string& metaPath);
// Load binary descriptors (.bin) into a flat vector<uint8_t>
std::vector<uint8_t> loadDescriptorBinary(const std::string& path, size_t expectedBytes);
// Load all descriptor sets from .bin files
// Returns: (descriptors, file_numbers) where file_numbers[i] is the number from "des{N}.bin"
std::pair<std::vector<std::vector<uint8_t>>, std::vector<int>> loadAllDescriptors(const std::string& descriptorDir);
// Match two descriptor sets on GPU
void matchDescriptorsGPU(const uint8_t* hDes1, const uint8_t* hDes2,
int N, int dim,
std::vector<int>& hBestIdx,
std::vector<int>& hBestDist,
double& elapsedMs);
// Match two descriptor sets on GPU with cross-checking (bidirectional verification)
void matchDescriptorsGPUCrossCheck(const uint8_t* hDes1, const uint8_t* hDes2,
int N, int dim,
std::vector<int>& hBestIdx,
std::vector<int>& hBestDist,
double& elapsedMs);
#endif