问题描述
什么是C#的方式来代替对图像的某些部分颜色,而不会影响其质感?
What is the way in C# to replace a color for some parts of an image without affecting its texture?
您可以看到结果的好例子的结果
谢谢
You can see good example of the result here
Thanks
推荐答案
发现这样做的方式,这需要RGB< - > HSL转换(好类HSL颜色可以发现的)结果
1.获取一个参考(在HSL)表示要替换结果
2.获取目标颜色结果
3.获取图像像素的HSL值和颜色值每个像素:结果
4.计算像素的HSL值,并将其替换为所有(pixelHsl / refHsl)* targetHsl
Found the way to do that, this requires RGB<->HSL conversions (good class for HSL color can be found here)
1. Get a reference value (in hsl) representing the color you want to replace
2. Get the hsl value for your target color
3. Get image pixels and for each pixel:
4. calculate the hsl value of the pixel, and replace it with (pixelHsl / refHsl) * targetHsl
这做的工作对我来说,谁感谢帮助
This did the job for me, thanks for all who helped
这篇关于更换颜色在C#中的图像中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!