Reputation: 239
i have another question. Idk what is happening buti tried to make Canny edge detector. Problem is that when i want to detect edges on simple shape like square, the program is able to detect it. But when i want to detect shapes on not very simple image program just gives me image filled by only black color. Do you guys have an idea what is going on?
I use this code below:
public Bitmap CannyEdge(Bitmap bmp)
{
Image<Gray, Byte> Cannybmp;
Image<Gray, Byte> GrayBmp;
Image<Bgr, Byte> orig = new Image<Bgr, Byte>(bmp);
Image<Bgr, Byte> imgSmooth;
Bitmap output;
imgSmooth = orig.PyrDown().PyrUp();
imgSmooth._SmoothGaussian(3);
GrayBmp = imgSmooth.Convert<Gray, byte>();
Gray grayCannyThreshold = new Gray(160.0);
Gray grayThreshLinking = new Gray(80.0);
Cannybmp = GrayBmp.Canny(grayCannyThreshold.Intensity, grayThreshLinking.Intensity);
output = Cannybmp.ToBitmap();
//int a = 5;
return output;
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Image);
pictureBox2.Image = CannyEdge(bmp);
}
Upvotes: 2
Views: 4452
Reputation: 91
Did you try to set your grayCannyThreshold to become lesser the value of your grayThreshLinking?
Gray grayCannyThreshold = new Gray(80.0);
Gray grayThreshLinking = new Gray(160.0);
Upvotes: 1