问题描述
任何人都可以解释如何从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
推荐答案
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!");
这篇关于X Y坐标数据的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!