void saveAll(char* filePath, const char* filenameAdditon, double* VecSig, double* VecStr, double* VecDsig, double* VecDstr, double* InvF, double* InvFT, double* G, double* P11q, double* P22, double* P21, double* T3, double* Fe1q, double* Fe2, double* Fs, size_t nElems, size_t nVertices) { char path[512]; sprintf(path, "%s%s", filePath, filenameAdditon); saveVector(VecSig, nElems, 14, path, "sig.sav"); saveVector(VecStr, nElems, 20, path, "str.sav"); saveVector(VecDsig, nElems, 14, path, "Dsig.sav"); saveVector(VecDstr, nElems, 20, path, "Dstr.sav"); saveMatrix(InvF, nElems, 14, 14, 14*14, path, "invF.sav"); saveMatrix(InvFT, nElems, 14, 14, 14*14, path, "invFT.sav"); saveMatrix(G, nElems, 20, 14, 24*14, path, "G.sav"); saveMatrix(P11q, nElems, 14, 14, 14*14, path, "P11q.sav"); saveMatrix(P21, nElems, 6, 14, 6*14, path, "P21.sav"); saveMatrix(P22, nElems, 6, 6, 6*6, path, "P22.sav"); saveMatrixT(T3, nVertices, 3, 2, 3*2, path, "T3.sav"); saveVector(Fe1q, nElems, 14, path, "fe1q.sav"); saveVector(Fe2, nElems, 6, path, "fe2.sav"); saveVector(Fs, nElems, 14, path, "fs.sav"); }
void Points3d::save(std::string dirname, std::string filename) { std::ofstream f; std::string file = dirname + filename + ".m"; f.open(file.c_str()); // Se guardan las posiciones en formato matlab f << "function [x, y, z] = " << filename << "()" << std::endl; // Variable X saveVector(f, "x", _x); // Variable Y saveVector(f, "y", _y); // Variable X saveVector(f, "z", _z); f << "end"; f.close(); }
void Points1d::save(std::string dirname, std::string filename) { std::ofstream f; std::string file = dirname + filename + ".m"; f.open(file.c_str()); // Se guardan los datos en formato matlab f << "function x = " << filename << "()" << std::endl; // Datos saveVector(f, "x", _data); f << "end"; f.close(); }
void BundlerMatcher::open(const std::string& inputPath, const std::string& inputFilename, const std::string& outMatchFilename) { mInputPath = inputPath; if (!mIsInitialized) { std::cout << "Error : can not initialize opengl context for SiftGPU" <<std::endl; return; } if (!parseListFile(inputFilename)) { std::cout << "Error : can not open file : " <<inputFilename.c_str() <<std::endl; return; } //Sift Feature Extraction for (unsigned int i=0; i<mFilenames.size(); ++i) { int percent = (int)(((i+1)*100.0f) / (1.0f*mFilenames.size())); int nbFeature = extractSiftFeature(i); clearScreen(); std::cout << "[Extracting Sift Feature : " << percent << "%] - ("<<i+1<<"/"<<mFilenames.size()<<", #"<< nbFeature <<" features)"; } clearScreen(); std::cout << "[Sift Feature extracted]"<<std::endl; for (unsigned int i=0; i<mFilenames.size(); ++i) { int percent = (int)(((i+1)*100.0f) / (1.0f*mFilenames.size())); saveAsciiKeyFile(i); if (mBinaryKeyFileWritingEnabled) saveBinaryKeyFile(i); clearScreen(); std::cout << "[Saving Sift Key files: " << percent << "%] - ("<<i+1<<"/"<<mFilenames.size()<<")"; } saveVector(); clearScreen(); std::cout << "[Sift Key files saved]"<<std::endl; delete mSift; mSift = NULL; mMatcher->VerifyContextGL(); //Sift Matching int currentIteration = 0; if (mSequenceMatchingEnabled) //sequence matching (video input) { std::cout << "[Sequence matching enabled: length " << mSequenceMatchingLength << "]" << std::endl; int maxIterations = (int) (mFilenames.size()-mSequenceMatchingLength)*mSequenceMatchingLength + mSequenceMatchingLength*(mSequenceMatchingLength-1)/2; // (N-m).m + m(m-1)/2 for (unsigned int i=0; i<mFilenames.size()-1; ++i) { for (int j=1; j<=mSequenceMatchingLength; ++j) { int indexA = i; int indexB = i+j; if (indexB >= mFilenames.size()) continue; else { clearScreen(); int percent = (int) (currentIteration*100.0f / maxIterations*1.0f); std::cout << "[Matching Sift Feature : " << percent << "%] - (" << indexA << "/" << indexB << ")"; matchSiftFeature(indexA, indexB); currentIteration++; } } } } else //classic quadratic matching { int maxIterations = (int) mFilenames.size()*((int) mFilenames.size()-1)/2; // Sum(1 -> n) = n(n-1)/2 for (unsigned int i=0; i<mFilenames.size(); ++i) { for (unsigned int j=i+1; j<mFilenames.size(); ++j) { clearScreen(); int percent = (int) (currentIteration*100.0f / maxIterations*1.0f); std::cout << "[Matching Sift Feature : " << percent << "%] - (" << i << "/" << j << ")"; matchSiftFeature(i, j); currentIteration++; } } } clearScreen(); std::cout << "[Sift Feature matched]"<<std::endl; delete mMatcher; mMatcher = NULL; saveMatches(outMatchFilename); saveMatrix(); }