From 5624ad2c8e38af58589f6e9f74c9e5d7dff9dd38 Mon Sep 17 00:00:00 2001 From: "dmitriy.anisimov" Date: Tue, 9 Sep 2014 18:47:10 +0400 Subject: [PATCH] slight updated ir_affine --- modules/datasetstools/CMakeLists.txt | 2 +- modules/datasetstools/src/ir_affine.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/datasetstools/CMakeLists.txt b/modules/datasetstools/CMakeLists.txt index 3e058a5a7..933974415 100644 --- a/modules/datasetstools/CMakeLists.txt +++ b/modules/datasetstools/CMakeLists.txt @@ -1,3 +1,3 @@ set(the_description "datasets tools") -ocv_define_module(datasetstools opencv_core) +ocv_define_module(datasetstools opencv_core opencv_features2d) diff --git a/modules/datasetstools/src/ir_affine.cpp b/modules/datasetstools/src/ir_affine.cpp index 94a8a9a55..3373ecd15 100644 --- a/modules/datasetstools/src/ir_affine.cpp +++ b/modules/datasetstools/src/ir_affine.cpp @@ -78,13 +78,27 @@ void IR_affineImp::loadDataset(const string &path) test.push_back(vector< Ptr >()); validation.push_back(vector< Ptr >()); + // detect image extension + string ext; + vector fileNames; + getDirList(path, fileNames); + for (vector::iterator it=fileNames.begin(); it!=fileNames.end(); ++it) + { + string &name = *it; + if (name.length()>=8 && name.substr(0, 3)=="img") + { + ext = name.substr(name.length()-4, 4); + break; + } + } + for (unsigned int i=1; i<=6; ++i) { Ptr curr(new IR_affineObj); char tmp[2]; sprintf(tmp, "%u", i); - curr->imageName = path + "img" + tmp + ".ppm"; + curr->imageName = path + "img" + tmp + ext; if (i>1) {