为了使bmp图像能够被操纵,并且能够和它们一起执行aritmethic操作,应该遵循什么步骤?
例如,如果我有image1.bmp和image2.bmp,我想得到某种校正因子,所以我需要执行一些操作,例如
mean(image1/image2)*image1
我唯一能想到的就是以某种方式将图像放入数组中,但我无法理解如何加载图像并将其放入数组。
它会是一个数组吗?还是矩阵?
如果能帮上忙就好了。
发布于 2015-07-09 09:02:01
这是我的刺刀。希望能帮上忙。
Sub Main(filePath1 As String, filePath2 As String, filePath3 As String)
Dim bmpImage1 As New Drawing.Bitmap(filePath1)
Dim bmpImage2 As New Drawing.Bitmap(filePath2)
Dim bmpImage3 As New Drawing.Bitmap(filePath3)
Dim resultBmpImage As New Drawing.Bitmap(bmpImage1.Width, bmpImage1.Height)
'Iterate through every pixel:
For x As Integer = 0 To bmpImage1.Width - 1
For y As Integer = 0 To bmpImage1.Height - 1
Dim processedColor As System.Drawing.Color =
ProcessColor(
bmpImage1.GetPixel(x, y),
bmpImage2.GetPixel(x, y),
bmpImage3.GetPixel(x, y))
resultBmpImage.SetPixel(x, y, processedColor)
Next
Next
End Sub
Private Function ProcessColor(
color1 As System.Drawing.Color,
color2 As System.Drawing.Color,
color3 As System.Drawing.Color) As System.Drawing.Color
Dim resultGrayLevel As Integer = (color1.R / color2.R) + color3.R
Dim color As System.Drawing.Color = System.Drawing.Color.FromArgb(255, resultGrayLevel, resultGrayLevel, resultGrayLevel)
Return color
End Function问题是:如果我们不是在谈论灰度颜色(即R=G=B的颜色),我不知道某些操作是否有意义.我对图像处理的了解还不足以回答这个问题。
https://stackoverflow.com/questions/31312226
复制相似问题