【问题标题】:HoughLines invalid argumentsHoughLines 无效参数
【发布时间】:2016-03-21 20:12:36
【问题描述】:

您好,我正在使用 HoughLines 方法 来检测来自相机的线条,我已经使用 ROI 过滤了我的图像“imgProcessed”,这意味着只获取黑色物体来制作跟踪简单,然后当我打算使用 HoughLines 方法时,它给了我一个错误,我的“CannyEdges”有一些 invalid arguments,这是我的代码:

Image<Gray, Byte> gray = imgProcessed.Convert<Gray, Byte>().PyrDown().PyrUp();
        Gray cannyThreshold = new Gray(180);
        Gray cannyThresholdLinking = new Gray(120);
        Gray circleAccumulatorThreshold = new Gray(120);
        Image<Gray, Byte> cannyEdges = gray.Canny(cannyThreshold, cannyThresholdLinking);


        LineSegment2D[] lines = imgProcessed.cannyEdges.HoughLines(
                                cannyThreshold,
                                cannyThresholdLinking,
                                1,                  //Distance resolution in pixel-related units
                                Math.PI / 45.0,     //Angle resolution measured in radians.
                                50,                 //threshold
                                100,                //min Line width
                                1                   //gap between lines
                                )[0];               //Get the lines from the first channel

【问题讨论】:

    标签: c# .net emgucv


    【解决方案1】:

    我已经编辑了我的代码并且它可以工作,我将它设计为两个部分:第一部分我检测到精巧的边缘,而不是使用 HoughLines 方法自动检测它,以及第二次使用 HoughLinesBinary 方法 而不是 HoughLines 的参数较少,这里是代码:

            Image<Gray, Byte> gray1 = imgProcessed.Convert<Gray, Byte>().PyrDown().PyrUp();
            Image<Gray, Byte> cannyGray = gray1.Canny(120, 180);
            imgProcessed = cannyGray;
    
            LineSegment2D[] lines = imgProcessed.HoughLinesBinary(
                                    1,                  //Distance resolution in pixel-related units
                                    Math.PI / 45.0,     //Angle resolution measured in radians.
                                    50,                 //threshold
                                    100,                //min Line width
                                    1                   //gap between lines
                                    )[0];               //Get the lines from the first channel
    

    【讨论】:

      猜你喜欢
      • 2017-03-24
      • 2016-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      相关资源
      最近更新 更多