2
我有一个颜色检测和多个数组返回的问题... 因为我发现“Tuple”机器,我试图找到黑色背景上的白色像素(是的,他们是白色的)。我可以给你我所用,所以你可以想像这是怎么回事代码:多个阵列返回的颜色检测
private Tuple<int[], int[]> Find(Image<Gray, byte> bmp)
{
int rows = bmp.Rows;
int cols = bmp.Cols;
byte[,,] imgByte = bmp.Data;
int[] x = new int[10];
int[] y = new int[10];
for (int i = 0; i <= rows;i++)
{
for (int j = 0; j <= cols; j++)
{
if (imgByte[i, j, 0] == 255 && imgByte[i, j, 1] == 255 && imgByte[i, j, 2] == 255)
{
x[i] = i;
y[j] = j;
}
}
}
return Tuple.Create(x,y);
}
此代码是由一个按钮启动:
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Image);
Image<Gray, byte> img = new Image<Gray, byte>(bmp);
textBox1.Text = Find(img).ToString();
}
好的总结是,我需要找到那些像素并将它们写入某处(文本框或其他... nevermind),其中“x”是x标签,“y”是y标签。
此代码给我只能告诉我这样一些指标的异常是绑定的阵列外...
最后一件事是画面,我用:Picture
有人可以帮助我与此?.. THX的家伙:)
不工作对我来说:/ ..同样的问题:) – Apuna12
@ Apuna12 - 更新 – libik