private void 逆谐波均值滤波器ToolStripMenuItem_Click(object sender, EventArgs e) { checkPictureBox1(); if (!valid) { return; } PassValueForm form = new PassValueForm(); form.setTextBox2_unvisible(); form.Owner = this; form.Description = "输入逆谐波参数Q"; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { int parameter = Convert.ToInt32(form.Value); Bitmap bit = new Bitmap(pictureBox1.Image); pictureBox2.Refresh(); pictureBox2.Image = GraphicClass.AvgFilter(bit, 3, parameter); pictureBox3.Image = GraphicClass.drawHistogram(new Bitmap(pictureBox1.Image)); pictureBox4.Image = GraphicClass.drawHistogram(new Bitmap(pictureBox2.Image)); } }
private void 指数噪声ToolStripMenuItem_Click(object sender, EventArgs e) { checkPictureBox1(); if (!valid) { return; } Bitmap bit = new Bitmap(pictureBox1.Image); PassValueForm form = new PassValueForm(); form.setTextBox2_unvisible(); form.Owner = this; form.Description = "输入指数噪声参数(0.01~0.2之间最佳)"; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { pictureBox2.Refresh(); double value1 = Convert.ToDouble(form.Value); double value2 = Convert.ToDouble(form.Value1); //noise generator pictureBox2.Image = GraphicClass.noiseGenerator(bit, value1, value2, 3); pictureBox3.Image = GraphicClass.drawHistogram(new Bitmap(pictureBox1.Image)); pictureBox4.Image = GraphicClass.drawHistogram(new Bitmap(pictureBox2.Image)); } }
private void 高提升滤波ToolStripMenuItem_Click(object sender, EventArgs e) { checkPictureBox1(); if (!valid) { return; } //float tmp = (float)(1.0 / 9.0); //float[] a = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; float tmp = (float)(1.0 / 16.0); float[] a = { tmp, 2 * tmp, tmp, 2 * tmp, 4 * tmp, 2 * tmp, tmp, 2 * tmp, tmp }; Bitmap bit = new Bitmap(pictureBox1.Image); Bitmap gmask = GraphicClass.subtractPicture(bit, GraphicClass.mask(a, bit)); PassValueForm form = new PassValueForm(); form.Owner = this; form.Description = "输入参数"; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { pictureBox2.Refresh(); double ar = Convert.ToDouble(form.Value); pictureBox2.Image = GraphicClass.addPicture(bit, gmask, (int)ar); } }
private void bilinerToolStripMenuItem_Click(object sender, EventArgs e) { checkPictureBox1(); if (!valid) { return; } Bitmap bit = new Bitmap(pictureBox1.Image); PassValueForm form = new PassValueForm(); form.Owner = this; form.Description = "输入要变化成的分辨率, 上面为宽,下面为长"; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { pictureBox2.Refresh(); int width = Convert.ToInt32(form.Value); int height = Convert.ToInt32(form.Value1); pictureBox2.Image = GraphicClass.bilinearInterpolation(bit, width, height); } }
private void kirsch算子ToolStripMenuItem_Click(object sender, EventArgs e) { if (pictureBox1.Image == null) { return; } Bitmap bit = new Bitmap(pictureBox1.Image); Bitmap graybit = GraphicClass.convertRGB2Gray(bit); PassValueForm form = new PassValueForm(); form.Owner = this; form.Description = "输入阙值"; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { pictureBox2.Refresh(); double value1 = Convert.ToDouble(form.Value); pictureBox2.Image = GraphicClass.kirsch(graybit, value1); } }