如何匹配两个图像的EMGU CV SIFT关键点?

时间:2015-07-11 09:43:56

标签: c# opencv emgucv

我希望代码能够根据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;
    }

1 个答案:

答案 0 :(得分:0)

一种解决方案是使用提供的对象检测示例,然后比较检测区域。如果整个观察图像对应于模型图像 - 您的图像匹配。

其他解决方案 - 根本不使用描述符,只需选择关键点。然后比较两个图片的关键点数组,如果相等则考虑图像匹配。

第一种解决方案在某种程度上更可靠,而第二种解决方案更快更容易。