1. 程式人生 > >線特征LSD and 描述子LBD(一)

線特征LSD and 描述子LBD(一)

and 0.12 原來 make computer 出現 進行 original -1

最近在看有關特征提取的線特征,暑期就看了相關的論文:《基於點線綜合特征的雙目視覺SLAM方法_謝曉佳》,最近呢,把裏面有關線特征提取LSD和描述子LBD的代碼跑了一遍,記錄如下:

[1]LSD: a Line Segment Detector線段檢測器

LSD是一種局部提取直線的算法,速度比Hough要快。 LSD是一種直線檢測分割算法,它能在線性的時間內得出亞像素級精度的檢測結果。該算法被設計成可以在任何數字圖像上都無需參數調節。它可以自己控制誤檢的數量:平均而言,每張圖有一個誤檢。

有幾篇比較好的博客是針對此算法的講解,推薦如下:

[1]http://blog.csdn.net/tianwaifeimao/article/details/17678669#comments

[2]http://blog.csdn.net/carson2005/article/details/9326847

[3]http://blog.csdn.net/polly_yang/article/details/10085401

http://blog.csdn.net/u011630458/article/details/54645107

(1)orignal代碼: 作者將自己的論文(LSD: a Line Segment Detector,2012)及代碼( c++)放到自己的主頁上:

http://www.ipol.im/pub/art/2012/gjmr-lsd/

(2)利用OpenCV和MATLAB進行封裝: http://blog.csdn.net/subtang/article/details/39552535

代碼:https://github.com/primetang/LSD-OpenCV-MATLAB

針對orignal代碼的運行過程:

編譯 make

技術分享

(提供了一個使用LSD作為模塊編譯程序的顯式示例。

The compilation line for ‘lsd_call_example.c‘ is just: cc -o lsd_call_example lsd_call_example.c lsd.c -lm)

LSD唯一的輸入圖像格式是PGM,輸出有兩個版本,ASCII和二進制。

./lsd chairs.pgm chairs.result.txt   //這裏輸入的是chairs.pgm圖像

將會給出結果關於一個ASCII文件 ‘chairs.result.txt‘ 其中每行對應一個檢測到的線段。每行由七個數字用空格隔開,

分別是X1Y1X2Y2,寬度,P- log_nfa

例如,行:159.232890 134.369601 160.325338 105.613616 2.735466 0.125000 17.212465

意味著一個線段的起始點(159.232890 134.369601),結束點(160.325338 105.613616)和檢測到寬度2.735466,角度精度p0.125,即p * 1800.125×18022.5度的梯度角公差。這個-log_10NFA= 17.212465,所以NFA的值為10 ^- 17.2124656),大約6e-18。長度單位是像素,坐標原點是左上角的像素中心(0,0)。

為了更容易地顯示結果,也可以輸出EPSSVG文件格式。例如,

./lsd -P chairs.result.eps chairs.pgm chairs.result.txt

ASCII輸出文件外,還將生成EPS文件‘chairs.result.eps‘

技術分享

註意:可選參數應該總是出現在所需參數的輸入和輸出之前。例如,下面的行是錯誤的:lsd chairs.pgm -s 0.5 chairs.result.txt -> WRONG!!

正確的是 lsd -s 0.5 chairs.pgm chairs.result.txt

技術分享

[2]LBD: line binary descriptor 線二進制描述符

[1] original code:http://www.mip.informatik.uni-kiel.de/tiki-index.php?page=Lilian+Zhang

[2]Update codehttps://github.com/mtamburrano/LBD_Descriptor

如果安裝[1] original code,Note that: The code is based on two open source libraries:BIAS and ARPACK( Besides, the SuperLU library is required by ARPACK). Before compiling the line matching code, you must configure the BIAS and ARPACK on your computer correctly. The code is tested by using BIAS version 2.8.0 and ARPACK++( SuperLU Version 2.0 is used for ARPACK).

安裝的是[2]Update code,運行過程:

mkdir build
cd build
cmake ..
make

最後出現了錯誤,原來是我的opencv的版本問題,解決:http://www.cnblogs.com/Jessica-jie/p/7509460.html

./TestLineMatchingAlgorithm 1.png 2.png

技術分享

技術分享

線特征LSD and 描述子LBD(一)