我有一张需要用5种颜色的梯度来描述的光线图像。 轻型粉碎机应当从梯度中取出更光明的颜色,黑暗的颜料应更黑暗。
If the gradient starts with yellow and ends with red, then white pixels would be yellow and black pixels red with everything in between along the gradient.
能否与科罗拉·马基斯一起进行?
我有一张需要用5种颜色的梯度来描述的光线图像。 轻型粉碎机应当从梯度中取出更光明的颜色,黑暗的颜料应更黑暗。
If the gradient starts with yellow and ends with red, then white pixels would be yellow and black pixels red with everything in between along the gradient.
能否与科罗拉·马基斯一起进行?
What you want is in the simplest case a linear interpolation between 5 points in 3d. A direct color gradient between two colors {r1,g1,b1} and {r2,g2,b2} is, as you would walk onto the line in 3d which connects the points {r1,g1,b1} and {r2,g2,b2}. When your gray-values are in the interval [0,1], then you would want to have the color {r1,g1,b1} if you have a gray-level 0 and {r2,g2,b2} if you have a gray-level 1. The question is how to calculate the colors in between:
考虑简单的学校病媒分析。 c1 点{r1,g1,b1}, c2为{r2,g2,b2}。 1. 着手处理1项病媒,并朝着2c1:
* E/CN.6/2009/1。
或同等
http://www.un.org
Remenber, gray必须位于间隔[0,1]。 否则,你就不得不重新进行。 这在两点之间是简单的直线干涉,当然可以延伸到你们想要的众多肤色。
对5个颜色而言,这种办法基本相同。 这里有5种随机选择的颜色:
{{0.273372, 0.112407, 0.0415183},
{0.79436, 0.696305, 0.167884},
{0.235083, 0.999163, 0.848291},
{0.295492, 0.780062, 0.246481},
{0.584883, 0.460118, 0.940826}}
你们必须知道的两项重要内容:
如果你想有某种光彩价值,你首先需要提取两个环绕点。 例如,如果你希望有光线0.1的颜色,那将是第一个和第二点。
您
Remark: This is of course not the solution for the implementation in C#, but your question suggested, that creating a color-image of the same size was not your problem. Calculating the color-values for each gray-value is the key for your colorization.
你提到“五色”,但也提到从红色到黄色的梯度。
为了说明基本想法,我们可以从一阵列中产生一个阵列,星阵列代表了原形象的8倍光值。
鉴于光度值(8比值),寻找新的梯度(r,g,b)如下:
从一阵式向科罗列转变的样本代码:
byte[] bytes = getImageBytes();
Color[] colors = new Color[bytes.Length];
for(int i = 0; i < bytes.Length; i++)
{
colors[i] = Color.FromArgb(255, bytes[i], 0);
}
为了迅速开展这项工作,使用“锁定/锁定借方”法,并直接操纵随附价值。
你可以简单地把光线图像的所有粉碎,并掌握其光彩和阿尔法价值(简言之,使用LINQ)。 然后,你带上了你所希望的颜色,并利用了它的威爱和饱和布。
Now you create a new color by taking the Gray.Alpha, Color.Hue, Color.Saturation and a combination of Gray.Brightness and Color.Brightness and apply this color to the pixel in the grayscale image.
第一个trick块是从阿尔法、胡伊、饱和和布律制成色体,但你可以简单地拿到这一功能;-。
最后一部分是将灰色和彩色混为一谈,留给读者。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...