Win8Metro(C#)数字图像处理--2.19图像水平镜像
原文:Win8Metro(C#)数字图像处理--2.19图像水平镜像
[函数名称]
图像水平镜像函数MirrorXProcess(WriteableBitmap
src)
[函数代码]
///<summary>
///
Horizontal mirror process.
///</summary>
///<param
name="src">Source image.</param>
///<returns></returns>
publicstaticWriteableBitmap
MirrorXProcess(WriteableBitmap src)////19水平镜像
{
if(src!=null
)
{
int
w = src.PixelWidth;
int
h = src.PixelHeight;
WriteableBitmap
mirrorImage =newWriteableBitmap(w,h);
byte[]
temp = src.PixelBuffer.ToArray();
byte[]
tempMask =newbyte[w
* h * 4];
for
(int j = 0; j < h; j++)
{
for
(int i = 0; i < w; i++)
{
tempMask[i * 4 + j * w * 4] = temp[(w - 1 - i) * 4 + j * w * 4];
tempMask[i * 4 + 1 + j * w * 4] = temp[(w - 1 - i) * 4 + 1 + j * w *
4];
tempMask[i * 4 + 2 + j * w * 4] = temp[(w - 1 - i) * 4 + 2 + j * w *
4];
tempMask[i * 4 + 3 + j * w * 4] = temp[(w - 1 - i) * 4 + 3 + j * w *
4];
}
}
Stream
sTemp = mirrorImage.PixelBuffer.AsStream();
sTemp.Seek(0,
SeekOrigin.Begin);
sTemp.Write(tempMask, 0, w * 4 * h);
return
mirrorImage;
}
else
{
returnnull;
}
}
[图像效果]
Win8Metro(C#)数字图像处理--2.19图像水平镜像的更多相关文章
- Win8Metro(C#)数字图像处理--2.20图像垂直镜像
原文:Win8Metro(C#)数字图像处理--2.20图像垂直镜像 [函数名称] 图像垂直镜像函数MirrorYProcess(WriteableBitmap src) [函数代码] ...
- 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.18图像平移变换
原文:Win8Metro(C#)数字图像处理--2.18图像平移变换 [函数名称] 图像平移变换函数TranslationProcess(WriteableBitmap src,int x,in ...
随机推荐
- js如何实现页面跳转(大全)
js如何实现页面跳转(大全) 一.总结 一句话总结: 1.location的href属性: js跳转主要是通过window的location对象的href属性,因为location对象本来就是表示的浏 ...
- Hierarchical Tree Traversal in Graphics Pipeline Stages
BACKGROUND Many algorithms on a graphics processing unit (GPU) may benefit from doing a query in a h ...
- android 连接USB按power键锁屏2声锁屏音
alps\frameworks\base\packages\Keyguard\src\com\android\keyguard\KeyguardViewMediator.java #1384 行左右: ...
- Redis的常识
https://github.com/springside/springside4/wiki/redis 1. Overview 1.1 资料 <The Little Redis Book> ...
- jQuery Media Plugin 现在插上实线的视频播放服务
jQuery Media 一个简短的引论 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvWGluZ0tvbmcyMnN0YXI=/font/5a6L5L2T ...
- prettytensor 的使用
prettytensor 顾名思义,对原始的 tensorflow 下的 tensor 进行封装(prettytensor 以 tensorflow 为基础,二者搭配使用),使其成为一个更为接口友好的 ...
- WPF 使用鼠标拖动一个控件的实现[2018.7.15]
原文:WPF 使用鼠标拖动一个控件的实现[2018.7.15] Q:已经把一个Shape和一个TextBlock组合起来放到了一个Grid中,现在想要实现用鼠标拖动这个Grid到任意位置的功能,如何做 ...
- Windows 7 X64位平台下,VC6调试运行程序,中断调试无法退出
用VC6在64位Windows7下调试的时候,如果中断(Shift+F5)调试,程序无法退出. 问题描述: 当点击F5开始一个项目的调试时,程序在设置的断点处停止,这时按下Shift+F5后,vc6可 ...
- WPF 获得当前输入法语言区域
原文:WPF 获得当前输入法语言区域 本文告诉大家如何获得 WPF 输入法的语言区域 需要使用 user32 的方法,很简单,请看下面 [DllImport("user32.dll" ...
- WPF 拼音输入法
原文:WPF 拼音输入法 本文来告诉大家如何使用 WPF 来写一个输入法,使用的方式是钩子. 目录 键盘 解析键盘 获得按键 输入流向 算法 实际上本文是在使用一个好用的软件 希沃白板 的时候发现在里 ...