HoughLines无效参数

本文关键字:参数 无效 HoughLines | 更新日期: 2023-09-27 18:02:59

我使用HoughLines方法从相机检测线,我已经过滤了我的图像"imgProcessed"使用ROI这意味着只获得黑色对象使跟踪简单,然后当我打算使用HoughLines方法它给我一个错误,我的"CannyEdges"有一些无效参数,这是我的代码:

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

HoughLines无效参数

我已经编辑了我的代码&它的工作原理,我已经设计了它分为两个部分:第一部分,我已经检测到精明的边缘,而不是使用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