【发布时间】:2015-01-02 11:28:51
【问题描述】:
我正在使用带有边缘检测器应用程序的 EmguCV houghines 来检测消融棒(带有红色和白色条纹的木棒),我需要知道如何获得以像素为单位的线条长度,例如:第一行是 50 像素长。
代码示例
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());
}
}
【问题讨论】:
标签: c# opencv emgucv hough-transform