-
Notifications
You must be signed in to change notification settings - Fork 17
/
SIFT_loader.hpp
80 lines (63 loc) · 3.2 KB
/
SIFT_loader.hpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*===========================================================================*\
* *
* ACG Localizer *
* Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen *
* www.rwth-graphics.de *
* *
*---------------------------------------------------------------------------*
* This file is part of ACG Localizer *
* *
* ACG Localizer is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* ACG Localizer is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with ACG Localizer. If not, see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
#ifndef SIFT_LOADER_HH
#define SIFT_LOADER_HH
/**
* Class to read SIFT features from the text files generated by
* David Lowe's binary ( available at http://www.cs.ubc.ca/~lowe/keypoints/).
*
* IMPORTANT NOTE: The SIFT loader keeps the coordinate systems of the binaries. For example,
* the origin of the coordinate system used by David Lowe is in the upper left of the image.
*
* author : Torsten Sattler (tsattler@cs.rwth-aachen.de)
* date : 09-26-2011
**/
#include <vector>
#include <stdint.h>
#include "SIFT_keypoint.hpp"
class SIFT_loader {
public:
//! constructor
SIFT_loader();
//! destructor
~SIFT_loader();
//! load features from a file with a given format
void load_features(const char *filename, SIFT_FORMAT format);
//! save the features loaded to a file in David Lowes Format
bool save_features_lowe(const char *filename);
//! clears all data loaded so far
void clear_data();
//! returns the number of features loaded
uint32_t get_nb_features();
//! get access to a vector containg the descriptors (stored as chars)
std::vector<unsigned char*>& get_descriptors();
//! get the keypoints
std::vector<SIFT_keypoint>& get_keypoints();
private:
std::vector<SIFT_keypoint> mKeypoints;
std::vector<unsigned char*> mDescriptors;
uint32_t mNbFeatures;
bool load_Lowe_features(const char *filename);
};
#endif