原文:Win8 Metro(C#)数字图像处理--2.46图像RGB分量增强效果



[函数名称]

RGB分量调整         RGBAdjustProcess(WriteableBitmap src, int value,int threshould)

[算法说明]

  RGB分量调整实际上是分别对每个像素的RGB三个分量进行调整,公式如下:

[函数代码]

        /// <summary>
/// R,G,B value adjusting.
/// </summary>
/// <param name="src">The source image.</param>
/// <param name="value">To judge which one to adjust, R is 3, G is 2, B is 1.</param>
/// <param name="threshould">It is a value to adjust the result image.</param>
/// <returns></returns>
public static WriteableBitmap RGBAdjustProcess(WriteableBitmap src, int value,int threshould)////41 RGB分量调整
{
if (src != null)
{
int w = src.PixelWidth;
int h = src.PixelHeight;
WriteableBitmap srcImage = new WriteableBitmap(w, h);
byte[] temp = src.PixelBuffer.ToArray();
if (value == 1)
{
for (int i = 0; i < temp.Length; i += 4)
{
temp[i] = (byte)(Math.Max(0, Math.Min((temp[i] + threshould), 255)));
}
}
if (value == 2)
{
for (int i = 0; i < temp.Length; i += 4)
{
temp[i + 1] = (byte)(Math.Max(0, Math.Min((temp[i + 1] + threshould), 255)));
}
}
if (value == 3)
{
for (int i = 0; i < temp.Length; i += 4)
{
temp[i + 2] = (byte)(Math.Max(0, Math.Min((temp[i + 2] + threshould), 255)));
}
}
Stream sTemp = srcImage.PixelBuffer.AsStream();
sTemp.Seek(0, SeekOrigin.Begin);
sTemp.Write(temp, 0, w * 4 * h);
return srcImage;
}
else
{
return null;
}
}

Win8 Metro(C#)数字图像处理--2.46图像RGB分量增强效果的更多相关文章

  1. Win8 Metro(C#)数字图像处理--3.2图像方差计算

    原文:Win8 Metro(C#)数字图像处理--3.2图像方差计算 /// <summary> /// /// </summary>Variance computing. / ...

  2. Win8 Metro(C#)数字图像处理--3.3图像直方图计算

    原文:Win8 Metro(C#)数字图像处理--3.3图像直方图计算 /// <summary> /// Get the array of histrgram. /// </sum ...

  3. Win8 Metro(C#)数字图像处理--3.4图像信息熵计算

    原文:Win8 Metro(C#)数字图像处理--3.4图像信息熵计算 [函数代码] /// <summary> /// Entropy of one image. /// </su ...

  4. Win8 Metro(C#)数字图像处理--3.5图像形心计算

    原文:Win8 Metro(C#)数字图像处理--3.5图像形心计算 /// <summary> /// Get the center of the object in an image. ...

  5. Win8 Metro(C#)数字图像处理--3.1图像均值计算

    原文:Win8 Metro(C#)数字图像处理--3.1图像均值计算 /// <summary> /// Mean value computing. /// </summary> ...

  6. Win8 Metro(C#)数字图像处理--2.74图像凸包计算

    原文:Win8 Metro(C#)数字图像处理--2.74图像凸包计算 /// <summary> /// Convex Hull compute. /// </summary> ...

  7. Win8 Metro(C#)数字图像处理--2.68图像最小值滤波器

    原文:Win8 Metro(C#)数字图像处理--2.68图像最小值滤波器 /// <summary> /// Min value filter. /// </summary> ...

  8. Win8 Metro(C#)数字图像处理--2.52图像K均值聚类

    原文:Win8 Metro(C#)数字图像处理--2.52图像K均值聚类  [函数名称]   图像KMeans聚类      KMeansCluster(WriteableBitmap src,i ...

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

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

随机推荐

  1. 海思hi3716c机顶盒接usb摄像头和usb无线耳机时,无线耳机有时没有声音

    两个USB设备各自是: A:USB摄像头带录音功能,但不带放音功能. B:USB无线耳机是使用USB转2.4G的无线耳机. 详细现象: 1, A,B两者同一时候插上机顶盒,并开机进入android,此 ...

  2. NSOperationQueue小结

    将建立的线程增加队列之中.他们都是并发运行的  假设想有一个线程在另外一个线程之后再运行的话 有一个方法能够实现- (void)addDependency:(NSOperation *)op; 这一个 ...

  3. 前端切图:CSS实现隐藏滚动条同时又可以滚动

    CSS 实现隐藏滚动条同时又可以滚动 原始功能: 图片发自简书App 添加伪类之后的功能: 图片发自简书App 完整demo如下: <!DOCTYPE html> <html> ...

  4. 【hdu 1846】Brave Game

    Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s) ...

  5. Cryptographic method and system

    The present invention relates to the field of security of electronic data and/or communications. In ...

  6. spring security之httpSecurity 专题

    37.5.2 Resolving the CsrfToken Spring Security provides CsrfTokenArgumentResolver which can automati ...

  7. Android应用《撕开美女衣服》的实现过程及源代码

    现在很多Android市场中都能找到关于美女的应用,比如 撕开美女衣服.吹裙子等. 这些应用的下载量挺大的,作为Android的开发人员或者一名技术人员我们不能只局限在欣赏应用的层面,很多时候需要我们 ...

  8. Zero Downtime Upgrade of Oracle 10g to Oracle 11g Using GoldenGate — 1

    Source Database DB Name:        zwc Schemas:         HR,OE,PM Version:          10.2.0.4 RAC:       ...

  9. 数学概念 —— 奇异性(Singularity,Vertical tangent)

    0. 基本定义 Singularity (mathematics) 数学上的奇异性一般是指,函数在该点未定义(not defined,比如取值为无穷),或者不可微(fails to be well-b ...

  10. myeclipse 8.6 software and workspace center is currently not available

    Myeclipse安装EGit插件的时候偏偏遇到software and workspace center is currently not available 不用打开myeclipse  conf ...