質問

(画像の)SIFT記述子のデータベースを作成するにはどうすればよいですか?私の意図は、サポートベクターマシンに監督されたトレーニングセットを実装することです。

役に立ちましたか?

解決

どのような画像が必要ですか?気にしない場合は、パブリックコンピュータービジョンデータセットをダウンロードするだけです http://lear.inrialpes.fr/~jegou/data.php#holidays 両方の画像を提供し、すでに計算されている地域から既に計算されたふるいです。または、たとえば、他のデータセットを試してください http://www.cvpapers.com/datasets.html

その他の可能性は、写真をたくさんダウンロードし、興味のあるポイントを検出し、ふるいにかけて説明することです。で行うことができます opencv, vlfeat または他のライブラリ。

opencvの例。

    #include <opencv2/opencv.hpp>
    #include <opencv2/nonfree/nonfree.hpp>
    #include <fstream>


    void WriteSIFTs(std::vector<cv::KeyPoint> &keys, cv::Mat desc, std::ostream &out1)
    {
      for(int i=0; i < (int) keys.size(); i++)
        {
          out1 << keys[i].pt.x << " " << keys[i].pt.y << " " << keys[i].size << " " << keys[i].angle << " "; 
//If you don`t need information about keypoints (position, size) 
//you can comment out the string above

          float* descPtr = desc.ptr<float>(i);
          for (int j = 0; j < desc.cols; j++)
              out1  << *descPtr++ << " ";
          out1 << std::endl;
        }

    }


    int main(int argc, const char* argv[])
    {
      const cv::Mat img1 = cv::imread("graf.png", 0); //Load as grayscale

      cv::SiftFeatureDetector detector;
      std::vector<cv::KeyPoint> keypoints;
      detector.detect(img1, keypoints);

      cv::SiftDescriptorExtractor extractor;
      cv::Mat descriptors;
      extractor.compute(img1, keypoints, descriptors);

      std::ofstream file1("SIFTs1.txt");
      if (file1.is_open())
        WriteSIFTs(keypoints,descriptors,file1);
      file1.close();
      return 0;
    }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top