//灰度化
 private void menu2Gray_Click(object sender, EventArgs e)
 {
     if (showBitmap == null) return;
     aNyoNe.BitMapHandle.GrayLevelHandle hnd = new BitMapHandle.GrayLevelHandle();
     Bitmap grayMap=hnd.GrayHandle(showBitmap,0.299, 0.587, 0.114, aNyoNe.BitMapHandle.GrayHandleMethod.PixelFunc);
     aNyoNe.BitMapHandle.ThresholdCompute com = new BitMapHandle.ThresholdCompute();
     aNyoNe.BitMapHandle.BinaryzationHandle bi=new BitMapHandle.BinaryzationHandle();
     showBitmap=grayMap = bi.BitmapBinaryzation(grayMap, com.OtsuThreshold(grayMap));
     //aNyoNe.BitMapHandle.DenoisingHandle de = new BitMapHandle.DenoisingHandle();
     //showBitmap = de.ClearNoise(grayMap,com.GetDgGrayValue(grayMap),2);
     //showBitmap = de.ClearNoise(grayMap, com.GetDgGrayValue(grayMap)-100);
     this.Invalidate();
 }
Beispiel #2
0
        //灰度化
        private void menu2Gray_Click(object sender, EventArgs e)
        {
            if (showBitmap == null)
            {
                return;
            }
            aNyoNe.BitMapHandle.GrayLevelHandle hnd = new BitMapHandle.GrayLevelHandle();
            Bitmap grayMap = hnd.GrayHandle(showBitmap, 0.299, 0.587, 0.114, aNyoNe.BitMapHandle.GrayHandleMethod.PixelFunc);

            aNyoNe.BitMapHandle.ThresholdCompute   com = new BitMapHandle.ThresholdCompute();
            aNyoNe.BitMapHandle.BinaryzationHandle bi  = new BitMapHandle.BinaryzationHandle();
            showBitmap = grayMap = bi.BitmapBinaryzation(grayMap, com.OtsuThreshold(grayMap));
            //aNyoNe.BitMapHandle.DenoisingHandle de = new BitMapHandle.DenoisingHandle();
            //showBitmap = de.ClearNoise(grayMap,com.GetDgGrayValue(grayMap),2);
            //showBitmap = de.ClearNoise(grayMap, com.GetDgGrayValue(grayMap)-100);
            this.Invalidate();
        }