日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > C# >内容正文

C#

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

發(fā)布時(shí)間:2024/4/13 C# 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Win8Metro(C#)数字图像处理--2.33图像非线性变换 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
原文:Win8Metro(C#)數(shù)字圖像處理--2.33圖像非線性變換



[函數(shù)名稱]

圖像非線性變換函數(shù)NonlinearTransformProcess(WriteableBitmap?src,int?k?)?

[函數(shù)代碼]/// <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;} }

總結(jié)

以上是生活随笔為你收集整理的Win8Metro(C#)数字图像处理--2.33图像非线性变换的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。