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;
}
}
[图像效果]
Win8Metro(C#)数字图像处理--2.32图像曝光算法的更多相关文章
- Win8Metro(C#)数字图像处理--2.3图像反色
原文:Win8Metro(C#)数字图像处理--2.3图像反色 [函数名称] 图像反色函数ContraryProcess(WriteableBitmap src) [算法说明] 反色公式如下: ...
- Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法
原文:Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法 [函数名称] 图像雾化 AtomizationProcess(WriteableBitmap src,i ...
- Win8Metro(C#)数字图像处理--2.4图像颜色聚类
原文:Win8Metro(C#)数字图像处理--2.4图像颜色聚类 [函数名称] 图像颜色聚类函数ClusterProcess(WriteableBitmap src,int value) [算 ...
- Win8Metro(C#)数字图像处理--2.33图像非线性变换
原文:Win8Metro(C#)数字图像处理--2.33图像非线性变换 [函数名称] 图像非线性变换函数NonlinearTransformProcess(WriteableBitmap src ...
- 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) [函数代码] ...
随机推荐
- poj 2689 Prime Distance(大区间筛素数)
http://poj.org/problem?id=2689 题意:给出一个大区间[L,U],分别求出该区间内连续的相差最小和相差最大的素数对. 由于L<U<=2147483647,直接筛 ...
- cocos2d-x 3.4 中文乱码解决之道
cocos2dx 中文乱码解决之道 须要引入五个文件 1.iconv.h 2.iconvString.cpp 3.iconvString.h 4.iconv.dll 5.libiconv.lib 完整 ...
- NOIP模拟 回文序列 - DP
题意: 如果一个字符串等于s和t的长度之和(\(l \le 50\)),并且可以拆成两个字符串子序列,分别与s和t相同,那么它就是s和t的一个并字符串(从字符串中选出若干个可以不连续的字符按照原序列写 ...
- 数组[0]和[firstobject]的区别
数组[0]和[firstobject]的区别 [0]:数组为空时回报错 [firstobject]:数组为空时回返回nil
- Display controller
Field of the Invention The present invention relates to a display controller. Background to the inve ...
- spark accumulator累加器
java /** * accumulator可以让多个task共同操作一份变量,主要进行多个节点对一个变量进行共享性的操作,accumulator只提供了累加的功能 * 只有driver可以获取acc ...
- 经典图形的绘制(matlab)
1. radial sinusoïdal signal:径向正弦信号 [xx, yy] = meshgrid(-50:50); I = sin(sqrt(xx.^2+yy.^2)); imshow(I ...
- linux系统下信号具体解释2
信号是UNIX 系统所使用的进程通信方法中,最古老的一种.信号不但能从内核发往一个进程,也能从一个进程发往还有一个进程.比如,用户在后台启动了一个要运行较长时间的程序,假设想中断其运行,能够用kill ...
- Method and system for providing security policy for linux-based security operating system
A system for providing security policy for a Linux-based security operating system, which includes a ...
- this指的是,调用函数的那个对象。
恩 http://www.ruanyifeng.com/blog/2010/04/using_this_keyword_in_javascript.html