예제 #1
0
void KateNewCompletionModel::completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType it)
{
  /**
   * auto invoke...
   */
  m_automatic=false;
  if (it==AutomaticInvocation) {
      m_automatic=true;
      KateView *v = qobject_cast<KateView*> (view);

      if (range.columnWidth() >= 3)
        saveMatches( view, range );
      else
        m_matches.clear();

      // done here...
      return;
  }

  // normal case ;)
  saveMatches( view, range );
}
예제 #2
0
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();
}