我使用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());
}
}