12
12
13
13
using namespace xrsfm ;
14
14
15
- void GetFeatures (const std::string &images_path, const std::string &ftr_path,
16
- std::vector<Frame> &frames) {
15
+ void GetFeatures (const std::string &images_path,
16
+ const std::vector<std::string> &image_names,
17
+ const std::string &ftr_path, std::vector<Frame> &frames) {
18
+ const int num_image = image_names.size ();
19
+ frames.resize (num_image);
20
+ for (int i = 0 ; i < num_image; ++i) {
21
+ frames[i].id = i;
22
+ frames[i].name = image_names[i];
23
+ }
24
+
17
25
std::ifstream ftr_bin (ftr_path);
18
26
if (ftr_bin.good ()) {
19
27
ReadFeatures (ftr_path, frames);
@@ -33,7 +41,8 @@ void GetImageSizeVec(const std::string &images_path,
33
41
LoadImageSize (path, image_size);
34
42
} else {
35
43
for (const auto &image_name : image_names) {
36
- const cv::Mat image = cv::imread (images_path + image_name);
44
+ const cv::Mat image = cv::imread (images_path + image_name,
45
+ cv::IMREAD_IGNORE_ORIENTATION);
37
46
image_size.push_back (ImageSize (image.cols , image.rows ));
38
47
}
39
48
SaveImageSize (path, image_size);
@@ -173,27 +182,25 @@ int main(int argc, const char *argv[]) {
173
182
const std::string fp_init_path = output_path + " fp_init.bin" ;
174
183
const std::string fp_path = output_path + " fp.bin" ;
175
184
176
- // 1.read imagesstd::filesystem
185
+ // 1.read images
177
186
if (!std::experimental::filesystem::exists (images_path)) {
178
187
std::cout << " image path not exists :" << images_path << " \n " ;
179
188
exit (-1 );
180
189
}
181
190
std::vector<std::string> image_names;
182
191
LoadImageNames (images_path, image_names);
183
- std::vector<ImageSize> image_size_vec;
184
- GetImageSizeVec (images_path, image_names, size_path, image_size_vec);
185
192
std::map<std::string, int > name2id;
186
193
const int num_image = image_names.size ();
187
- std::vector<Frame> frames (num_image);
188
194
for (int i = 0 ; i < num_image; ++i) {
189
- frames[i].id = i;
190
- frames[i].name = image_names[i];
191
195
name2id[image_names[i]] = i;
192
196
}
193
197
std::cout << " Load Image Info Done.\n " ;
194
198
195
199
// 2.feature extraction
196
- GetFeatures (images_path, ftr_path, frames);
200
+ std::vector<Frame> frames;
201
+ std::vector<ImageSize> image_size_vec;
202
+ GetFeatures (images_path, image_names, ftr_path, frames);
203
+ GetImageSizeVec (images_path, image_names, size_path, image_size_vec);
197
204
std::cout << " Extract Features Done.\n " ;
198
205
199
206
// 5.image matching
0 commit comments