public void LearningTest() { MathTextBitmap bitmap = new MathTextBitmap(new FloatBitmap(5,5), new Gdk.Point(0,0)); bitmap.ProcessImage(new List<BitmapProcesses.BitmapProcess>()); CharacteristicTreeDatabase database = new CharacteristicTreeDatabase(); MathSymbol aSymbol = new MathSymbol("a"); MathSymbol bSymbol = new MathSymbol("b"); database.Learn(bitmap, aSymbol); List<MathSymbol> symbols = database.Match(bitmap); bool a1Learned = symbols.Count == 1 && symbols[0] == aSymbol; bool a2Learned = true; a2Learned = database.Learn(bitmap, aSymbol); database.Learn(bitmap, bSymbol); symbols = database.Match(bitmap); bool b1Learned = symbols.Count == 2; Assert.IsTrue(a1Learned, "Fallo el aprender la primera a"); Assert.IsFalse(a2Learned, "No se detecto el conflicto de la segunda a"); Assert.IsTrue(b1Learned, "Fallo el aprender la b"); }
private void OnImagesIVSelectionChanged(object s, EventArgs a) { removeImageBtn.Sensitive = imagesIV.SelectedItems.Length > 0; TreeIter selectedIter; if(imagesIV.SelectedItems.Length > 0) { TreePath selectedImagePath = imagesIV.SelectedItems[0]; imagesStore.GetIter(out selectedIter, selectedImagePath); Gdk.Pixbuf orig = (Gdk.Pixbuf)(imagesStore.GetValue(selectedIter,1)); mtb = new MathTextBitmap(orig); mtb.ProcessImage(database.Processes); imageAreaOriginal.Image = orig; imageAreaProcessed.Image = mtb.LastProcessedImage.CreatePixbuf(); } else { imageAreaOriginal.Image = null; imageAreaProcessed.Image = null; } }