public string recognizeGesture(BaseTrajectory trace) { var t = new Template(trace.TrajectoryPoints); //var best = knownTrajectories.MinBy(kt => kt.getBestCost(t, withTime)); double minCost = double.MaxValue; TrajectoryModel best = null; foreach (var kt in knownTrajectories) { var cost = kt.getBestCost(t, withTime); if (cost < minCost) { minCost = cost; best = kt; } } return(best.Name); }
public void trainGesture(string gestureName, IEnumerable <BaseTrajectory> trainingTraces) { var trajectoryModel = new TrajectoryModel(gestureName, trainingTraces.Select(t => t.TrajectoryPoints)); knownTrajectories.AddLast(trajectoryModel); }