private void Compare(object sender, EventArgs e) { Bitmap BM1 = new Bitmap(pictureBox1.Image); Bitmap BM2 = new Bitmap(pictureBox2.Image); textBox1.Text = ImageManipulation.CompareImages(BM1, BM2).ToString(); }
private void DisplayMostReoccuringColor() { Bitmap image = new Bitmap(50, 50); Graphics gfx = Graphics.FromImage(image); Color color = ImageManipulation.FindTheMostReoccuringColor(new Bitmap(pictureBox1.Image)); SolidBrush brush = new SolidBrush(color); gfx.FillRectangle(brush, 0, 0, 50, 50); pictureBox4.Image = image; textBox6.Text = color.ToString(); UploadedImageBitmap.MainColor = color; }
private void LaplacianCompare(object sender, EventArgs e) { bool grayscale = true; Bitmap BM1 = ImageFilter.Laplacian3x3Filter(new Bitmap(pictureBox1.Image), grayscale); Bitmap BM2 = ImageFilter.Laplacian3x3Filter(new Bitmap(pictureBox2.Image), grayscale); ImageFilter.DrawOutlineFromLaplacian(BM1, Color.FromArgb(0, 0, 0), Color.Red); ImageFilter.DrawOutlineFromLaplacian(BM2, Color.FromArgb(0, 0, 0), Color.Red); ImageFilter.ReplaceColor(BM1, Color.FromArgb(0, 0, 0), Color.Empty); ImageFilter.ReplaceColor(BM1, Color.FromArgb(0, 0, 0), Color.Empty); pictureBox1.Image = BM1; pictureBox2.Image = BM2; textBox1.Text = ImageManipulation.CompareImages(BM1, BM2).ToString(); }
private async void SortingByFolders(object sender, EventArgs e) { CommonOpenFileDialog folderDialog = new CommonOpenFileDialog { InitialDirectory = "c:\\Users", IsFolderPicker = true }; if (folderDialog.ShowDialog() == CommonFileDialogResult.Ok) { textBox5.Text = folderDialog.FileName; string[] arrayOfImagePaths = Directory.GetFiles(folderDialog.FileName); foreach (var Filepath in arrayOfImagePaths) { pictureBox2.Image = new Bitmap(Filepath); textBox1.Text = ImageManipulation.CompareImages(new Bitmap(pictureBox1.Image), new Bitmap(pictureBox2.Image)).ToString(); await Task.Delay(1000); } } }