gpt4 book ai didi

c# - EmguCV Canny 黑窗

转载 作者:太空宇宙 更新时间:2023-11-03 12:56:17 25 4
gpt4 key购买 nike

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

最佳答案

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

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

关于c# - EmguCV Canny 黑窗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33720270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com