原文:Win8Metro(C#)数字图像处理--2.33图像非线性变换



[函数名称]

图像非线性变换函数NonlinearTransformProcess(WriteableBitmap src,int k ) 

[函数代码]
/// <summary>
/// Nonlinear transform process.
/// </summary>
/// <param name="src">The source image.</param>
/// <param name="k">Param to adjust nonlinear transform, from 0 to 255.</param>
/// <returns></returns>
public static WriteableBitmap NonlinearTransformProcess(WriteableBitmap src,int k )////37
{
if (src != null)
{
int w = src.PixelWidth;
int h = src.PixelHeight;
WriteableBitmap linearImage = new WriteableBitmap(w, h);
byte[] temp = src.PixelBuffer.ToArray();
int r = 0, g = 0, b = 0;
for (int i = 0; i < temp.Length; i += 4)
{
b = (int)(k * Math.Log10(1 + temp[i]));
g = (int)(k * Math.Log10(1 + temp[i + 1]));
r = (int)(k * Math.Log10(1 + temp[i + 2]));
temp[i] = (byte)(b > 0 ? (b < 255 ? b : 255) : 0);
temp[i + 1] = (byte)(g > 0 ? (g < 255 ? g : 255) : 0);
temp[i + 2] = (byte)(r > 0 ? (r < 255 ? r : 255) : 0);
}
Stream sTemp = linearImage.PixelBuffer.AsStream();
sTemp.Seek(0, SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return linearImage;
}
else
{
return null;
}
}


Win8Metro(C#)数字图像处理--2.33图像非线性变换的更多相关文章

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

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

  2. Win8Metro(C#)数字图像处理--2.32图像曝光算法

    原文:Win8Metro(C#)数字图像处理--2.32图像曝光算法  [函数名称] 图像曝光函数ExposureProcess(WriteableBitmap src,int exposureV ...

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

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

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

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

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

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

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

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

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

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

  8. Win8Metro(C#)数字图像处理--2.20图像垂直镜像

    原文:Win8Metro(C#)数字图像处理--2.20图像垂直镜像  [函数名称] 图像垂直镜像函数MirrorYProcess(WriteableBitmap src) [函数代码]      ...

  9. Win8Metro(C#)数字图像处理--2.18图像平移变换

    原文:Win8Metro(C#)数字图像处理--2.18图像平移变换  [函数名称] 图像平移变换函数TranslationProcess(WriteableBitmap src,int x,in ...

随机推荐

  1. 栈溢出笔记1.9 认识SEH

    从本节開始,我们就要研究一些略微高级点的话题了,如同在1.2节中看到的,Windows中为抵抗栈溢出做了非常多保护性的检查工作,编译的程序默认开启了这些保护. 假设我们不能绕过这些保护.那么我们的Sh ...

  2. vs 错误提示及解决方案

    错误: 应输入";" 错误原因,宏展开出现错误:

  3. 忙里偷闲( ˇˍˇ )闲里偷学【C语言篇】——(4)for == while ?

    一.for和while等价替换 int i = 1; for (i; i<=100; i++){ sum = sum + 1; } int i = 1; while(i<=100){ su ...

  4. Linux下iptables屏蔽IP和端口号

    http://blog.csdn.net/kobejayandy/article/details/24332597 iptables 屏蔽端口

  5. Android中蓝牙的基本使用----BluetoothAdapter类简介

    天气逐渐热了,自己也越来越懒了,虽然看着了很多东西,解决了很多问题,有些收获却不想写着.主要有一下两方面原因: 第一.以前写的一些关于Android知识的Blog,都是在学习过程中发现网络上没有相关知 ...

  6. [Angular] @ContentChild and ngAfterContentInit

    @ContentChild normally works with ngAfterContentInit lifecycle. @ContentChild is used for looking in ...

  7. 【a601】雇佣计划

    Time Limit: 1 second Memory Limit: 32 MB [问题描述] 一位管理项目的经理想要确定每个月需要的工人,他知道每月所需的最少工人数.当他雇佣或解雇一个工人时,会有一 ...

  8. 解决离线Could not parse configuration:hibernate.cfg.xml错误

    离线使用hibernate tool 生成反向工程,在配置 配置文件完,生成配置文件后,会报出org.hibernate.HibernateException: Could not parse con ...

  9. 在线算法交互、可视化与演示及应用(caffe 网络配置文件 .prototxt 的可视化)

    0. 全集 Explained Visually 1. 图像与视觉 Image Kernels 2. 数学操作 Convolution arithmetic:卷积: 3. 神经网络与深度学习 A Ne ...

  10. 【23.15%】【codeforces 703C】Chris and Road

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...