ComputeThresholdValue() 공개 정적인 메소드

public static ComputeThresholdValue ( Bitmap img ) : int
img System.Drawing.Bitmap
리턴 int
예제 #1
0
        /// <summary>
        /// 去背景
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_bg_Click(object sender, EventArgs e)
        {
            Image img_noise = (Image)pb_grey.Image.Clone();
            //得到灰度图像前景色临界值

            // img_noise = ccccccmd.ImageHelper.RemoveBlock(img_noise,2);//报错
            //int v = ImageProcess.GetDgGrayValue(img_noise);
            int v = ImageProcess.ComputeThresholdValue((Bitmap)img_noise);
            //Image test = ImageProcess.RemoveBg((Bitmap)img_noise ,v );
            // int v2 = Test.ImageProcess.GetDgGrayValue(img_noise);
            Image img_bg = ImageProcess.RemoveBg((Bitmap)img_noise, v); //-----------去背景,内存法

            imgBged = Image2Num((Bitmap)img_bg);
            WriteToFile(imgBged, "experiment\\" + Path.GetFileNameWithoutExtension(imgurl) + "_bged.txt");
            pb_bg.Image = img_bg;
        }