private void MatchButtonClick(object sender, EventArgs e) { List <Minutia> minutiasFrom = GetMinutiasFrom(ImageFrom); MessageBox.Show("Found " + minutiasFrom.Count + " minutias in left picture."); List <Classes.Point> pointsFrom = new List <Classes.Point>(); Graphics ImageFromGraphics = ImageFrom.CreateGraphics(); foreach (Minutia m in minutiasFrom) { Classes.Point p = new Classes.Point(m.X, ImageFrom.Height - m.Y + 1); p.Paint(ImageFromGraphics, defPointPen, ImageFrom.Height); pointsFrom.Add(p); } if (minutiasFrom.Count > 500) { string messageBoxText = "Do you really want to continue?\n You'll just waste your time..."; string caption = "Too many minutuias"; MessageBoxButtons mb = MessageBoxButtons.OKCancel; if (MessageBox.Show(messageBoxText, caption, mb) == System.Windows.Forms.DialogResult.Cancel) { return; } } Classes.TriangulationBuilder tb = new Classes.TriangulationBuilder(pointsFrom); MessageBox.Show("Triangulation built! It has: " + tb.triangles.Count + " triangles."); List <Classes.Triangle> triangulationFrom = tb.triangles; foreach (Classes.Triangle t in tb.triangles) { t.Paint(ImageFromGraphics, defLinePen, defPointPen, ImageFrom.Height); } List <Minutia> minutiasTo = GetMinutiasFrom(ImageTo); MessageBox.Show("Found " + minutiasTo.Count + " minutias in right picture"); List <Classes.Point> pointsTo = new List <Classes.Point>(); Graphics ImageToGraphics = ImageTo.CreateGraphics(); foreach (Minutia m in minutiasTo) { Classes.Point p = new Classes.Point(m.X, ImageTo.Height - m.Y + 1); p.Paint(ImageToGraphics, defPointPen, ImageTo.Height); pointsTo.Add(p); } if (minutiasTo.Count > 500) { string messageBoxText = "Do you really want to continue?\n You'll just waste your time..."; string caption = "Too many minutuias"; MessageBoxButtons mb = MessageBoxButtons.OKCancel; if (MessageBox.Show(messageBoxText, caption, mb) == System.Windows.Forms.DialogResult.Cancel) { return; } } Classes.TriangulationBuilder tbTo; if (minutiasTo.Count < 500) { tbTo = new Classes.TriangulationBuilder(pointsTo); } else { tbTo = new Classes.TriangulationBuilder(pointsTo, ImageToGraphics, defLinePen, defPointPen, new Pen(Color.Gold, 1), ImageTo.Height, 0); } MessageBox.Show("Triangulation built! It has: " + tbTo.triangles.Count + " triangles."); List <Classes.Triangle> triangulationTo = tbTo.triangles; foreach (Classes.Triangle t in tbTo.triangles) { t.Paint(ImageToGraphics, defLinePen, defPointPen, ImageFrom.Height); } Classes.TriangulationsMatcher tm = new Classes.TriangulationsMatcher(triangulationFrom, triangulationTo); double[] result = tm.Match(0.001, 90); MessageBox.Show("Equals: " + result[0] + ", very close:" + result[1]); }
private void MatchButtonClick(object sender, EventArgs e) { List<Minutia> minutiasFrom = GetMinutiasFrom(ImageFrom); MessageBox.Show("Found " + minutiasFrom.Count + " minutias in left picture."); List<Classes.Point> pointsFrom = new List<Classes.Point>(); Graphics ImageFromGraphics = ImageFrom.CreateGraphics(); foreach (Minutia m in minutiasFrom) { Classes.Point p = new Classes.Point(m.X, ImageFrom.Height - m.Y+1); p.Paint(ImageFromGraphics, defPointPen, ImageFrom.Height); pointsFrom.Add(p); } if (minutiasFrom.Count > 500) { string messageBoxText = "Do you really want to continue?\n You'll just waste your time..."; string caption = "Too many minutuias"; MessageBoxButtons mb = MessageBoxButtons.OKCancel; if (MessageBox.Show(messageBoxText, caption, mb) == System.Windows.Forms.DialogResult.Cancel) return; } Classes.TriangulationBuilder tb = new Classes.TriangulationBuilder(pointsFrom); MessageBox.Show("Triangulation built! It has: "+tb.triangles.Count+" triangles."); List<Classes.Triangle> triangulationFrom = tb.triangles; foreach (Classes.Triangle t in tb.triangles) { t.Paint(ImageFromGraphics, defLinePen, defPointPen, ImageFrom.Height); } List<Minutia> minutiasTo = GetMinutiasFrom(ImageTo); MessageBox.Show("Found " + minutiasTo.Count + " minutias in right picture"); List<Classes.Point> pointsTo = new List<Classes.Point>(); Graphics ImageToGraphics = ImageTo.CreateGraphics(); foreach (Minutia m in minutiasTo) { Classes.Point p = new Classes.Point(m.X, ImageTo.Height - m.Y+1); p.Paint(ImageToGraphics, defPointPen, ImageTo.Height); pointsTo.Add(p); } if (minutiasTo.Count > 500) { string messageBoxText = "Do you really want to continue?\n You'll just waste your time..."; string caption = "Too many minutuias"; MessageBoxButtons mb = MessageBoxButtons.OKCancel; if (MessageBox.Show(messageBoxText, caption, mb) == System.Windows.Forms.DialogResult.Cancel) return; } Classes.TriangulationBuilder tbTo; if (minutiasTo.Count < 500) tbTo = new Classes.TriangulationBuilder(pointsTo); else tbTo = new Classes.TriangulationBuilder(pointsTo, ImageToGraphics, defLinePen, defPointPen, new Pen(Color.Gold, 1), ImageTo.Height, 0); MessageBox.Show("Triangulation built! It has: " + tbTo.triangles.Count + " triangles."); List<Classes.Triangle> triangulationTo = tbTo.triangles; foreach (Classes.Triangle t in tbTo.triangles) { t.Paint(ImageToGraphics, defLinePen, defPointPen, ImageFrom.Height); } Classes.TriangulationsMatcher tm = new Classes.TriangulationsMatcher(triangulationFrom, triangulationTo); double[] result = tm.Match(0.001,90); MessageBox.Show("Equals: " + result[0] + ", very close:" + result[1]); }