国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 老河口市| 桃源县| 阳东县| 福建省| 柞水县| 文登市| 九寨沟县| 登封市| 玉龙| 墨竹工卡县| 泰和县| 山西省| 苏州市| 铁力市| 白银市| 抚顺县| 迁西县| 逊克县| 永嘉县| 三都| 兴隆县| 柳河县| 泗阳县| 富民县| 饶阳县| 承德县| 新安县| 涞源县| 浑源县| 平武县| 和林格尔县| 民县| 玉龙| 安泽县| 镇原县| 海盐县| 安顺市| 中西区| 长沙市| 红原县| 泸溪县|