【问题标题】:EmguCV Canny black windowEmguCV Canny 黑色窗口
【发布时间】:2015-11-18 16:24:55
【问题描述】:

我还有一个问题。我知道发生了什么,但我试图制作 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);
    }

【问题讨论】:

    标签: c# emgucv edge-detection


    【解决方案1】:

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

    Gray grayCannyThreshold = new Gray(80.0);
    Gray grayThreshLinking = new Gray(160.0);
    

    【讨论】:

    • 是的,我试过了……但我发现 EmguCV 3.0 破坏了 pyrDown() 函数……所以我只使用了对我来说应该没问题的 pyrUp() :)
    猜你喜欢
    • 1970-01-01
    • 2020-07-04
    • 2013-01-17
    • 2021-11-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 2015-03-26
    • 2015-01-20
    相关资源
    最近更新 更多