EmguCV Canny黑色窗口

时间:2015-11-15 13:33:53

标签: c# emgucv edge-detection

我有另一个问题。 Idk发生了什么事buti试图使Canny边缘探测器。问题是,当我想检测像方形的简单形状上的边时,程序能够检测到它。但是,当我想在非常简单的图像程序上检测形状时,只给我一个只用黑色填充的图像。你们知道发生了什么事吗?

我在下面使用以下代码:

 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);
    }

1 个答案:

答案 0 :(得分:1)

您是否尝试将grayCannyThreshold设置为小于grayThreshLinking的值?

Gray grayCannyThreshold = new Gray(80.0);
Gray grayThreshLinking = new Gray(160.0);
相关问题