Emgucv Houghlines的行长度
本文关键字:Houghlines Emgucv | 更新日期: 2023-09-27 18:36:07
我正在使用带有边缘检测器应用程序的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());
}
}
根据 LineSegment2D 的文档,可以通过 Length 属性获得行的长度。
line.Length