国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#圖像處理之木刻效果實現(xiàn)方法

2020-01-24 01:55:59
字體:
供稿:網(wǎng)友

本文實例講述了C#圖像處理之木刻效果實現(xiàn)方法。分享給大家供大家參考。具體如下:

//木刻效果public Bitmap PFilterMuKe(Bitmap src){ try {  Bitmap a = new Bitmap(src);  Rectangle rect = new Rectangle(0, 0, a.Width, a.Height);  System.Drawing.Imaging.BitmapData bmpData = a.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb);  int stride = bmpData.Stride;  unsafe  {   byte* pIn = (byte*)bmpData.Scan0.ToPointer();   byte* P;   int R, G, B;   int temp = 0;   for (int y = 0; y < a.Height; y++)   {   for (int x = 0; x < a.Width; x++)   {    P = pIn;    B = P[0];    G = P[1];    R = P[2];    temp = (byte)((B + G + R) / 3);    if (temp >= 122.5)    {    P[2] = 0;    P[1] = 0;    P[0] = 0;    }    else    {    P[2] = (byte)255;    P[1] = (byte)255;    P[0] = (byte)255;    }    pIn += 3;   }   pIn += stride - a.Width * 3;   }  }  a.UnlockBits(bmpData);  return a; } catch (Exception e) {  MessageBox.Show(e.Message.ToString());  return null; }}

原圖:

效果圖:

希望本文所述對大家的C#程序設計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 梅州市| 共和县| 黑水县| 沁阳市| 深水埗区| 额敏县| 汕头市| 石城县| 合山市| 玛纳斯县| 繁昌县| 廉江市| 英德市| 利辛县| 尼勒克县| 龙里县| 新田县| 浦东新区| 南漳县| 合山市| 紫阳县| 兴山县| 重庆市| 嘉定区| 沅陵县| 饶平县| 深圳市| 新邵县| 宜良县| 两当县| 尼勒克县| 固原市| 禄丰县| 长寿区| 个旧市| 巫山县| 平谷区| 澄城县| 田阳县| 错那县| 青岛市|