This is an experimental approach to detect edge......we are very happy to get good edges from our derived formula....
This edge detectin is one the approaches of our contribution to image processing...hopefully I am going to organise all my works and making available in internet.....
C# sample code for edge detection function....
Bitmap b;
b = (Bitmap)pictureBox1.Image;
int n, m;
n = b.Height;
m = b.Width;
int cc = 0, total = 0;
Bitmap B1 = new Bitmap(m, n);
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
{
B1.SetPixel(i, j, Color.White);
}
for (int i = 1; i < m - 1; i++)
for (int j = 1; j < n - 1; j++)
{
total = Math.Abs(b.GetPixel(i + 1, j + 1).B - b.GetPixel(i, j).B) + Math.Abs(b.GetPixel(i + 1, j + 1).R - b.GetPixel(i, j).R);
if (total > val)
{ B1.SetPixel(i, j, Color.Black); continue; }
total = Math.Abs(b.GetPixel(i - 1, j + 1).B - b.GetPixel(i, j).B) + Math.Abs(b.GetPixel(i - 1, j + 1).R - b.GetPixel(i, j).R);
if (total > val)
{ B1.SetPixel(i, j, Color.Black); continue; }
}
pictureBox4.Image = new Bitmap(B1);
No comments:
Post a Comment