gpt4 book ai didi

c# - 图像处理 C#

转载 作者:行者123 更新时间:2023-11-30 13:49:31 24 4
gpt4 key购买 nike

我有一个函数来检查图像是否只有一种颜色。

bool r = true;
Color checkColor = image.GetPixel(0, 0);

for (int x = 0; x < image.Width; x++)
{
for (int y = 0; y < image.Height; y++)
{
if (image.GetPixel(x, y) != checkColor) { r = false; }
}
}
// image color
clrOut = checkColor;
return r;

但是这个算法对于大图像来说很慢。有谁知道使用像素着色器和 GPU 执行此操作的方法吗?

最佳答案

您不需要像素着色器和 GPU 来加快速度。使用 LockBits .鲍勃鲍威尔有一个很好的tutorial做你想做的事。

关于c# - 图像处理 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9296295/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com