private void btnCheck_Click(object sender, EventArgs e) { try { dt = db.GetData(); if (videoSource.IsRunning || capture != null) { videoSource.Stop(); //capture.Dispose(); } Detection(); //transferring the image into the next form i-e Picture Comparison PictureComparison obj = new PictureComparison(); obj.img = new Image <Gray, byte>(faceDetected); obj.histogramBox1.ClearHistogram(); obj.histogramBox1.AddHistogram("Picture histogram", Color.Blue, mat1, 256, new float[] { 0.0f, 255.0f }); obj.histogramBox1.Refresh(); obj.SetIndex(index + 1); if (index > -1) { obj.histogramBox2.ClearHistogram(); obj.histogramBox2.AddHistogram("Picture histogram", Color.Blue, mat2, 256, new float[] { 0.0f, 255.0f }); obj.histogramBox2.Refresh(); obj.img1 = new Image <Gray, byte>(dt.Rows[index].ItemArray[0].ToString()); } obj.Show(); this.Hide(); }catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void button1_Click(object sender, EventArgs e) { try { dt = db.GetData(); Detection(); PictureComparison obj = new PictureComparison(); obj.img = new Image <Gray, byte>(pbDetectedFace.Image.Bitmap); obj.histogramBox1.ClearHistogram(); obj.histogramBox1.AddHistogram("Picture histogram", Color.Blue, mat1, 256, new float[] { 0.0f, 255.0f }); obj.histogramBox1.Refresh(); obj.SetIndex(index + 1); if (index > -1) { obj.histogramBox2.ClearHistogram(); obj.histogramBox2.AddHistogram("Picture histogram", Color.Blue, mat2, 256, new float[] { 0.0f, 255.0f }); obj.histogramBox2.Refresh(); obj.img1 = new Image <Gray, byte>(dt.Rows[index].ItemArray[0].ToString()); } obj.Show(); this.Hide(); } catch (IOException io) { MessageBox.Show(io.Message); } catch (Exception ee) { MessageBox.Show(ee.Message); } }