Emgucv Houghlines线的长度

时间:2015-01-02 11:28:52

标签: c# opencv emgucv hough-transform

我使用EmguCV houghines和边缘检测器应用程序来检测消融杆(木杆带红色和白色条纹),我需要知道,我如何获得像素的线长,如:第一行是50px长

代码示例

class HoughTransform
{
    private Image<Gray, Byte> _sourceImage;
    private Image<Gray, Byte> _linesImage;
    private Image<Gray, Byte> _resultImage;

    public HoughTransform()
    {

    }

    public void applyTransform()
    {
        try
        {
            _linesImage = _sourceImage.CopyBlank();
            LineSegment2D [] lines = _sourceImage.HoughLinesBinary(1, Math.PI/ 0.0, 50, 100, 1)[0];
            foreach(LineSegment2D line in lines)
            {
                _linesImage.Draw(line,new Gray(200), 5);
            }
            _resultImage = _linesImage;
        }
        catch(Exception e)
        {
            MessageBox.Show(e.ToString());
        }
    }

1 个答案:

答案 0 :(得分:0)

根据LineSegment2D的文档,行的长度可通过Length属性获得。

line.Length
相关问题