private MKeyPoint GetNearestKeyPoint(double x, double y, VectorOfKeyPoint keyFeaturesVector) { var width = _capture.GetCaptureProperty(CapProp.FrameWidth); var height = _capture.GetCaptureProperty(CapProp.FrameHeight); var point = new PointF((float)(x * width), (float)(y * height)); var result = keyFeaturesVector.Enumerable().First(); var minDistanse = double.MaxValue; foreach (var mKeyPoint in keyFeaturesVector.Enumerable()) { var distance = new LineSegment2DF(mKeyPoint.Point, point).Length; if (distance < minDistanse) { result = mKeyPoint; minDistanse = distance; } } return(result); }