private void btn_apply_Click(object sender, EventArgs e) { NeighborOperations Filters = new NeighborOperations(); Picture pic = new Picture(); Color [,] input = pic.Buffering(temp); if (type_v == 1) { //mean filter Color[,] Result = Filters.MeanFilter(input, int.Parse(MaskWidth.Text), int.Parse(MaskHeight.Text), int.Parse(OrignX.Text), int.Parse(OriginY.Text)); temp = pic.convert_Buffer_to_Bitmap(Result, Result.GetLength(0), Result.GetLength(1)); pic_modified.Image = temp; } else if (type_v == 2) { //gaussian option1 Color[,] Result = Filters.GaussianFilter1(input,int.Parse(MaskWidth.Text),double.Parse(Sigma.Text),int.Parse(OrignX.Text), int.Parse(OriginY.Text)); temp = pic.convert_Buffer_to_Bitmap(Result, Result.GetLength(0), Result.GetLength(1)); pic_modified.Image = temp; } else if (type_v == 3) { //gaussian option2 Color[,] Result = Filters.GaussianFilter2(input, double.Parse(Sigma.Text), int.Parse(OrignX.Text), int.Parse(OriginY.Text)); temp = pic.convert_Buffer_to_Bitmap(Result, Result.GetLength(0), Result.GetLength(1)); pic_modified.Image = temp; } }
public Bitmap bit_plane_slicing(Color[,] buffer, int _one_byte, string type) { Picture p = new Picture(); int width = buffer.GetLength(0); int height = buffer.GetLength(1); Color[,] res = new Color[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (type == "r") { int result = _one_byte & buffer[i, j].R; if (result == _one_byte) res[i, j] = Color.FromArgb(255, 0, 0); else res[i, j] = Color.FromArgb(0, 0, 0); } else if (type == "g") { int result = _one_byte & buffer[i, j].G; if (result == _one_byte) res[i, j] = Color.FromArgb(0, 255, 0); else res[i, j] = Color.FromArgb(0, 0, 0); } else if (type == "b") { int result = _one_byte & buffer[i, j].B; if (result == _one_byte) res[i, j] = Color.FromArgb(0, 0, 255); else res[i, j] = Color.FromArgb(0, 0, 0); } } } return p.convert_Buffer_to_Bitmap(res, res.GetLength(0), res.GetLength(1)); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { p = new Picture(); string path = p.showDialog(); if (path != null) { string[] seperator = { "\\" }; string[] arr = path.Split(seperator, StringSplitOptions.RemoveEmptyEntries); string img_name = arr[arr.Length - 1]; b = new Bitmap(path); path = null; org_Buffer = p.Buffering(b); final_image = org_Buffer; //pictureBox25.Image = b; ControlTab.Visible = true; create_tabPage(b, img_name); } }