//чб изображение private void button4_Click(object sender, EventArgs e) { if (sourceImage == null) { MessageBox.Show("Выберите изображение", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { imageBox2.Image = BandW.BW(sourceImage).Resize(320, 240, Inter.Linear); } }
public static Image <Bgr, byte> Ctn(Image <Bgr, byte> sourceImage) { var Imag1 = sourceImage.Copy().Resize(320, 240, Inter.Linear); var Imag2 = Imag1; double k = 1; Imag1 = BandW.BW(Imag1).Resize(320, 240, Inter.Linear).Convert <Bgr, byte>(); Imag1 = Blur.BlurImg(Imag1).Resize(320, 240, Inter.Linear); var edges = Imag1.Convert <Gray, byte>(); edges = edges.ThresholdAdaptive(new Gray(100), AdaptiveThresholdType.MeanC, ThresholdType.Binary, 3, new Gray(0.03)); Imag1 = Add.AddImg(k, k, Imag2, edges.Convert <Bgr, byte>()).Resize(320, 240, Inter.Linear); return(Imag1); }