我正在渲染一個mandelbrot集並已經實現了一些平滑的着色,但是當看得更近時,圖片變得非常嘈雜。我想知道,改善我的色彩以達到更好的美學效果的最佳方法是什麼?使用直方圖着色是否有助於消除粗糙的像素化區域? Here is a render of the fractal using 10 000 iterations.什麼是Mandelbrot平滑着色算法的最佳選擇
這是我生成和現在指定顏色的方式:
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int black = 0;
int[] colors = new int[max]; //max is the maximum number of iterations
for (int i = 0; i<max; i++) {
colors[i] = Color.HSBtoRGB(i/256f, 1, i/(i+8f));
}
for(int i = 0; i < colors.length/2; i++)
{
int temp = colors[i];
colors[i] = colors[colors.length - i - 1];
colors[colors.length - i - 1] = temp;
}
...
...
...
if (iterations < max) image.setRGB(col, row, colors[iterations]);
else image.setRGB(col, row, black);
}
}
//ImageIO.write(image, "png", new File("mandelbrot_seeria90"+Integer.toString(i)+".png"));
ImageIO.write(image, "png", new File("resotest.png"));
這已經在這裏得到解答:http://stackoverflow.com/a/1243788/216248 – karatedog
這個問題聽起來不像是要求顏色的平滑插值,而是爲了圖像的「一般平滑」 。這可能有點煩瑣(你不能用一些高斯來模糊最終圖像)。但是,對於每個像素,您可以取其中未超過迭代次數的周圍像素的平均值(即,所有周圍像素的「非黑色」的平均值) – Marco13