Win8Metro(C#)数字图像处理--2.32图像曝光算法
原文:Win8Metro(C#)数字图像处理--2.32图像曝光算法
[函数名称]
图像曝光函数ExposureProcess(WriteableBitmap src,int exposureValue)
[函数代码]
/// <summary>
/// Exposure process.
/// </summary>
/// <param name="src">Source image.</param>
/// <param name="exposureValue">To adjust exposure lavel, from 0 to 255.</param>
/// <returns></returns>
public static WriteableBitmap ExposureProcess(WriteableBitmap src,int exposureValue)////35图像曝光
{
if (src != null)
{
int w = src.PixelWidth;
int h = src.PixelHeight;
WriteableBitmap exposureImage = new WriteableBitmap(w, h);
int r=0,g=0,b=0;
byte[] temp = src.PixelBuffer.ToArray();
for (int i = 0; i < temp.Length; i += 4)
{
byte tempByte = (byte)((int)(temp[i] * 0.114 + temp[i + 1] * 0.587 + temp[i + 2] * 0.299));
b = temp[i];
g = temp[i + 1];
r = temp[i + 2];
if (tempByte < 128)
{
temp[i] = (byte)(255 - b);
temp[i + 1] = (byte)(255 - g);
temp[i + 2] = (byte)(255 - r);
}
}
Stream sTemp = exposureImage.PixelBuffer.AsStream();
sTemp.Seek(0, SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return exposureImage;
}
else
{
return null;
}
}
[图像效果]
最新文章
- Salesforce学习笔记(一)
- Router的创建者——RouteBuilder
- 在 SQL Server 中的网络数据库文件的支持说明
- Jplayer(转)
- Webbrowser中模拟连接点击(非鼠标模拟)
- EJB通过ANT提高EJB应用程序的开发效率、无状态发展本地接口bean、开发状态bean
- log4j2
- 如何利用Plxmon工具进行在线烧录PCI卡的EEPROM
- IDEA安装教程
- anaconda常用操作汇总
- 模拟位置 定位 钉钉打卡 运动轨迹 MD
- TP方法中打印地址栏中所有的参数:
- 如何判断win10 和office的版本
- leetcode15
- python成长之路六-函数的初识
- caffe的model参数解析numpy多维数组的存取
- GRUB2 命令行使用笔记
- redis-storage介绍[转]
- numpy 初识(三)
- ShowDoc 搭建 (未成功....)
热门文章
- [ES6] Use ES6 Proxies
- QQ欢乐斗地主心得体会 (三):高倍场攻略
- mui列表跳转到详情页优化方案
- sql中group by用来干嘛的
- iOS项目中所有icon的尺寸以及命名
- 关于在方法里面使用泛型public static <;T>; T
- [GeekBand] C++ 内存分布—— new和delete重载的实现及分析
- 微信小程序要调数据 微信小程序 for 循环详解
- 【26.67%】【codeforces 596C】Wilbur and Points
- linux下jar包的生存与开机自动启动