Debut Tests ASIFT + Essai VISP simplifié
This commit is contained in:
parent
a41f1ba991
commit
fbafece5af
1339 changed files with 153161 additions and 56 deletions
35
ASIFT_tests/demo_ASIFT_src/libMatch/match.cpp
Executable file
35
ASIFT_tests/demo_ASIFT_src/libMatch/match.cpp
Executable file
|
@ -0,0 +1,35 @@
|
|||
// Authors: Unknown. Please, if you are the author of this file, or if you
|
||||
// know who are the authors of this file, let us know, so we can give the
|
||||
// adequate credits and/or get the adequate authorizations.
|
||||
|
||||
#include "match.h"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
bool loadMatch(const char* nameFile, std::vector<Match>& match) {
|
||||
match.clear();
|
||||
std::ifstream f(nameFile);
|
||||
while( f.good() ) {
|
||||
std::string str;
|
||||
std::getline(f, str);
|
||||
if( f.good() ) {
|
||||
std::istringstream s(str);
|
||||
Match m;
|
||||
s >> m.x1 >> m.y1 >> m.x2 >> m.y2;
|
||||
if(!s.fail() )
|
||||
match.push_back(m);
|
||||
}
|
||||
}
|
||||
return !match.empty();
|
||||
}
|
||||
|
||||
bool saveMatch(const char* nameFile, const std::vector<Match>& match) {
|
||||
std::ofstream f(nameFile);
|
||||
if( f.is_open() ) {
|
||||
std::vector<Match>::const_iterator it = match.begin();
|
||||
for(; it != match.end(); ++it)
|
||||
f << it->x1 << " " << it->y1 << " "
|
||||
<< it->x2 << " " << it->y2 << std::endl;
|
||||
}
|
||||
return f.is_open();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue