C# EmguCV Canny黑色窗口

C# EmguCV Canny黑色窗口,c#,emgucv,edge-detection,C#,Emgucv,Edge Detection,我还有一个问题。Idk正在发生什么,但我试图制作精明的边缘检测器。问题是,当我想要检测像正方形这样的简单形状上的边缘时,程序能够检测到它。但当我想在不太简单的图像上检测形状时,程序只会给我一个只有黑色填充的图像。你们知道怎么回事吗 我使用以下代码: public Bitmap CannyEdge(Bitmap bmp) { Image<Gray, Byte> Cannybmp; Image<Gray, Byte> GrayBmp;

我还有一个问题。Idk正在发生什么,但我试图制作精明的边缘检测器。问题是,当我想要检测像正方形这样的简单形状上的边缘时,程序能够检测到它。但当我想在不太简单的图像上检测形状时,程序只会给我一个只有黑色填充的图像。你们知道怎么回事吗

我使用以下代码:

 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);
    }
公共位图CannyEdge(位图bmp)
{
图像Cannybmp;
图像灰度bmp;
图像来源=新图像(bmp);
图像平滑;
位图输出;
imgSmooth=orig.PyrDown().PyrUp();
imgSmooth._光滑高斯(3);
GrayBmp=imgSmooth.Convert();
灰色Cannythreshold=新灰色(160.0);
灰色关联=新灰色(80.0);
Cannybmp=GrayBmp.Canny(grayCannyThreshold.Intensity,graythreshold.Intensity);
output=Cannybmp.ToBitmap();
//INTA=5;
返回输出;
}
私有无效按钮1\u单击(对象发送者,事件参数e)
{
位图bmp=新位图(pictureBox1.Image);
pictureBox2.Image=CannyEdge(bmp);
}

是否尝试将grayCannyThreshold设置为小于GrayThreshold的值

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

是的,我试过了。。。但我发现EmguCV 3.0已经破坏了pyrDown()函数。。。所以我只使用了对我来说应该合适的pyrUp()