本文介绍了数学艺术模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经通过C#中的SetPixel通过使用一些公式制作了一些数学图像.
问题在于这些图像模糊在一定程度上是模糊的.
通过进行一些量化,我使它变得更好.但是仍然不是最喜欢的图像.
有谁知道所谓的作品?
如何改善这类图像?
有谁知道关于这些图像之王的文章吗?
Hi,
I have made some mathematical images by using some formula through SetPixel in C#.
The problem is that these images are blur to some extend.
By doing some quantizing I have made it better. But still it is not the favorite image that can be.
Does anyone know what is called such a work?
How to improve these kind of images?
Does anyone know any article about these king of images?
public int ColorQuantize(double color,int step)
{
return ((((int)color) / step)+1) * step;
}
public void RGB(int i, int j, double x, double y, ref double r, ref double g, ref double b)
{
r = ColorQuantize(Math.Sqrt(Math.Abs(Math.Atan(x / y) * Math.Sin(x * Math.PI - y)) * 2 / Math.PI) * 256, 40);
g = ColorQuantize((Math.Tan(x) * Math.Tan(x-y) + Math.Tan(y*x) * Math.Tan(y)) * 256, 40);
b = ColorQuantize(Math.Cos(Math.Sqrt(Math.Abs(x * y)) * 7-Math.Tan(x*x+y*y)) * 256, 40);
}
public Bitmap myImage()
{
double dimX, dimY;
dimX = pictureBox1.Size.Width;
dimY = pictureBox1.Size.Height;
Bitmap bmp = new Bitmap((int)dimX, (int)dimY);
int HalfX = (int)(dimX / 2), HalfY = (int)(dimY / 2);
for (int i = 0; i < dimX; i++)
for (int j = 0; j < dimY; j++)
{
double r = 0, g = 0, b = 0;
int X = i - HalfX, Y = j - HalfY;
RGB(X, Y, X / (dimX / 2), Y / (dimY / 2), ref r, ref g, ref b);
r = (int)(Math.Abs(r) % 256);
g = (int)(Math.Abs(g) % 256);
b = (int)(Math.Abs(b) % 256);
bmp.SetPixel(i, j, Color.FromArgb((int)r, (int)g, (int)b));
}
return bmp;
}
推荐答案
这篇关于数学艺术模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!