大哥大姐大叔大声们来帮小弟一把拉~~~~~~~~~~~~~~~ 比如 下面的图片(200*200)有没有什么快速的找到小红框的坐标啊??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void button1_Click(object sender, EventArgs e) { MessageBox.Show(GetRectangleBmp(Image.FromFile(@"C:\1.jpg")).ToString()); } private Point GetRectangleBmp(Image p_Image) { Bitmap _NewBitmap = new Bitmap(p_Image.Width, p_Image.Height,PixelFormat.Format24bppRgb); Graphics _Graphics = Graphics.FromImage(_NewBitmap); _Graphics.DrawImage(p_Image, 0, 0, p_Image.Width, p_Image.Height); _Graphics.Dispose(); BitmapData _Data = _NewBitmap.LockBits(new Rectangle(0, 0, _NewBitmap.Width, _NewBitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); byte[] _DataBytes = new byte[_NewBitmap.Width * _NewBitmap.Height * 3]; System.Runtime.InteropServices.Marshal.Copy(_Data.Scan0, _DataBytes, 0, _DataBytes.Length); int _ReadIndex = 0; for (int i = 0; i != _NewBitmap.Height; i++) { for (int z = 0; z != _NewBitmap.Width; z++) { if (_DataBytes[_ReadIndex * 3+2] > 200 && _DataBytes[_ReadIndex * 3 + 1] < 100 && _DataBytes[_ReadIndex * 3] < 100) { _NewBitmap.UnlockBits(_Data); _NewBitmap.Dispose(); return new Point(z, i); } _ReadIndex++; } } _NewBitmap.UnlockBits(_Data); _NewBitmap.Dispose(); return new Point(-1, -1); }看看行不行 大文本文件识别不了? js C#人事管理系统怎么做 C#如何修改图片大小? 大家帮我看下这段代码,想实现一个简单的获取键盘输入的操作. C#可以开发串口通讯程序吗? 把dataset里的char型数据转成string时有时会遇见异常..为什么啊? c# 访问ORACLE vs2010 用c#开发wince调用windows api函数的问题? 请教高手有关C#的DLL的使用???? active directory NT帐户锁定判断 在c#winform中怎么查询xml节点的内容
{
MessageBox.Show(GetRectangleBmp(Image.FromFile(@"C:\1.jpg")).ToString());
} private Point GetRectangleBmp(Image p_Image)
{
Bitmap _NewBitmap = new Bitmap(p_Image.Width, p_Image.Height,PixelFormat.Format24bppRgb);
Graphics _Graphics = Graphics.FromImage(_NewBitmap);
_Graphics.DrawImage(p_Image, 0, 0, p_Image.Width, p_Image.Height);
_Graphics.Dispose();
BitmapData _Data = _NewBitmap.LockBits(new Rectangle(0, 0, _NewBitmap.Width, _NewBitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); byte[] _DataBytes = new byte[_NewBitmap.Width * _NewBitmap.Height * 3];
System.Runtime.InteropServices.Marshal.Copy(_Data.Scan0, _DataBytes, 0, _DataBytes.Length); int _ReadIndex = 0;
for (int i = 0; i != _NewBitmap.Height; i++)
{
for (int z = 0; z != _NewBitmap.Width; z++)
{
if (_DataBytes[_ReadIndex * 3+2] > 200 && _DataBytes[_ReadIndex * 3 + 1] < 100 && _DataBytes[_ReadIndex * 3] < 100)
{
_NewBitmap.UnlockBits(_Data);
_NewBitmap.Dispose();
return new Point(z, i);
}
_ReadIndex++;
}
}
_NewBitmap.UnlockBits(_Data);
_NewBitmap.Dispose();
return new Point(-1, -1);
}
看看行不行