OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
cv::LineSegmentDetector 類參考抽象類

線段檢測器類。 更多...

#include <opencv2/imgproc.hpp>

cv::LineSegmentDetector 的協作圖

公共成員函式

virtual ~LineSegmentDetector ()
 
virtual int compareSegments (const Size &size, InputArray lines1, InputArray lines2, InputOutputArray image=noArray())=0
 用藍色和紅色繪製兩組線條,並計算非重疊(不匹配)的畫素。
 
virtual void detect (InputArray image, OutputArray lines, OutputArray width=noArray(), OutputArray prec=noArray(), OutputArray nfa=noArray())=0
 在輸入影像中查詢線條。
 
virtual void drawSegments (InputOutputArray image, InputArray lines)=0
 在給定影像上繪製線段。
 
- 從 cv::Algorithm 繼承的公共成員函式
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 清除演算法狀態。
 
virtual bool empty () const
 如果 Algorithm 為空(例如,在剛開始時或在讀取失敗後)則返回 true。
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 從檔案儲存中讀取演算法引數。
 
virtual void save (const String &filename) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
virtual void write (FileStorage &fs) const
 將演算法引數儲存到檔案儲存中。
 
void write (FileStorage &fs, const String &name) const
 

附加的繼承成員

- 從 cv::Algorithm 繼承的靜態公共成員函式
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 從檔案中載入演算法。
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 從字串載入演算法。
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 從檔案節點讀取演算法。
 
- 從 cv::Algorithm 繼承的保護成員函式
void writeFormat (FileStorage &fs) const
 

詳細描述

線段檢測器類。

遵循 [112] 中描述的演算法。

注意
由於原始程式碼許可證衝突,已從 OpenCV 版本 3.4.6 到 3.4.15 以及 4.1.0 到 4.5.3 中移除實現。 在 Computation of a NFA 程式碼在 MIT 許可證下發布後再次恢復。

建構函式 & 解構函式文件

◆ ~LineSegmentDetector()

virtual cv::LineSegmentDetector::~LineSegmentDetector ( )
inlinevirtual

成員函式文件

◆ compareSegments()

virtual int cv::LineSegmentDetector::compareSegments ( const Size & size,
InputArray lines1,
InputArray lines2,
InputOutputArray image = noArray() )
純虛擬函式
Python
cv.LineSegmentDetector.compareSegments(size, lines1, lines2[, image]) -> 返回值, image

用藍色和紅色繪製兩組線條,並計算非重疊(不匹配)的畫素。

引數
sizelines1 和 lines2 所在影像的大小。
lines1需要繪製的第一組線條。 它以藍色視覺化。
lines2第二組線條。 它們以紅色視覺化。
image可選影像,線條將在其中繪製。 該影像應該是彩色(3 通道)的,以便 lines1 和 lines2 以上述顏色繪製。
此函式的呼叫圖如下

◆ detect()

virtual void cv::LineSegmentDetector::detect ( InputArray image,
OutputArray 輸出向量,包含與另一影像中點對應的對極線。每條線\(ax + by + c=0\)由3個數字\((a, b, c)\)編碼。,
OutputArray width = noArray(),
OutputArray prec = noArray(),
OutputArray nfa = noArray() )
純虛擬函式
Python
cv.LineSegmentDetector.detect(image[, lines[, width[, prec[, nfa]]]]) -> lines, width, prec, nfa

在輸入影像中查詢線條。

這是上述影像上演算法預設引數的輸出。

image
引數
image灰度 (CV_8UC1) 輸入影像。 如果只需要選擇一個 roi,請使用:lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);
輸出向量,包含與另一影像中點對應的對極線。每條線\(ax + by + c=0\)由3個數字\((a, b, c)\)編碼。Vec4f 元素的向量,指定線的起點和終點。 其中 Vec4f 為 (x1, y1, x2, y2),點 1 為起點,點 2 為終點。 返回的線條嚴格按照梯度方向定向。
width找到線條的區域的寬度向量。 例如,線條寬度。
prec找到線條的精度向量。
nfa包含線區域中誤報數量的向量,精度為 10%。 值越大,對數的檢測效果越好。
  • -1 對應於 10 個平均誤報
  • 0 對應於 1 個平均誤報
  • 1 對應於 0.1 個平均誤報。 只有當物件型別為 LSD_REFINE_ADV 時才會計算此向量。
此函式的呼叫圖如下

◆ drawSegments()

virtual void cv::LineSegmentDetector::drawSegments ( InputOutputArray image,
InputArray lines )
純虛擬函式
Python
cv.LineSegmentDetector.drawSegments(image, lines) -> image

在給定影像上繪製線段。

引數
image將在其中繪製線條的影像。 應該大於或等於找到線條的影像。
輸出向量,包含與另一影像中點對應的對極線。每條線\(ax + by + c=0\)由3個數字\((a, b, c)\)編碼。線條顏色。

此類文件由以下檔案生成