private int _numOfChoice = 5; // K value in k-NN public NNRecognizer() { _featureExtractor = new PointFloatShapeFeatureExtractor(); _preProc = new PreProcessing(); }
private void btnFeature_Click(object sender, EventArgs e) { var traceGroup = _resultInk.Ink.ToTraceGroup(); var featureExtractor = new PointFloatShapeFeatureExtractor(); var features = featureExtractor.ExtractFeature(traceGroup); var str = new StringBuilder(); foreach (var feature in features) { str.AppendLine(string.Format("{0} {1} {2} {3} {4}", feature.X, feature.Y, feature.SinTheta, feature.CosTheta, feature.IsPenUp)); } str.AppendLine("--- Total Point = " + features.Count); txtFeature.Text = str.ToString(); }
private void btnEuclidean_Click(object sender, EventArgs e) { var featureExtractor = new PointFloatShapeFeatureExtractor(); var preProc = new PreProcessing(); var traceGroup = _drawingInk.Ink.ToTraceGroup(); var sampledTraceGroup = preProc.ResampleTraceGroup(chkIsNormalized.Checked?preProc.NormalizeSize(traceGroup): traceGroup); var features = featureExtractor.ExtractFeature(sampledTraceGroup); var testTraceGroup = _resultInk.Ink.ToTraceGroup(); var sampledTestTraceGroup = preProc.ResampleTraceGroup(chkIsNormalized.Checked?preProc.NormalizeSize(testTraceGroup): testTraceGroup); var testFeatures = featureExtractor.ExtractFeature(sampledTestTraceGroup); var eucDistance = featureExtractor.ComputeEuclideanDistance(features, testFeatures); MessageBox.Show(@"Euclidean Distance = " + eucDistance); }
public TrainRecognizer() { _featureExtractor = new PointFloatShapeFeatureExtractor(); _inkFile = new InkFile(); _preProc = new PreProcessing(); }