Original Post
Hi.. I am trying to do some image matching for a school proj. I found a code which make use the difference between the descriptors of each pixel to do the comparison. I have some qns of the code and hope someone could help me out. 1. why is 0.6 used? 2. which algo is this based on? for (int k = 0; k < Keypoints.Count; k++) { int min=0; int dsq, distsq1 = 100000000, distsq2 = 100000000; /* Find the two closest matches, and put their squared distances in and distsq2.*/ for (int k1 = 0; k1 < Keypoints2.Count; k1++) { dsq = DistSquared(Keypoints[k], Keypoints2[k1]); if (dsq < distsq1) { distsq2 = distsq1; distsq1 = dsq; min = k1; } else if (dsq < distsq2) { distsq2 = dsq; } } /* Check whether closest distance is less than 0.6 of second.*/ if (10 * 10 * distsq1 < 6 * 6 * distsq2) { key1.Add(k); key2.Add(min); } } /* Return squared distance between two keypoint descriptors. */ int DistSquared(KeypointN k1, KeypointN k2) { int i, dif, distsq = 0; int[] pk1, pk2; pk1 = k1.Descriptor; pk2 = k2.Descriptor; for (i = 0; i < 128; i++) { dif = (int) pk1 - (int) pk2; distsq += dif * dif; } return distsq; }