VB.NET2005图像的锐化和钝化的计算
日期:2008-6-27 13:54:02 来源: 作者: 浏览:次 |
|
| VB.NET2005图像的锐化和钝化的计算 |
Public Function SetImagesharpening(ByVal img As Image) As Image '锐化 Dim DX As Integer = 1, DY As Integer = 1 Dim red, green, blue As Integer Dim bmp As New Bitmap(img) With bmp For y As Integer = DX To .Height - DX - 1 For x As Integer = DY To .Width - DY - 1 red = Convert.ToInt32(.GetPixel(x, y).R + 0.5 * (Convert.ToInt32(.GetPixel(x, y).R) - Convert.ToInt32(.GetPixel(x - DX, y - DY).R))) green = Convert.ToInt32(.GetPixel(x, y).G + 0.5 * (Convert.ToInt32(.GetPixel(x, y).G) - Convert.ToInt32(.GetPixel(x - DX, y - DY).G))) blue = Convert.ToInt32(.GetPixel(x, y).B + 0.5 * (Convert.ToInt32(.GetPixel(x, y).B) - Convert.ToInt32(.GetPixel(x - DX, y - DY).B))) red = Math.Min(Math.Max(red, 0), 255) green = Math.Min(Math.Max(green, 0), 255) blue = Math.Min(Math.Max(blue, 0), 255) bmp.SetPixel(x, y, Color.FromArgb(red, green, blue)) Next Next End With Return bmp End Function
Public Function SetImageDeactivation(ByVal img As Image) As Image | |