2016-07-05 37 views
0

我使用Emgu CV的SURF功能識別圖像中的類似對象。 繪製圖像,顯示在兩幅圖像中找到的所有關鍵點。問題是在圖像中看到類似的點。如何在SURF功能中保存興趣點?

如何將這些匹配點保存在數據庫中?

回答

0

首先,創建一個類SURF.cs然後寫在它下面的代碼:

 public void FindSURF(Image<Gray, Byte> modelImage) 
    { 
     VectorOfKeyPoint modelKeyPoints; 
     SURFDetector surfCPU = new SURFDetector(500, false); 

     //extract features from the object image 
     modelKeyPoints = new VectorOfKeyPoint(); 
     Matrix<float> modelDescriptors = surfCPU.DetectAndCompute(modelImage, null, modelKeyPoints); 
    } 

然後,在program.cs寫下面的代碼:

     SURF FindImageSURF = new SURF(); 

     string[] filePaths = Directory.GetFiles(@"E:\folderimages\"); 

     for (int i = 0; i < filePaths.Length; ++i) 
     { 
      string path = filePaths[i]; 
      using (Image<Gray, Byte> modelImage = new Image<Gray, byte>(path)) 
      { 
       FindImageSURF.FindSURF(modelImage); 
      } 
     }