Vb.net 在为mandelbrot集着色时,如何结合平滑和直方图着色
我已经实现了一个小小的Mandelbrot程序,并分别添加了直方图着色和平滑着色,如维基百科上所述:() 在这一页上,它说“这种方法[直方图着色方法]可以与下面的平滑着色方法相结合,以获得更美观的图像。” 然而,我不明白应该如何做到这一点 这是我的渲染功能:Vb.net 在为mandelbrot集着色时,如何结合平滑和直方图着色,vb.net,mandelbrot,Vb.net,Mandelbrot,我已经实现了一个小小的Mandelbrot程序,并分别添加了直方图着色和平滑着色,如维基百科上所述:() 在这一页上,它说“这种方法[直方图着色方法]可以与下面的平滑着色方法相结合,以获得更美观的图像。” 然而,我不明白应该如何做到这一点 这是我的渲染功能: Private Function RenderFractalWithHistogram(fractal As Fractal, width As Integer, height As Integer) As Bitmap D
Private Function RenderFractalWithHistogram(fractal As Fractal, width As Integer, height As Integer) As Bitmap
Dim escapeValues(width - 1, height - 1) As Fractal.EscapeValue
Dim histogram(fractal.MaxIterations) As Integer
Dim numPixels As Integer = width * height
Parallel.For(0, height, Sub(y)
Dim escapeValue As Fractal.EscapeValue
For x As Integer = 0 To width - 1
escapeValue = fractal.GetEscapeValueAt(x, y, width, height)
escapeValues(x, y) = escapeValue
SyncLock (Me)
histogram(escapeValue.Iterations) += 1
End SyncLock
Next
End Sub)
Dim histogramCumulated(fractal.MaxIterations) As Integer
Dim sum As Integer = 0
For i As Integer = 0 To fractal.MaxIterations
sum += histogram(i)
histogramCumulated(i) = sum
Next
Dim bitmapBytes(numPixels * 4 - 1) As Byte
Parallel.For(0, height, Sub(y)
Dim escapeValue As Fractal.EscapeValue
Dim colorIndex As Double
Dim color As Color
Dim index As Integer
Dim colorBytes() As Byte
For x As Integer = 0 To width - 1
escapeValue = escapeValues(x, y)
colorIndex = histogramCumulated(escapeValue.Iterations) / numPixels
color = fractal.ColorScheme.GetColor(colorIndex)
index = y * width * 4 + x * 4
colorBytes = BitConverter.GetBytes(color.ToArgb)
For Each colorByte As Byte In colorBytes
bitmapBytes(index) = colorByte
index += 1
Next
Next
End Sub)
Return CreateBitmapFromColorByteArray(bitmapBytes, width, height)
End Function
它工作得很好,但图片有色带。我只是不确定,如何在这里应用平滑,因为它是用平滑着色方法完成的。也许我错过了一些很简单的事情?如果有人能帮我解决这个问题,那就太好了。我的待办事项清单上有一个平滑的颜色,等待执行:。