原文: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. [Git] Use git add --patch for better commit history and mitigating bugs

    Let's split our changes into separate commits. We'll be able to check over our changes before stagin ...

  2. 基于 Android NDK 的学习之旅----- Java 方法映射到C中的签名

    刚接触JNI 的 兄弟在看一些demo的时候 发现有类似与“([Ljava/lang/String;)V”的东西的时候肯定会很“蛋疼”,完全不懂这是啥东西,怎么来的,有啥用处? 今天就讲讲这个“蛋疼” ...

  3. [NPM] Run npm scripts in parallel

    In this lesson we will look at running several npm scripts in parallel. Sometimes you don’t need scr ...

  4. JAVA中String类的intern()方法的作用

    一般我们变成很少使用到 intern这个方法,今天我就来解释一下这个方法是干什么的,做什么用的 首先请大家看一个例子: public static void main(String[] args) t ...

  5. BZOJ 1864 三色二叉树 - 树型dp

    传送门 题目大意: 给一颗二叉树染色红绿蓝,父亲和儿子颜色必须不同,两个儿子颜色必须不同,问最多和最少能染多少个绿色的. 题目分析: 裸的树型dp:\(dp[u][col][type]\)表示u节点染 ...

  6. 网站多语言转换.利用Google 语言的js.贴到网站就能用.

    <div id="google_translate_element"></div><script>function googleTranslat ...

  7. Android Studio 如何打JAR包(修订版)

    AndroidStudio项目打包成jar 前言:在eclipse中我们知道如何将一个项目导出为jar包,现在普遍AndroidStuido开发,这里一步一步详加介绍AS项目打包成jar,jar和ar ...

  8. simlescalar CPU模拟器源代码分析

    Sim-outorder.c Main性能 Fetch  -->  despetch-->                                issue-->       ...

  9. hibernate annotation 相关主键生成策略

    Hibernate 默认的全面支持 13 物种生成策略 : 1. increment 2.  identity 3. sequence 4. hilo 5. seqhilo 6. uuid 7. uu ...

  10. 【19.27%】【codeforces 618D】Hamiltonian Spanning Tree

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...