2015-07-11 307 views
2

我希望代碼根據SIFT關鍵點匹配兩張圖片。如何匹配兩幅圖像的EMGU CV SIFT關鍵點?

我有以下代碼爲SIFT

public static Image<Bgr, Byte> siftFunction(Bitmap sourceBitmap) 
    { 
     Image<Gray, Byte> modelImage = new Image<Gray, byte>(sourceBitmap); 
     SIFTDetector siftCPU = new SIFTDetector(); 
     VectorOfKeyPoint modelKeyPoints = new VectorOfKeyPoint(); 
     MKeyPoint[] mKeyPoints = siftCPU.DetectKeyPoints(modelImage, null); 
     modelKeyPoints.Push(mKeyPoints); 
     ImageFeature<float>[] reulst = siftCPU.ComputeDescriptors(modelImage, null, mKeyPoints); 
     Image<Bgr, Byte> result = Features2DToolbox.DrawKeypoints(modelImage, modelKeyPoints, new Bgr(Color.Red), Features2DToolbox.KeypointDrawType.DEFAULT); 
     return result; 
    } 

回答

0

一個解決方案是使用物體檢測的所提供的示例,並且然後比較檢測的區域。如果整個觀察圖像對應於模型圖像 - 圖像匹配。

其他解決方案 - 請不要使用描述符,而只是選擇關鍵點。然後比較兩張圖片的關鍵點陣列,並在相等的情況下考慮圖像匹配。

第一個解決方案以某種方式更可靠,而第二個解決方案更快更簡單。