public KeyPoint FindSimilarOnSecondPicture(KeyPoint picOnePoint, List <KeyPoint> picTwoPointsList) { int newDistance; int smalestDist = picOnePoint.CalculateDistance(picTwoPointsList[0]); KeyPoint neighbor = picTwoPointsList[0]; foreach (KeyPoint kp in picTwoPointsList) { newDistance = picOnePoint.CalculateDistance(kp); if (newDistance < smalestDist) { picOnePoint.Distance = smalestDist; kp.Distance = smalestDist; smalestDist = newDistance; neighbor = kp; } } return(neighbor); }
public KeyValuePair <KeyPoint, KeyPoint> FindPair(KeyPoint picOnePoint, List <KeyPoint> picTwoPointsList) { double newDistance; double smalestDist = picOnePoint.CalculateDistance(picTwoPointsList[0]); KeyPoint neighbor = picTwoPointsList[0]; foreach (KeyPoint kp in picTwoPointsList) { newDistance = picOnePoint.CalculateDistance(kp); if (newDistance < smalestDist) { smalestDist = newDistance; neighbor = kp; } } KeyValuePair <KeyPoint, KeyPoint> pair = new KeyValuePair <KeyPoint, KeyPoint>(picOnePoint, neighbor); return(pair); }