Here is a snapshot of my code,
Matrix<byte> mask;
int k = 2;
VectorOfKeyPoint modelKeyPoints;
VectorOfKeyPoint observedKeyPoints;
SURFDetector surfCPU = new SURFDetector(500, false);
modelKeyPoints = surfCPU.DetectKeyPointsRaw(modelImage, null);
Matrix<float> modelDescriptors = surfCPU.ComputeDescriptorsRaw(modelImage, null, modelKeyPoints);
observedKeyPoints = surfCPU.DetectKeyPointsRaw(observedImage, null);
Matrix<float> observedDescriptors = surfCPU.ComputeDescriptorsRaw(observedImage, null, observedKeyPoints);
BruteForceMatcher<float> matcher = new BruteForceMatcher<float>(DistanceType.L2);
matcher.Add(modelDescriptors);
indices = new Matrix<int>(observedDescriptors.Rows, k);
using (Matrix<float> dist = new Matrix<float>(observedDescriptors.Rows, k))
{
matcher.KnnMatch(observedDescriptors, indices, dist, k, null);
}
I always get the following exception at KnnMatch()
Emgu.CV.Util.CvException occurred Message: OpenCV: queryDescriptors.type() == trainDescCollection[0].type()
I have tried so hard to get rid of this exception and no hope :(