// Hit & Miss mathematical morphology operator public void hitAndMissFiltersItem_Click(object sender, System.EventArgs e) { if (image.PixelFormat != PixelFormat.Format8bppIndexed) { MessageBox.Show("Hit & Miss morpholgy filters can by applied to binary image only", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } MathMorphologyForm form = new MathMorphologyForm(MathMorphologyForm.FilterTypes.HitAndMiss); form.Image = image; if (form.ShowDialog() == DialogResult.OK) { ApplyFilter(form.Filter); } }
// Custom morphology operator private void Morphology() { if (image.PixelFormat != PixelFormat.Format8bppIndexed) { MessageBox.Show("Mathematical morpholgy filters can by applied to grayscale image only", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } MathMorphologyForm form = new MathMorphologyForm(MathMorphologyForm.FilterTypes.Simple); form.Image = image; if (form.ShowDialog() == DialogResult.OK) { ApplyFilter(form.Filter); } }