![](/img/trans.png)
[英]How to use OpenCv 3.0 CvInvoke.HoughLines method with EmguCv
[英]Emgucv Houghlines length of line
我將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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.