vb.net 实现高斯滤波\中值滤波\均值滤波的一种 需求vb.net程序,实现对图像的滤波处理,以上任意一种均可 100
展开全部
'中值滤波:
Dim x As Integer, y As Integer, size As Integer = 3, point(8) As Integer
For x = CInt((size - 1) / 2) To CInt(jpgImage.Width - 1 - (size - 1) / 2)
For y = CInt((size - 1) / 2) To CInt(jpgImage.Height - 1 - (size - 1) / 2)
point(0) = jpgImage.GetPixel(x - 1, y - 1).R
point(1) = jpgImage.GetPixel(x - 1, y).R
point(2) = jpgImage.GetPixel(x - 1, y + 1).R
point(3) = jpgImage.GetPixel(x, y - 1).R
point(4) = jpgImage.GetPixel(x, y).R
point(5) = jpgImage.GetPixel(x, y + 1).R
point(6) = jpgImage.GetPixel(x + 1, y - 1).R
point(7) = jpgImage.GetPixel(x + 1, y).R
point(8) = jpgImage.GetPixel(x + 1, y + 1).R
Array.Sort(point)
jpgImage.SetPixel(x, y, Color.FromArgb(point(4), point(4), point(4)))
Next
Next
Dim x As Integer, y As Integer, size As Integer = 3, point(8) As Integer
For x = CInt((size - 1) / 2) To CInt(jpgImage.Width - 1 - (size - 1) / 2)
For y = CInt((size - 1) / 2) To CInt(jpgImage.Height - 1 - (size - 1) / 2)
point(0) = jpgImage.GetPixel(x - 1, y - 1).R
point(1) = jpgImage.GetPixel(x - 1, y).R
point(2) = jpgImage.GetPixel(x - 1, y + 1).R
point(3) = jpgImage.GetPixel(x, y - 1).R
point(4) = jpgImage.GetPixel(x, y).R
point(5) = jpgImage.GetPixel(x, y + 1).R
point(6) = jpgImage.GetPixel(x + 1, y - 1).R
point(7) = jpgImage.GetPixel(x + 1, y).R
point(8) = jpgImage.GetPixel(x + 1, y + 1).R
Array.Sort(point)
jpgImage.SetPixel(x, y, Color.FromArgb(point(4), point(4), point(4)))
Next
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询