private void VotesSharing(ModyficationElement me, int n)//n oznacza ilość głósów { if (me.angle < angleRangeTop && me.angle > angleRangeBottom && me.x < xRangeTop && me.x > xRangeBottom && me.y < yRangeTop && me.y > yRangeBottom) { int accurateAngleCell = (me.angle - angleRangeBottom) / angleJump; int accuratexCell = (me.x - xRangeBottom) / xJump; int accurateyCell = (me.y - yRangeBottom) / yJump; // na wartość ustalonej komórki głosuje się 2 razy a na komórki okalające ją po jednym razie n = 4; AcumulatorVotesSharing(new Point(accuratexCell, accurateyCell), accurateAngleCell, 2, 1); /* acumulator[accurateAngleCell, accuratexCell, accurateyCell] += 3; // * * try * { * acumulator[accurateAngleCell, accuratexCell - 1, accurateyCell - 1] += 1; // * acumulator[accurateAngleCell, accuratexCell - 1, accurateyCell] += 1; // * acumulator[accurateAngleCell, accuratexCell, accurateyCell - 1] += 1; // * acumulator[accurateAngleCell, accuratexCell + 1, accurateyCell + 1] += 1; // * acumulator[accurateAngleCell, accuratexCell + 1, accurateyCell] += 1; // * acumulator[accurateAngleCell, accuratexCell, accurateyCell + 1] += 1; // * acumulator[accurateAngleCell, accuratexCell + 1, accurateyCell - 1] += 1; // * acumulator[accurateAngleCell, accuratexCell - 1, accurateyCell + 1] += 1; // * } * catch (IndexOutOfRangeException ex) * { * * }*/ } }
private void Test(object sender, RoutedEventArgs e) { MinutiaWektor wektor = database.mBase[1].MinutiaesWektor; ModyficationElement przesuniecie = new ModyficationElement(0, 0, 10); MinutiaWektor przesunietyWektor = new MinutiaWektorComperer().MapMinutiaWektor(wektor, przesuniecie); Bitmap b = (Bitmap)orginalBitmap.Clone(); b = MatchMinuties(b, przesunietyWektor); QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(b); }
private Minutia MapMinutia(Minutia m, ModyficationElement em)//działa poprawnie sprawdzone { // em = new ModyficationElement(-10, 5, 30); double angle = ImageSupporter.DegreeToRadian(em.angle); int x = (int)(Math.Cos(angle) * m.p.X - Math.Sin(angle) * m.p.Y + em.x + 0.5); int y = (int)(Math.Sin(angle) * m.p.X + Math.Cos(angle) * m.p.Y + em.y + 0.5); double angle2 = m.direction + angle;//tutaj nie jestem pewny z kontem return(new Minutia(new Point(x, y), angle2, m.kind)); }
public MinutiaWektor MapMinutiaWektor(MinutiaWektor mw, ModyficationElement me)//działa poprawnie sprawdzone { MinutiaWektor newMinutiaWektor = new MinutiaWektor(); foreach (var item in mw.m) { newMinutiaWektor.Add(MapMinutia(item, me)); } return(newMinutiaWektor); }
//główna funkcja w klasie porównująca podobieństwo dwóch odciski palca na podstawie ich wektorów minucji //dane wejściowe: jeden z odcisków z bazy danych i nowy, analizowany odcisk //wyjście: true lub fals decyzja czy odciski są tożsame czy też nie public Tuple <bool, int, ModyficationElement, int> Compere(MinutiaWektor databaseMinutia, MinutiaWektor n) { ClearAcumulator(); Voting(databaseMinutia, n); Tuple <ModyficationElement, int> tuple = BestModyficationChecking(); ModyficationElement best = tuple.Item1; int votingCount = tuple.Item2; MinutiaWektor newMinutiaWektor = MapMinutiaWektor(n, best); int count = HowManyIdenticalMinuties(databaseMinutia, newMinutiaWektor); return(new Tuple <bool, int, ModyficationElement, int>(true, count, best, votingCount)); }
private void ListBox_DoubleClick(object sender, RoutedEventArgs e) { int index = EqualFingerprintList.Items.IndexOf(sender); DatabaseElement chosen = equals[index].Item1; ModyficationElement przesuniecie = equals[index].Item3; MinutiaWektor wektor = temporaryMinutiasMap; MinutiaWektor przesunietyWektor = new MinutiaWektorComperer().MapMinutiaWektor(temporaryMinutiasMap, przesuniecie); Bitmap b = ImageSupporter.BitmapImage2Bitmap(new BitmapImage(new Uri(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\database\\" + chosen.FingerprntName + ".png"))); b = MatchMinuties2(b, przesunietyWektor, Color.Green, Color.Green); MinutiaWektor zbazy = database.mBase[index].MinutiaesWektor; b = MatchMinuties2(b, zbazy, Color.Blue, Color.Blue); b = MatchMinuties2(b, temporaryMinutiasMap, Color.Orange, Color.Orange); QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(b); }
private Tuple <bool, float> Voting(MinutiaWektor froDatabase, MinutiaWektor scaned) { foreach (var d in froDatabase.m) //wekrot minucji z bazy danych { foreach (var n in scaned.m) //wektor minucji analizowanego odcisku { for (int angle = angleRangeBottom; angle < angleRangeTop; angle += angleJump) { // if(dd(ImageSupporter.DegreeToRadian( angle),0)<ImageSupporter.DegreeToRadian(3) && d.p.Equals(n.p)) if (dd(n.direction + ImageSupporter.DegreeToRadian(angle), d.direction) < LimitRotate) { Point tmp = getShift(n, d, ImageSupporter.DegreeToRadian(angle)); ModyficationElement vote = new ModyficationElement(tmp.X, tmp.Y, angle); Vote(vote); } } } } return(new Tuple <bool, float>(false, 0)); }
private void Vote(ModyficationElement me) { dyskretyzation(me); VotesSharing(me, 1); }
private void dyskretyzation(ModyficationElement n)//głosuje za przekształconą minucję w dyskretyzowane miejsce { }