private void VerifyButton_Click(object sender, RoutedEventArgs e) { //zainicjalizowana sygnatura z inkCanvas var signature = getSignatureFromInkCanvas(); //zainicjalizowane ORYGINALNE sygnatury od wybranego autora z comboBoxa var signatureListAll = getOriginalSignaturesFromAuthor(); //wagi autora var weights = getAuthorWeights(); List <Signature> signatureList = new List <Signature>(); int i = 0; foreach (var s in signatureListAll) { if (i >= weights.getBasicCount()) { break; } signatureList.Add(s); i++; } //MIEJSCE NA METODĘ DO POROWNYWANIA PODPISOW SignVerification signVerification = new SignVerification(); var finalScores = signVerification.init(signature, signatureList, weights); //MIEJSCE NA METODĘ DO POROWNYWANIA PODPISOW //wyczyszczenie ekranu inkCanvas1.InkPresenter.StrokeContainer.Clear(); //wyświetlenie listy rezultatów this.resultList.Items.Clear(); double bestResult = 0; foreach (var score in finalScores) { if (score > bestResult) { bestResult = score; } this.resultList.Items.Add(score); } //wyświetlenie rezultatu końcowego String result = "REZULTAT"; this.resultText.Text = "Najlepszy rezultat: " + bestResult; }
private void StartButton_Click(object sender, RoutedEventArgs e) { this.resultList.Items.Clear(); var originalAll = getOriginalSignaturesFromAuthor(); var fake = getFakeSignaturesFromAuthor(); var weights = getAuthorWeights(); List <Signature> originalTest = new List <Signature>(); List <Signature> originalBasic = new List <Signature>(); //Oddzielenie oryginalnych podpisow bazowych od testowych do sprawdzenia (basicCount ustala sie w klasie Weight) int temp = 0; foreach (Signature s in originalAll) { if (temp < weights.getBasicCount()) { originalBasic.Add(s); } else { originalTest.Add(s); } temp++; } SignVerification signVerification = new SignVerification(); //int hmm = 1; //Weryfikacja podpisow branych jako baza do liczenia wag i weryfikacji (musi zwracac besta = 1) foreach (Signature s in originalBasic) { //Debug.WriteLine("Basic "+hmm); //hmm++; var finalScores = signVerification.init(s, originalBasic, weights); StringBuilder result = new StringBuilder(); StringBuilder resultTemp = new StringBuilder(); double best = 0; result.Append("Basic: "); foreach (var score in finalScores) { resultTemp.Append(Math.Round(score, 3) + " "); if (score > best) { best = Math.Round(score, 3); } } result.Append("Best = " + best + " | "); result.Append(resultTemp); Debug.WriteLine(result); this.resultList.Items.Add(result); } //hmm = 1; //Weryfikacja oryginalnych podpisow ktore sa w bazie danych (bez tych branych jako baza do wag i weryfikacji) foreach (Signature s in originalTest) { //Debug.WriteLine("Test "+hmm); //hmm++; var finalScores = signVerification.init(s, originalBasic, weights); StringBuilder result = new StringBuilder(); StringBuilder resultTemp = new StringBuilder(); double best = 0; result.Append("Original: "); foreach (var score in finalScores) { resultTemp.Append(Math.Round(score, 3) + " "); if (score > best) { best = Math.Round(score, 3); } } result.Append("Best = " + best + " | "); result.Append(resultTemp); Debug.WriteLine(result); this.resultList.Items.Add(result); } //hmm = 1; //Weryfikacja podrobionych podpisow ktore sa w bazie danych foreach (Signature s in fake) { //Debug.WriteLine("Fake "+hmm); //hmm++; var finalScores = signVerification.init(s, originalBasic, weights); StringBuilder result = new StringBuilder(); StringBuilder resultTemp = new StringBuilder(); double best = 0; result.Append("Fake: "); foreach (var score in finalScores) { resultTemp.Append(Math.Round(score, 3) + " "); if (score > best) { best = Math.Round(score, 3); } } result.Append("Best = " + best + " | "); result.Append(resultTemp); Debug.WriteLine(result); this.resultList.Items.Add(result); } }