emgucv二值化

private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            if (op.ShowDialog() == DialogResult.OK)
            {
                //载入原图
                Mat src = new Mat(op.FileName, Emgu.CV.CvEnum.LoadImageType.Grayscale);
                ib_original.Image = src;

                //二值化
                Mat dst = new Mat();
                //CvInvoke.Threshold(src, dst, Convert.ToInt32(num_threthod.Value), 255,
                //    Emgu.CV.CvEnum.ThresholdType.Binary);
                

                //自适应阈值
                CvInvoke.AdaptiveThreshold(src, dst, 255, Emgu.CV.CvEnum.AdaptiveThresholdType.GaussianC,
                    Emgu.CV.CvEnum.ThresholdType.Binary, 3, 0);

                ib_result.Image = dst;
            }
        }

 

你可能感兴趣的:(#,EmguCv)