Win8Metro(C#)数字图像处理--2.9图像均值滤波
原文:Win8Metro(C#)数字图像处理--2.9图像均值滤波
[函数名称]
图像均值滤波函数MeanFilterProcess(WriteableBitmap
src)
[函数代码]
///<summary>
///
Mean filter process.
///</summary>
///<param
name="src">Source image</param>
///<returns></returns>
publicstaticWriteableBitmap
MeanFilterProcess(WriteableBitmap src)////9均值滤波处理
{
if(src!=null
)
{
int
w = src.PixelWidth;
int
h = src.PixelHeight;
WriteableBitmap
filterImage =newWriteableBitmap(w,h);
byte[]
temp = src.PixelBuffer.ToArray();
byte[]
tempMask = (byte[])temp.Clone();
for
(int j = 1; j < h - 1; j++)
{
for
(int i = 4; i < w * 4 - 4; i += 4)
{
temp[i + j * w * 4] = (byte)((tempMask[i
- 4 + (j - 1) * w * 4] + tempMask[i + (j - 1) * w * 4] + tempMask[i + 4 + (j - 1) * w * 4]
+ tempMask[i - 4 + j * w * 4] + tempMask[i + 4 + j * w * 4] + tempMask[i
- 4 + (j + 1) * w * 4] + tempMask[i + (j + 1) * w * 4]
+ tempMask[i + 4 + (j + 1) * w * 4]) / 8);
temp[i + 1 + j * w * 4] = (byte)((tempMask[i
- 4 + 1 + (j - 1) * w * 4] + tempMask[i + 1 + (j - 1) * w * 4] + tempMask[i + 1 + 4 + (j - 1) * w * 4]
+ tempMask[i + 1 - 4 + j * w * 4] + tempMask[i + 1 + 4 + j * w *
4] + tempMask[i + 1 - 4 + (j + 1) * w * 4] + tempMask[i + 1 + (j + 1) * w * 4]
+ tempMask[i + 1 + 4 + (j + 1) * w * 4]) / 8);
temp[i + 2 + j * w * 4] = (byte)((tempMask[i
+ 2 - 4 + (j - 1) * w * 4] + tempMask[i + 2 + (j - 1) * w * 4] + tempMask[i + 2 + 4 + (j - 1) * w * 4]
+ tempMask[i + 2 - 4 + j * w * 4] + tempMask[i + 2 + 4 + j * w *
4] + tempMask[i + 2 - 4 + (j + 1) * w * 4] + tempMask[i + 2 + (j + 1) * w * 4]
+ tempMask[i + 2 + 4 + (j + 1) * w * 4]) / 8);
}
}
Stream
sTemp = filterImage.PixelBuffer.AsStream();
sTemp.Seek(0,
SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return
filterImage;
}
else
{
returnnull;
}
}
[图像效果]

Win8Metro(C#)数字图像处理--2.9图像均值滤波的更多相关文章
- Win8 Metro(C#)数字图像处理--3.1图像均值计算
原文:Win8 Metro(C#)数字图像处理--3.1图像均值计算 /// <summary> /// Mean value computing. /// </summary> ...
- Win8Metro(C#)数字图像处理--2.3图像反色
原文:Win8Metro(C#)数字图像处理--2.3图像反色 [函数名称] 图像反色函数ContraryProcess(WriteableBitmap src) [算法说明] 反色公式如下: ...
- Win8Metro(C#)数字图像处理--2.33图像非线性变换
原文:Win8Metro(C#)数字图像处理--2.33图像非线性变换 [函数名称] 图像非线性变换函数NonlinearTransformProcess(WriteableBitmap src ...
- Win8Metro(C#)数字图像处理--2.32图像曝光算法
原文:Win8Metro(C#)数字图像处理--2.32图像曝光算法 [函数名称] 图像曝光函数ExposureProcess(WriteableBitmap src,int exposureV ...
- Win8Metro(C#)数字图像处理--2.27图像加法运算
原文:Win8Metro(C#)数字图像处理--2.27图像加法运算 [函数名称] 图像加法函数AddProcess(WriteableBitmap src, WriteableBitmap a ...
- Win8Metro(C#)数字图像处理--2.28图像乘法运算
原文:Win8Metro(C#)数字图像处理--2.28图像乘法运算 [函数名称] 图像乘法函数MultiplicationProcess(WriteableBitmap src, Writea ...
- Win8Metro(C#)数字图像处理--2.29图像除法运算
原文:Win8Metro(C#)数字图像处理--2.29图像除法运算 [函数名称] 图像除法函数DivisionProcess(WriteableBitmap src, WriteableBit ...
- Win8Metro(C#)数字图像处理--2.26图像减法
原文:Win8Metro(C#)数字图像处理--2.26图像减法 [函数名称] 图像减法函数SubtractionProcess(WriteableBitmap src, WriteableBi ...
- Win8Metro(C#)数字图像处理--2.19图像水平镜像
原文:Win8Metro(C#)数字图像处理--2.19图像水平镜像 [函数名称] 图像水平镜像函数MirrorXProcess(WriteableBitmap src) [函数代码] ...
随机推荐
- iOS云存储:CloudKit 基本使用教程 增删改查(Swift)
一.从iOS8开始,苹果为开发者提供了ClouKit,可以把我们的应用程序和用户数据存储在iCloud上,用于代替后台服务器,开发移动代码即可. 二.设置 (1)需要一个开发者账号,并且设置一个bun ...
- PHP移动互联网开发笔记(8)——MySQL数据库基础回顾[2]
一.数据表 为了确保数据的完整性和一致性,在创建表时指定字段名称,字段类型和字段属性外,还需要使用约束(constraint),索引(index),主键(primary key)和外键(foregin ...
- Thrift是一款由Fackbook开发的可伸缩、跨语言的服务开发框架
这段时间,一直在整理公司的内部 rpc 服务接口,面临的一个问题就是:由于公司内部的系统由几个不同的语言编写的.C# ,java,node.js 等,如何实现这些内部系统之间的接口统一调用,确实是比较 ...
- 使用原生JS+CSS或HTML5实现简单的进度条和滑动条效果(精问)
使用原生JS+CSS或HTML5实现简单的进度条和滑动条效果(精问) 一.总结 一句话总结:进度条动画效果用animation,自动效果用setIntelval 二.使用原生JS+CSS或HTML5实 ...
- 【t017】YL杯超级篮球赛
Time Limit: 1 second Memory Limit: 256 MB [问题描述] 一年一度的高一YL杯超级篮球赛开赛了.当然,所谓超级的意思是参赛人数可能多于5人.小三对这场篮球赛非常 ...
- 【codeforces 785A】Anton and Polyhedrons
[题目链接]:http://codeforces.com/contest/785 [题意] 给你各种形状的物体; 然后让你计算总的面数; [题解] 用map来记录各种物体本该有的面数; 读入各种物体; ...
- 【33.33%】【codeforces 586D】Phillip and Trains
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 使用UISegementControl实现简易Tomcat程序
// // TomViewController.m #import "TomViewController.h" #import <AVFoundation/AVFoundat ...
- shp数据和tab数据的两点区别
作者:朱金灿 来源:http://blog.csdn.net/clever101 shp是ArcGIS的矢量格式,tab是Mapinfo的矢量格式.shp数据和tab数据有两点区别:一是shp数据的f ...
- RGB值得计算公式
三原色分别为:红(Red).绿(Green).蓝(Blue). 颜色值=(Red)+(Green*256)+(Blue*256*256) //由三原色值合成颜色整数值 function ColorFr ...