-1
我想找到具有白色背景的黑色矩形的边缘,但我不知道如何找到矩形的边缘。二维边缘检测黑色矩形与白色背景
到目前为止的代码是:
private void Vicky(object sender, MouseEventArgs e)
{
OpenFileDialog file = new OpenFileDialog();
if (file.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(file.FileName);
}
}
private void process(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Image);
for (int i = 0; i < bmp.Width; i++)
{
for (int j = 0; j < bmp.Height; j++)
{
Color pixelColor = bmp.GetPixel(i, j);
if (pixelColor.R == 0 && pixelColor.G == 0 && pixelColor.B == 0)
{
for (int x = i; x < bmp.Width; x++)
{
for (int y = x; y < bmp.Height; y++)
{
}
}
} // end if.
} // end inner for.
} //end outer for.
pictureBox1.Image = bmp;
} //end process.