Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法
原文:Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法
[函数名称]
图像雾化 AtomizationProcess(WriteableBitmap src,int v)
[算法说明]
<strong> /// <summary>
/// Atomization process.
/// </summary>
/// <param name="src">The source image.</param>
/// <param name="v">The threshould to control the effect of atomization.</param>
/// <returns></returns>
public static WriteableBitmap AtomizationProcess(WriteableBitmap src,int v)////45图像雾化
{
if (src != null)
{
int w = src.PixelWidth;
int h = src.PixelHeight;
WriteableBitmap srcImage = new WriteableBitmap(w, h);
byte[] temp = src.PixelBuffer.ToArray();
byte[] tempMask = (byte[])temp.Clone();
Random ran = new Random();
int k = 0;
int dx = 0;
int dy = 0;
for (int j = 0; j < h; j++)
{
for (int i = 0; i < w; i ++)
{
k = ran.Next(v);
dx = (i + k) >= w ? w - 1 : (i + k);
dy = (j + k) >= h ? h - 1 : (j + k);
temp[i * 4 + j * w * 4] = (byte)tempMask[dx * 4 + dy * w * 4];
temp[i * 4 + 1 + j * w * 4] = (byte)tempMask[dx * 4 + 1 + dy * w * 4];
temp[i * 4 + 2 + j * w * 4] = (byte)tempMask[dx * 4 + 2 + dy * w * 4];
}
}
Stream sTemp = srcImage.PixelBuffer.AsStream();
sTemp.Seek(0, SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return srcImage;
}
else
{
return null;
}
}</strong>
[图像效果]
Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法的更多相关文章
- Win8 Metro(C#)数字图像处理--2.42图像光照效果算法
原文:Win8 Metro(C#)数字图像处理--2.42图像光照效果算法 [函数名称] 图像光照效果 SunlightProcess(WriteableBitmap src,int X,in ...
- Win8 Metro(C#)数字图像处理--3.2图像方差计算
原文:Win8 Metro(C#)数字图像处理--3.2图像方差计算 /// <summary> /// /// </summary>Variance computing. / ...
- Win8 Metro(C#)数字图像处理--3.3图像直方图计算
原文:Win8 Metro(C#)数字图像处理--3.3图像直方图计算 /// <summary> /// Get the array of histrgram. /// </sum ...
- Win8 Metro(C#)数字图像处理--3.4图像信息熵计算
原文:Win8 Metro(C#)数字图像处理--3.4图像信息熵计算 [函数代码] /// <summary> /// Entropy of one image. /// </su ...
- Win8 Metro(C#)数字图像处理--3.5图像形心计算
原文:Win8 Metro(C#)数字图像处理--3.5图像形心计算 /// <summary> /// Get the center of the object in an image. ...
- Win8 Metro(C#)数字图像处理--3.1图像均值计算
原文:Win8 Metro(C#)数字图像处理--3.1图像均值计算 /// <summary> /// Mean value computing. /// </summary> ...
- Win8 Metro(C#)数字图像处理--2.74图像凸包计算
原文:Win8 Metro(C#)数字图像处理--2.74图像凸包计算 /// <summary> /// Convex Hull compute. /// </summary> ...
- Win8 Metro(C#)数字图像处理--2.68图像最小值滤波器
原文:Win8 Metro(C#)数字图像处理--2.68图像最小值滤波器 /// <summary> /// Min value filter. /// </summary> ...
- Win8 Metro(C#)数字图像处理--2.52图像K均值聚类
原文:Win8 Metro(C#)数字图像处理--2.52图像K均值聚类 [函数名称] 图像KMeans聚类 KMeansCluster(WriteableBitmap src,i ...
随机推荐
- c头文件(.h)的作用
C语言的著作中,至今还没发现把.h文件的用法写的透彻的.在实际应用中也只能依葫芦画瓢,只知其然不知其所以然,甚是郁闷!闲来无事,便将搜集网络的相关内容整理一下,以便加深自己的理解 理论概述:.h中一般 ...
- 【44.19%】【codeforces 608D】Zuma
time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard o ...
- 【87.65%】【codeforces 731A】Night at the Museum
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Android Studio运行main方法
这样想做一些测试就很简单了 实现步骤如下: 1.当前项目右键->new->Module->Java Library 2.修改你创建javaLib的build.gradle文件 改为( ...
- Android中自定义View和自定义动画
Android FrameWork 层给我们提供了很多界面组件,但是在实际的商业开发中这些组件往往并不能完全满足我们的需求,这时候我们就需要自定义我们自己的视图和动画. 我们要重写系统的View就必须 ...
- jQuery怎么选择两个class属性
Jquery选择多个Class属性: $('.className1,.className2,.className4,.className5')
- Windows PowerShell 学习之——Cmdlet处理生命周期
这一次介绍一下Cmdlet处理过程的生命周期 总共分为六个部分 1.概述 2. 命令行输入绑定参数(parameters) 3. 开始指令处理 4. 接受管道输入绑定参数 5. 处理记录 6. 处理记 ...
- 如若已在管理后台更新域名配置,请刷新项目配置后重新编译项目,操作路径:“项目-域名信息” http://www.mysite.com 不在以下 request 合法域名列表中
报错如图 报错文字如下: 如若已在管理后台更新域名配置,请刷新项目配置后重新编译项目,操作路径:“项目-域名信息” http://www.mysite.net 不在以下 request 合法域名列表中 ...
- JS 实现Map
function Map() { this.arr = new Array(); var struct = function(key, value) { this.key = key; this.va ...
- [转] css3制作图形大全
Square #square { width: 100px; height: 100px; background: red; } Rectangle #rectangl ...