emgucv二值化
阿新 • • 發佈:2019-01-06
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; } }