コード例 #1
0
        private static Tuple <double, double> CalcLinearFactors(KeyValuePair <string, MatOfFloat>[] hashArray, int j, int i)
        {
            //Console.WriteLine("Calculate matchpoint for " + hashArray[j].Key + " and " + hashArray[i].Key);

            var bfMatches = new BFMatcher(NormTypes.L2, crossCheck: true).Match(hashArray[j].Value, hashArray[i].Value).OrderBy(o => o.Distance).Select(o => o.Distance);
            var matches   = bfMatches.Take(bfMatches.Count() / 2).ToArray();

            var xes = new List <double>();
            var yes = new List <double>();

            for (int k = 0; k < matches.Length; k++)
            {
                xes.Add(k);
                yes.Add(matches[k]);
            }
            var linearFactors = MathNet.Numerics.Fit.Line(xes.ToArray(), yes.ToArray());

            //Console.WriteLine("\t\t x * " + linearFactors.Item2 + " + " + linearFactors.Item1);
            return(linearFactors);
        }