原文:Win8Metro(C#)数字图像处理--2.17图像木刻效果



[函数名称]

图像木刻效果函数WoodCutProcess(WriteableBitmap
src)

[函数代码]

///<summary>

///
Wood cut process.

///</summary>

///<param
name="src">Source image.</param>

///<returns></returns>

publicstaticWriteableBitmap
WoodCutProcess(WriteableBitmap src)////17木刻处理

{

if(src!=null
)

{

int
w = src.PixelWidth;

int
h = src.PixelHeight;

WriteableBitmap
woodcutImage =newWriteableBitmap(w,h);

byte[]
temp = src.PixelBuffer.ToArray();

int
tempRGB = 0;

for
(int i = 0; i < temp.Length; i += 4)

{

tempRGB = (int)((temp[i]
+ temp[i + 1] + temp[i + 2]) / 3);

temp[i] = (byte)(tempRGB
> 122.5 ? 0 : 255);

temp[i + 1] = (byte)(tempRGB
> 122.5 ? 0 : 255);

temp[i + 2] = (byte)(tempRGB
> 122.5 ? 0 : 255);

tempRGB = 0;

}

Stream
sTemp = woodcutImage.PixelBuffer.AsStream();

sTemp.Seek(0,
SeekOrigin.Begin);

sTemp.Write(temp, 0, w * 4 * h);

return
woodcutImage;

}

else

{

returnnull;

}

}

[图像效果]

Win8Metro(C#)数字图像处理--2.17图像木刻效果的更多相关文章

  1. Win8Metro(C#)数字图像处理--2.15图像霓虹效果

    原文:Win8Metro(C#)数字图像处理--2.15图像霓虹效果  [函数名称] 图像霓虹效果函数NeonProcess(WriteableBitmap src) 上述公式进行开方即可. [函 ...

  2. Win8Metro(C#)数字图像处理--2.3图像反色

    原文:Win8Metro(C#)数字图像处理--2.3图像反色 [函数名称] 图像反色函数ContraryProcess(WriteableBitmap src) [算法说明]     反色公式如下: ...

  3. Win8Metro(C#)数字图像处理--2.33图像非线性变换

    原文:Win8Metro(C#)数字图像处理--2.33图像非线性变换  [函数名称] 图像非线性变换函数NonlinearTransformProcess(WriteableBitmap src ...

  4. Win8Metro(C#)数字图像处理--2.32图像曝光算法

    原文:Win8Metro(C#)数字图像处理--2.32图像曝光算法  [函数名称] 图像曝光函数ExposureProcess(WriteableBitmap src,int exposureV ...

  5. Win8Metro(C#)数字图像处理--2.27图像加法运算

    原文:Win8Metro(C#)数字图像处理--2.27图像加法运算  [函数名称] 图像加法函数AddProcess(WriteableBitmap src, WriteableBitmap a ...

  6. Win8Metro(C#)数字图像处理--2.28图像乘法运算

    原文:Win8Metro(C#)数字图像处理--2.28图像乘法运算  [函数名称] 图像乘法函数MultiplicationProcess(WriteableBitmap src, Writea ...

  7. Win8Metro(C#)数字图像处理--2.29图像除法运算

    原文:Win8Metro(C#)数字图像处理--2.29图像除法运算  [函数名称] 图像除法函数DivisionProcess(WriteableBitmap src, WriteableBit ...

  8. Win8Metro(C#)数字图像处理--2.26图像减法

    原文:Win8Metro(C#)数字图像处理--2.26图像减法  [函数名称] 图像减法函数SubtractionProcess(WriteableBitmap src, WriteableBi ...

  9. Win8Metro(C#)数字图像处理--2.19图像水平镜像

    原文:Win8Metro(C#)数字图像处理--2.19图像水平镜像  [函数名称] 图像水平镜像函数MirrorXProcess(WriteableBitmap src) [函数代码]      ...

随机推荐

  1. 关于MD5值加密算法

    public static string getMD5(string str)//该方法获取字符串的md5加密 通经常使用来验证数据     {         System.Security.Cry ...

  2. 【u022】车的放置

    [问题描述] [题解] 先考虑一个最简单的情况.如一个n*n的棋盘.然后要放k个车. 我们可以先选出k行即C(n,k); 然后在列上对这k个棋子进行一次全排列即A(n,k); 比如k = 4;N=5 ...

  3. 【icpc网络赛大连赛区】Sparse Graph

    Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submissi ...

  4. [NPM] List available npm scripts and support tab completion

    In this lesson we will look at different ways you can list the available npm scripts. Whether we wan ...

  5. [Django] Start a new django project

    Assume we already have a env created call 'demo-env': cd demo-env . bin/activate pip install django ...

  6. redis持久化,主从及数据备份

    http://blog.csdn.net/lang_man_xing/article/details/38386113 现在在项目里已经大量使用redis了,为了提高redis的性能和可靠性我们需要知 ...

  7. Linux中export导入环境变量的几种方式

    1.首先类似于windows中的设定系统环境变量的方式为,在/etc/profile中 export PATH=$PATH:....:... 注意间隔符为: 然后复用原来路径是$PATH的方式 2.用 ...

  8. 选择性编译代码:如 #ifdef __IPHONE_7_0

    选择性编译代码: 选择性编译代码和选择性运行代码是不一样的,区别在于: 1.选择性编译代码是在硬件或者系统不支持的情况下不会对该段代码进行编译,也就不会由于不兼容的问题导致报错 #import < ...

  9. 【codeforces 782A】Andryusha and Socks

    [题目链接]:http://codeforces.com/contest/782/problem/A [题意] 如果手套没有成一双,那么其中的一只就会被放在桌子上; 问你桌子上手套的只数最多的时候有几 ...

  10. JavaScript函数实现鼠标指向后带图片的提示效果

    转载:http://www.cnblogs.com/jack86514/archive/2009/04/01/1427584.html 当我们在写一个网页程序的时候,很多方法可以提供页面的动态显示,从 ...