原文: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图像曝光算法的更多相关文章

  1. Win8Metro(C#)数字图像处理--2.3图像反色

    原文:Win8Metro(C#)数字图像处理--2.3图像反色 [函数名称] 图像反色函数ContraryProcess(WriteableBitmap src) [算法说明]     反色公式如下: ...

  2. Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法

    原文:Win8 Metro(C#)数字图像处理--2.45图像雾化效果算法 [函数名称]   图像雾化         AtomizationProcess(WriteableBitmap src,i ...

  3. Win8Metro(C#)数字图像处理--2.4图像颜色聚类

    原文:Win8Metro(C#)数字图像处理--2.4图像颜色聚类  [函数名称] 图像颜色聚类函数ClusterProcess(WriteableBitmap src,int value) [算 ...

  4. Win8Metro(C#)数字图像处理--2.33图像非线性变换

    原文:Win8Metro(C#)数字图像处理--2.33图像非线性变换  [函数名称] 图像非线性变换函数NonlinearTransformProcess(WriteableBitmap src ...

  5. Win8Metro(C#)数字图像处理--2.27图像加法运算

    原文:Win8Metro(C#)数字图像处理--2.27图像加法运算  [函数名称] 图像加法函数AddProcess(WriteableBitmap src, WriteableBitmap a ...

  6. Win8Metro(C#)数字图像处理--2.28图像乘法运算

    原文:Win8Metro(C#)数字图像处理--2.28图像乘法运算  [函数名称] 图像乘法函数MultiplicationProcess(WriteableBitmap src, Writea ...

  7. Win8Metro(C#)数字图像处理--2.29图像除法运算

    原文:Win8Metro(C#)数字图像处理--2.29图像除法运算  [函数名称] 图像除法函数DivisionProcess(WriteableBitmap src, WriteableBit ...

  8. Win8Metro(C#)数字图像处理--2.26图像减法

    原文:Win8Metro(C#)数字图像处理--2.26图像减法  [函数名称] 图像减法函数SubtractionProcess(WriteableBitmap src, WriteableBi ...

  9. Win8Metro(C#)数字图像处理--2.19图像水平镜像

    原文:Win8Metro(C#)数字图像处理--2.19图像水平镜像  [函数名称] 图像水平镜像函数MirrorXProcess(WriteableBitmap src) [函数代码]      ...

随机推荐

  1. 微信小程序从零开始开发步骤(二)

    上一章注册完小程序,添加新建的项目,大致的准备开发已经完成,本章要分享的是要创建一个简单的页面了,创建小程序页面的具体几个步骤: 1. 在pages 中添加一个目录 选中page,右击鼠标,从硬盘打开 ...

  2. html5和html的区别是什么(精问)

    html5和html的区别是什么(精问) 一.总结 一句话总结:html5:简洁(文档生命,链接引入) 语义化(语义化标签)  API(canvas,地理位置等)  一些标签(input新类型) 二. ...

  3. P2P网贷第三方托管模式存在5大缺陷,护法是最大的赢家

    1.注冊开户须要2次,用户体验非常差劲儿.   理財人和借款人.首先在平台注冊,然后还要在第三方托管账户注冊.   非常多相似的地方,用户体验非常差劲.   比方.password4个.   平台:登 ...

  4. XMPP之ios即时通讯客户端开发-mac上搭建openfire服务器(二)

    come from:http://www.cnblogs.com/xiaodao/archive/2013/04/05/3000554.html 一.下载并安装openfire 1.到http://w ...

  5. erlang OTP gen_server 图解分析

    http://www.hoterran.info/otp-gen_server-sourcecode 在阅读erlang的otp源码gen_server.erl的时候,一直想写点什么,用一种最好的方式 ...

  6. 【BZOJ 1014】 [JSOI2008]火星人prefix

    [题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1014 [题意] 让你在线查询最长公共前缀. 支持单节点修改; 插入操作; [题解] / ...

  7. Method for sub-pixel texture mapping and filtering

    BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for ...

  8. 关于javascript中的深拷贝问题

    一直在尝试为javascript找一个快捷可靠的对象深拷贝的方法,昨天突发奇想,把对象push到一个空数组里,然后对改数组通过concat()或slice()进行拷贝,然后取出数组的第一个元素复制给变 ...

  9. WPF制作的党旗

    原文:WPF制作的党旗 --------------------------------------------------------------------------------引用或转载时请保 ...

  10. 由Maximum Gap,对话桶排序,基数排序和统计排序

    一些非比较排序 在LeetCode中有个题目叫Maximum Gap.是求一个非排序的正数数列中按顺序排列后的最大间隔.这个题用桶排序和基数排序都能够实现.以下说一下桶排序.基数排序和计数排序这三种非 ...