更快地循环图像的方法

2024-04-07

有谁知道如何更快地完成这项工作?我可以使用 Lockbits 做同样的事情吗?

for (int y = 0; y < picture.Height; y++)
{
    for (int x = 0; x < picture.Width; x++)
    {
         Color colorPixel = picture.GetPixel(x, y);

         if ((colorPixel.A > 230) &&
            (colorPixel.R < 20) &&
            (colorPixel.G < 20) &&
            (colorPixel.B < 20))
            {
                    //do something
            }

Thanks.


这是一篇关于在 C# 中快速比较图像的文章。它以一个相当慢的版本开始(仍然比 GetPixel 更好),最后得到一个快 25 倍的版本:

http://danbystrom.se/2008/12/14/improving-performance/ http://danbystrom.se/2008/12/14/improving-performance/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

更快地循环图像的方法 的相关文章

随机推荐