X Y坐标数据的坐标 [英] X Y Coordinates for BitmapData

查看:235
本文介绍了X Y坐标数据的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





任何人都可以解释如何从BitmapData数组中找到X和Y坐标。还有如何扫描图像的特定区域以获取特定颜色像素。图像尺寸为1280x1024 24bit,我需要在X:50-150和Y:500-1000之间的区域扫描黑色。此外,我不想使用Rectangle,因为如果结果成功扫描特定区域后,相应像素的X和Y坐标用于计算同一图像中该区域之外的其他像素。



感谢System.Drawing.Bitmap对象中的

Hi,

Could anybody explain how to find X and Y Coordinates from BitmapData Array. Also how to scan a specific area of a image for specific color pixels. The Image size is 1280x1024 24bit, I need to scan in area between X: 50-150 & Y: 500-1000 for the color black. Also, I don''t want to use Rectangle because after scanning the specific area if the result is success then the respective pixel''s X and Y coordinates are used for calculating other pixels in the same image which are outside of this area.

Thanks

推荐答案

,你可以使用GetPixel(x, y)找到一个像素的颜色。





in the System.Drawing.Bitmap object you can use the GetPixel(x, y) to find the color of a pixel.


Bitmap bmp = new Bitmap(@"C:\test.bmp");
for (int x = 0; x < 151; x++)
    for (int y = 500; y < 1001; y++)
        if (bmp.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())
            MessageBox.Show("I found black!");


这篇文章似乎就是你要找的。

在C#中更快地使用位图 [ ^ ]
This article seems to be what your looking for.
Work with bitmaps faster in C#[^]


这篇关于X Y坐标数据的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆