문제

이미지의 SIFT 디스크립터 데이터베이스를 어떻게 작성합니까? 저의 의도는 지원 벡터 머신에 대한 감독 교육 세트를 구현하는 것입니다.

도움이 되었습니까?

해결책

어떤 종류의 이미지가 필요합니까? 관리하지 않으면 공개 컴퓨터 비전 데이터 세트를 다운로드 할 수 있습니다. http://lear.inrialpes.fr/~jegou/data.php#holidays 이미지와 이미 지역에서 이미 계산 된 사이드를 제공합니다. 또는 예를 들어 다른 데이터 세트를 사용해보십시오 http://www.cvpapers.com/datasets.html

다른 가능성은 많은 사진을 만들고 관심 지점을 감지하고 SIFT로 설명하는 것입니다. 이를 수행 할 수 있습니다 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