朱镕杰,朱穎匯,王 玲,盧 偉,羅 慧,張志川
(南京農(nóng)業(yè)大學(xué)工學(xué)院,南京 210031)
基于尺度不變特征轉(zhuǎn)換算法的棉花雙目視覺定位技術(shù)
朱镕杰,朱穎匯,王 玲※,盧 偉,羅 慧,張志川
(南京農(nóng)業(yè)大學(xué)工學(xué)院,南京 210031)
為了給采棉機(jī)器人提供運(yùn)動(dòng)參數(shù),設(shè)計(jì)了一套雙目視覺測(cè)距裝置以定位棉株。對(duì)獲取的左右棉株圖像進(jìn)行經(jīng)背景分割等預(yù)處理。求取其在8個(gè)尺度下的高斯圖,通過尺度不變特征轉(zhuǎn)換SIFT(scale-invariant feature transform)算法在相鄰高斯差分圖中提取出SIFT關(guān)鍵點(diǎn);計(jì)算每個(gè)高斯圖中關(guān)鍵點(diǎn)鄰域內(nèi)4×4個(gè)種子點(diǎn)的梯度模值,得到128維特征向量。分割右圖關(guān)鍵點(diǎn)構(gòu)成的128維空間,得到二叉樹;利用最優(yōu)節(jié)點(diǎn)優(yōu)先BBF(best bin first)算法在二叉樹中尋找到172個(gè)與左圖對(duì)應(yīng)的粗匹配點(diǎn)。由隨機(jī)采樣一致性RANSAC(random sample consensus)算法求出基礎(chǔ)矩陣F,恢復(fù)極線約束,剔除誤匹配,得到分布在11朵棉花上的151對(duì)精匹配。結(jié)合通過標(biāo)定和F得到的相機(jī)內(nèi)外參數(shù),最終重建出棉花點(diǎn)云的三維坐標(biāo)。結(jié)果表明,Z軸重建結(jié)果比較接近人工測(cè)量,平均誤差為0.039 3 m,能夠反映棉花間的相對(duì)位置。
機(jī)器人;圖像處理;視覺;棉花;SIFT特征;雙目視覺;二叉樹;RANSAC算法
朱镕杰,朱穎匯,王 玲,盧 偉,羅 慧,張志川.基于尺度不變特征轉(zhuǎn)換算法的棉花雙目視覺定位技術(shù)[J].農(nóng)業(yè)工程學(xué)報(bào),2016,32(6):182-188.doi:10.11975/j.issn.1002-6819.2016.06.025 http://www.tcsae.org
Zhu Rongjie,Zhu Yinghui,Wang Ling,Lu Wei,Luo Hui,Zhang Zhichuan.Cotton positioning technique based on binocular vision with implementation of scale-invariant feature transform algorithm[J].Transactions of the Chinese Society of Agricultural Engineering(Transactions of the CSAE),2016,32(6):182-188.(in Chinese with English abstract) doi:10.11975/j.issn.1002-6819.2016.06.025 http://www.tcsae.org
棉花是中國(guó)的主要經(jīng)濟(jì)作物之一。美國(guó)、俄羅斯、埃及等產(chǎn)棉大國(guó)通常采用大規(guī)模機(jī)械化采收方式[1]。中國(guó)棉花常用的人工采摘方式勞動(dòng)強(qiáng)度大、成本高,嚴(yán)重制約著棉花生產(chǎn)規(guī)模的進(jìn)一步擴(kuò)大[2]。為此,采用棉花采摘機(jī)器人代替人工勞作有望大幅度降低采摘成本并提高生產(chǎn)效率[3-5],而雙目立體視覺系統(tǒng)正是采棉機(jī)器人的核心技術(shù)之一。
國(guó)內(nèi)外對(duì)農(nóng)業(yè)中的雙目視覺應(yīng)用均有不同程度的研究。國(guó)外方面,Kassay[6]等利用雙目立體視覺系統(tǒng)采集到水果圖像后,采用霍夫變換進(jìn)行圖像處理獲取水果的中心位置。Kondo[7]等基于番茄的顏色特征尋找和識(shí)別成熟的果實(shí),采用立體視覺技術(shù)獲取番茄的位置信息。Takahashi[8-10]等根據(jù)蘋果在立體圖像對(duì)中的視差將給定范圍的三維空間分割成若干個(gè)等距離的區(qū)間,將2幅圖像合成一幅中心圖像,然后獲取蘋果的深度信息。國(guó)內(nèi)方面,王玲[11]等利用激光傳感器采用了非接觸式的方法測(cè)量棉株表面的深度信息,但處理速度較慢且穩(wěn)定性不高。彭輝[12]等結(jié)合加速魯棒特征SURF(speed-up robust features)算子和極線約束對(duì)柑橘立體圖像對(duì)進(jìn)行匹配,在果實(shí)光線強(qiáng)弱不同時(shí)仍然能較好的進(jìn)行匹配,但是SURF算子對(duì)匹配對(duì)象視角差異的容忍度仍有不足。
本文在分析了國(guó)內(nèi)外對(duì)采摘機(jī)器人視覺系統(tǒng)的研究的基礎(chǔ)上,利用尺度不變特征轉(zhuǎn)換SIFT(scale-invariant feature transform)[13-14]算法對(duì)棉花的平移、旋轉(zhuǎn)、尺度縮放良好的抑制性提取棉花表面特征,采用基于最優(yōu)節(jié)點(diǎn)優(yōu)先BBF(best bin first)[15]算法的二叉樹搜索算法提高特征匹配的精度與效率,利用隨機(jī)采樣一致性RANSAC(random sample consensus)[16]算法估計(jì)基礎(chǔ)矩陣并去除誤匹配,并結(jié)合標(biāo)定結(jié)果得到相機(jī)內(nèi)部參數(shù)和外部運(yùn)動(dòng)參數(shù)進(jìn)行匹配點(diǎn)的三維重建完成棉花定位,以此為采摘機(jī)器人運(yùn)動(dòng)軌跡的規(guī)劃提供參數(shù)。
將鏡頭焦距為16mm的雙目相機(jī)、投影儀、1.8m×0.7m× 1.8 m角鋼架和PC機(jī)組建測(cè)距試驗(yàn)裝置,相機(jī)固定在投影儀兩側(cè),可隨意調(diào)整其俯仰角和偏轉(zhuǎn)角,以保證棉株處在相機(jī)的視野范圍內(nèi)(圖1-a)。
在投影儀打光和不打光二種條件下連續(xù)拍攝二張棉株圖像(圖1-b,c)。利用打光圖像棉花與背景對(duì)比度強(qiáng)的特點(diǎn)對(duì)圖像進(jìn)行二值化處理,以去除背景;結(jié)合不打光圖像獲取邊界清晰、紋理豐富的黑背景棉花圖像,進(jìn)一步進(jìn)行灰度拉伸、銳化等預(yù)處理,以增強(qiáng)棉花的灰度細(xì)節(jié)(圖1-d)。
圖1 圖像采集與預(yù)處理Fig.1 Image acquisition and pretreatment
2.1 SIFT關(guān)鍵點(diǎn)檢測(cè)與特征提取
尺度不變特征轉(zhuǎn)換SIFT特征僅依賴于圖像的局部信息,具有平移、旋轉(zhuǎn)、縮放不變性,同時(shí),對(duì)光照、投影、仿射的變化也具有一定的魯棒性。
首先,用不同尺度的二維高斯核函數(shù)(式1)與二維圖像卷積,實(shí)現(xiàn)棉花圖像的模糊濾波處理,獲取尺度k(k= 0~8)的高斯圖(式2);進(jìn)一步計(jì)算相鄰尺度高斯圖之間的差分圖(式3),獲得尺度k(k=1~8)的高斯差分圖。
其次,將尺度1~8的高斯差分圖堆積成一個(gè)三維尺度空間,檢測(cè)該空間中的數(shù)據(jù)點(diǎn)是否為其3×3×3立體鄰域內(nèi)的局部極值點(diǎn),局部極值點(diǎn)即為關(guān)鍵點(diǎn)(圖2-a),進(jìn)一步基于曲面擬合來精確定位關(guān)鍵點(diǎn)的坐標(biāo),并用二階求導(dǎo)法消除邊緣處的噪聲響應(yīng)。
最后,以關(guān)鍵點(diǎn)為中心,在其4×4鄰域窗口內(nèi)采樣16個(gè)種子點(diǎn),針對(duì)每一個(gè)種子點(diǎn),在尺度1~8的高斯圖上分別計(jì)算其梯度模值和方向(式4-5),基于種子點(diǎn)的8個(gè)模值獲取關(guān)鍵點(diǎn)的16×8=128維SIFT特征(圖2-b)。
試驗(yàn)結(jié)果表明,左、右圖分別檢測(cè)出1 529、1 493個(gè)關(guān)鍵點(diǎn)。
式中(x,y)表示圖像I上像素點(diǎn)的位置;σ為尺度空間因子。
圖2 SIFT特征向量Fig.2 SIFT feature vectors
2.2 二叉樹搜索
關(guān)鍵點(diǎn)匹配可以歸結(jié)為一個(gè)通過距離函數(shù)在高維空間上的相似性檢索問題,窮盡搜索雖能搜索到正確的匹配點(diǎn),但耗時(shí)大;基于二叉樹搜索算法并結(jié)合最優(yōu)節(jié)點(diǎn)優(yōu)先BBF的嵌套搜索算法可有效解決該問題。以左圖的第14個(gè)關(guān)鍵點(diǎn)為例,在右圖中搜索其匹配點(diǎn)的方法如圖3所示。
圖3 二叉樹搜索Fig.3 Search of binary tree
首先,創(chuàng)建二叉樹。在128維上分別計(jì)算右圖1 493個(gè)關(guān)鍵點(diǎn)的特征值方差,最大方差所在維為第105維,該維特征排序后的中值56.270 6對(duì)應(yīng)關(guān)鍵點(diǎn)366,以此為根節(jié)點(diǎn),將小于或等于中值的關(guān)鍵點(diǎn)集合歸入根節(jié)點(diǎn)的左枝,否則歸入右枝;依此類推,分別劃分根節(jié)點(diǎn)的左枝和右枝,直至葉節(jié)點(diǎn),從而創(chuàng)建了一個(gè)二叉樹(圖3-a)。同時(shí)按照尋找到的各節(jié)點(diǎn)劃分右圖棉花的二維圖像區(qū)域,這樣搜索匹配點(diǎn)時(shí)只需在由對(duì)應(yīng)節(jié)點(diǎn)劃分的區(qū)域內(nèi)尋找,而不必遍歷所有關(guān)鍵點(diǎn),有效地縮小了匹配點(diǎn)的搜索范圍(圖3-b)。
其次,二叉樹搜索。從二叉樹根節(jié)點(diǎn)366開始,在第105維上,由于左圖關(guān)鍵點(diǎn)14的特征值25.707 8小于等于右圖根節(jié)點(diǎn)的特征值56.2706,即表1中L-R≤0,則搜索路徑指向根節(jié)點(diǎn)的左子節(jié)點(diǎn),即關(guān)鍵點(diǎn)653,反之亦然。重復(fù)以上步驟,直至搜索路徑指向葉節(jié)點(diǎn),即366、653、167、404、112、22、11、41、164、13(圖3-a),搜索過程中同時(shí)依次記錄途經(jīng)節(jié)點(diǎn)的兄弟節(jié)點(diǎn)771、1 166、602、125、48、49、10、8、133。
再次,二叉樹嵌套搜索。獲取上述兄弟節(jié)點(diǎn)在二叉樹創(chuàng)建過程中產(chǎn)生的最大方差所在維及其特征值,并與左圖關(guān)鍵點(diǎn)14在對(duì)應(yīng)維上的特征值進(jìn)行比較,并將比較結(jié)果| L′-R′|進(jìn)行升序排序(表1),生成BBF優(yōu)先級(jí)序列兄弟節(jié)點(diǎn)10、602、8、771、1 166、125、49、48、133。依次從優(yōu)先級(jí)序列中的兄弟節(jié)點(diǎn)出發(fā),嵌套搜索二叉樹至葉節(jié)點(diǎn)(圖3-a),直至優(yōu)先級(jí)序列為空或到達(dá)200次搜索限制,返回若干個(gè)葉節(jié)點(diǎn)。
最后,確定匹配點(diǎn)。在128維特征空間下用歐氏距離比較左圖關(guān)鍵點(diǎn)14與右圖二叉樹搜索到的所有葉節(jié)點(diǎn)的相似度,返回歐氏距離最小的相似點(diǎn)13和次相似點(diǎn)121,對(duì)應(yīng)的相似度和次相似度分別為47.875 8和297.975 9(表2),定義相似度小于0.49×次相似度的相似點(diǎn)為匹配點(diǎn),則相似點(diǎn)13為左圖關(guān)鍵點(diǎn)14的匹配點(diǎn)。
表1 二叉樹搜索過程Table 1 Search procedure of binary tree
試驗(yàn)結(jié)果表明,針對(duì)左圖的1 529個(gè)關(guān)鍵點(diǎn),在右圖二叉樹上總計(jì)搜索出172對(duì)粗匹配點(diǎn)(表2),將匹配點(diǎn)在原圖中用線連起來(圖4),對(duì)應(yīng)于空間中的同一點(diǎn)。棉花在左右圖像中的對(duì)應(yīng)位姿不盡相同,有些差異甚至很大,由于SIFT特征對(duì)旋轉(zhuǎn)、平移和仿射的高抑制性,關(guān)鍵點(diǎn)的匹配效果良好,SIFT算法適應(yīng)棉花的形貌。
圖4 左右圖中棉花粗匹配點(diǎn)連線Fig.4 Connected lines of rough matches in left and right cotton images
3.1 基礎(chǔ)矩陣估計(jì)原理
從不同角度對(duì)同一場(chǎng)景拍攝的影像I與I′的極線幾何關(guān)系如圖5所示,空間任一點(diǎn)X在平面I與I′上的投影點(diǎn)分別為m與m′,2相機(jī)的光心C與C′的連線與平面I與I′相交于極點(diǎn)e與e′,平面XCC′與圖像平面I與I′的交線lm與lm′分別為點(diǎn)X在平面I和I′上的極線。
圖5 極線幾何約束Fig.5 Epipolar geometry constraint
假設(shè)匹配點(diǎn)對(duì)m與m′的齊次坐標(biāo)為u=(x,y,1)與u′=(x′,y′,1),平面I上的極線lm用基礎(chǔ)矩陣F或矢量f(式6-7)描述,由匹配點(diǎn)對(duì)與極線共面可給出平面I的極線方程(式8),u′TF為極線的直線坐標(biāo),極線方程展開后可表示為一個(gè)矢量?jī)?nèi)積(式9),則基礎(chǔ)矩陣F可由在平面I與I′上的對(duì)應(yīng)點(diǎn)u與u′求出。由n組匹配點(diǎn)對(duì)的集合可得到一個(gè)線性齊次方程組(式10),A的子空間的解即為矢量f。由于基礎(chǔ)矩陣具有7個(gè)自由度,故至少需要7個(gè)匹配點(diǎn)對(duì),通常采用7點(diǎn)或8點(diǎn)算法來估計(jì)基礎(chǔ)矩陣[17]。
3.2 基于RANSAC算法的基礎(chǔ)矩陣優(yōu)化
實(shí)際應(yīng)用中,由于噪聲的影響,粗匹配點(diǎn)對(duì)可能存在誤匹配,其中的誤匹配點(diǎn)對(duì)姑且稱作外點(diǎn)對(duì),因而有外點(diǎn)對(duì)參與的8點(diǎn)法對(duì)基礎(chǔ)矩陣的估計(jì)會(huì)產(chǎn)生誤差,從而使基礎(chǔ)矩陣的估計(jì)值惡化。為了解決這一問題,采用隨機(jī)采樣一致性RANSAC方法,通過重復(fù)地對(duì)特征集采樣,基于歐式距離來獲得內(nèi)點(diǎn)對(duì)并剔除外點(diǎn)對(duì),基于內(nèi)點(diǎn)對(duì)的基礎(chǔ)矩陣估算可提高8點(diǎn)算法的魯棒性。具體步驟分二步:
首先,基于8點(diǎn)法求解基礎(chǔ)矩陣并估計(jì)參數(shù)。從172個(gè)粗匹配點(diǎn)對(duì)中任取8個(gè)匹配點(diǎn)對(duì),對(duì)這些匹配點(diǎn)對(duì)坐標(biāo)進(jìn)行歸一化處理[18],以提高結(jié)果的穩(wěn)定性。將歸一化的8組匹配點(diǎn)坐標(biāo)代入線性齊次方程組(式10),求解基礎(chǔ)矩陣F(表3)。將左圖的關(guān)鍵點(diǎn)坐標(biāo)u=(x,y,1)和基礎(chǔ)矩陣F代入平面I的極線方程(式8),以恢復(fù)右圖的極線,計(jì)算右圖的粗匹配點(diǎn)到該極線的距離distL,反之可獲取左圖的關(guān)鍵點(diǎn)到極線的距離distR,距離均小于1.5的粗匹配點(diǎn)對(duì)為內(nèi)點(diǎn)對(duì)(表4),并估計(jì)所有內(nèi)點(diǎn)對(duì)的誤差(式11)。
式中inlierCount表示內(nèi)點(diǎn)對(duì)數(shù)。
表3 8點(diǎn)法的輸入與輸出Table 3 Inputs and outputs of 8 point algorithm
表4 判別內(nèi)點(diǎn)對(duì)Table 4 Determination of inliers
然后,基于RANSAC法優(yōu)化基礎(chǔ)矩陣。在采樣次數(shù)N足夠大的情況下,假設(shè)n=8組匹配點(diǎn)對(duì)組成的隨機(jī)樣本中,至少有一次沒有外點(diǎn)對(duì)的概率為P,默認(rèn)值為0.99;在粗匹配點(diǎn)對(duì)中,出現(xiàn)外點(diǎn)對(duì)的概率為e,默認(rèn)值為0.6;則初始N=7 024.6(式12)。在每一次重復(fù)采樣過程中,都要基于8點(diǎn)法求解基礎(chǔ)矩陣,估計(jì)內(nèi)點(diǎn)對(duì)數(shù)及其誤差,以內(nèi)點(diǎn)對(duì)數(shù)最多或誤差較小來優(yōu)化F(表5);同時(shí),還要根據(jù)上一次的e自適應(yīng)地決定新的N,這樣,隨著內(nèi)點(diǎn)對(duì)數(shù)的不斷增加,e和N越來越小,從而使得重復(fù)采樣過程快速收斂,提高算法的運(yùn)算速度。試驗(yàn)結(jié)果表明,在第16次采樣過程中(表4,表5),內(nèi)點(diǎn)對(duì)數(shù)增加到151時(shí),由N<16終止重復(fù)采樣過程,從172組粗匹配點(diǎn)對(duì)中剔除了誤匹配。
表5 基于RANSAC法優(yōu)化基礎(chǔ)矩陣Table 5 Refined fundamental matrix based on RANSAC
4.1 相機(jī)內(nèi)外參數(shù)的獲取
假設(shè)世界坐標(biāo)系下的一個(gè)點(diǎn)(X,Y,Z)在圖像坐標(biāo)系下的坐標(biāo)為(u,v),根據(jù)針孔成像模型和圖像坐標(biāo)系與世界坐標(biāo)系之間的轉(zhuǎn)換關(guān)系[19-20](式13)可知,必須標(biāo)定相機(jī)的內(nèi)參矩K和外參矩陣M,才能根據(jù)圖像坐標(biāo)點(diǎn)轉(zhuǎn)換成世界坐標(biāo)點(diǎn)。
式中λ為比例系數(shù),相機(jī)的內(nèi)參K包括u、v軸的歸一化焦距fu、fv,相機(jī)光心坐標(biāo)(u0,v0);相機(jī)的外參M包括相機(jī)之間的旋轉(zhuǎn)矩陣R和平移矩陣t。
首先,相機(jī)內(nèi)參標(biāo)定。張正友[21]和Tsai[22]的方法假設(shè)平面網(wǎng)格在世界坐標(biāo)系中,通過線性模型計(jì)算攝像機(jī)內(nèi)部參數(shù)的優(yōu)化解,并基于最大似然法進(jìn)行非線性求解,標(biāo)定出考慮鏡頭畸變的目標(biāo)函數(shù),從而求出左右相機(jī)的內(nèi)參矩陣(表6)。由于標(biāo)定試驗(yàn)中采用了DH-HV3151UC-ML型CMOS工業(yè)數(shù)字相機(jī),其分辨率為2 048×1 536,單位像素尺寸為3.2 μm×3.2 μm,鏡頭焦距為16 mm。因而,理想情況下,相機(jī)的歸一化焦距fu=fv=16 000 μm/3.2 μm=5 000,相機(jī)的光心坐標(biāo)u0=1 024、v0=768。由此可見,相機(jī)內(nèi)參的實(shí)際標(biāo)定結(jié)果與理論值有些許偏差,這可能是由相機(jī)制造工藝引起的。
然后,相機(jī)外參標(biāo)定。在已知相機(jī)內(nèi)參K的情況下,基礎(chǔ)矩陣F可由本質(zhì)矩陣E求取(式14),使用歸一化坐標(biāo)系時(shí),基礎(chǔ)矩陣F的一種特殊形式就是本質(zhì)矩陣[23]。本質(zhì)矩陣最早由Longuet-Higgins在1981年由從運(yùn)動(dòng)到結(jié)構(gòu)的求解中導(dǎo)出[24],該矩陣是一個(gè)自由度為5、秩為2的3× 3矩陣,它的一個(gè)重要性質(zhì)就是與內(nèi)參無關(guān),僅由相機(jī)的外參確定(式14),實(shí)際計(jì)算時(shí)用四元數(shù)表示法[25](式15)通過本質(zhì)矩陣E恢復(fù)出相機(jī)的旋轉(zhuǎn)矩陣R和平移矩陣t(表6)。
表6 相機(jī)內(nèi)外參數(shù)標(biāo)定Table 6 Calibration of camera intrinsic and extrinsic parameters
4.2 棉花的三維重建
采摘機(jī)器人工作時(shí),隨著機(jī)器人在田間行走,固定在機(jī)械臂上空橫桿上的兩相機(jī)角度可調(diào),需要不斷估計(jì)2個(gè)相機(jī)之間的外參。因而可將左相機(jī)光心作為世界坐標(biāo)系的原點(diǎn),調(diào)整左相機(jī)的俯仰角和偏轉(zhuǎn)角,使世界坐標(biāo)系的Z軸垂直于地面,這樣左相機(jī)相對(duì)自身的旋轉(zhuǎn)、平移矩陣為單位陣I、零向量,右相機(jī)相對(duì)左相機(jī)的旋轉(zhuǎn)、平移矩陣為R、t,將151組精匹配點(diǎn)對(duì)的圖像坐標(biāo)以及左右相機(jī)的內(nèi)外參數(shù)代入方程組(式13)進(jìn)行最小二乘法求解,得到151個(gè)空間點(diǎn)的三維坐標(biāo)(圖6),由圖可知,11簇點(diǎn)云團(tuán)代表了棉花的空間位置。
將預(yù)處理后的棉花灰度圖(圖1-d)二值化,并以其為模板獲取單朵棉花表面的點(diǎn)云,進(jìn)而求取單朵棉花的三維質(zhì)心坐標(biāo),將其Z軸坐標(biāo)轉(zhuǎn)化為棉花到地面的距離(表7)。試驗(yàn)結(jié)果表明,雙目視覺的Z軸測(cè)距結(jié)果比較接近人工測(cè)量,平均誤差為0.039 3 m,能夠反映棉花間的相對(duì)位置。
圖6 棉花點(diǎn)云三維坐標(biāo)Fig.6 Scatter diagram of cotton point cloud
表7 棉花三維重建結(jié)果Table 7 Result of cotton 3D reconstruction
1)設(shè)計(jì)試驗(yàn)裝置時(shí),采用投影儀打光和不打光結(jié)合的方式采集圖像,在保留了棉花表面豐富紋理的同時(shí)兼顧了邊界的清晰;相機(jī)角度的可調(diào)性要求不斷估計(jì)新的相機(jī)外參,能夠適應(yīng)機(jī)器人田間行走的多樣性。
2)SIFT特征的旋轉(zhuǎn),平移,縮放和仿射不變性能夠適應(yīng)田間棉花的形貌。
3)結(jié)合BBF優(yōu)先級(jí)序列的二叉樹搜索算法提高了粗匹配的運(yùn)行效率,并且避免了高維特征搜索問題;基于RANSAC的基礎(chǔ)矩陣優(yōu)化算法極大地降低了精匹配的計(jì)算開銷。
[1]王玲,姬長(zhǎng)英.農(nóng)業(yè)機(jī)器人采摘棉花的前景展望與技術(shù)分析[J].棉花學(xué)報(bào),2006,18(2):124-128.Wang Ling,Ji Changying.Technical analysis and expectation for cotton harvesting based on agricultural robot[J].Cotton Science, 2006,18(2):124-128.(in Chinese with English abstract)
[2]王玲,姬長(zhǎng)英,陳兵林,等.基于機(jī)器視覺技術(shù)的田間籽棉品級(jí)抽樣分級(jí)模型研究[J].中國(guó)農(nóng)業(yè)科學(xué),2007,40(4):704-711.Wang Ling,Ji Changying,Chen Binglin,et al.Researches of grading model of field sampling cotton based on machine vision technology[J].Scientia Agricultura Sinica,2007,40(4):704-711.(in Chinese with English abstract)
[3]韋皆頂,費(fèi)樹岷,汪木蘭,等.采棉機(jī)器人的研究現(xiàn)狀及關(guān)鍵技術(shù)[J].農(nóng)機(jī)化研究,2007(7):14-18.Wei Jieding,Fei Shumin,Wang Mulan,et al.Key techniques and research statue for cotton picking robot[J].Journal of Agricultural Mechanization Research,2007(7):14-18.(in Chinese with English abstract)
[4]Edan Y,Miles G E.Design of an agricultural robot for harvesting melons[J].Transactions of the ASAE,1993,36(2):593-603.
[5]Arima S,Kondo N.Cucumber harvesting robot and plant training system[J].Journal of Robotics and Mechatronics,1999,11(3): 208-212.
[6]Kassay L,Slaughter D.Robotic apple harvest[Z].St.Joseph. Mich:ASAE,1992,ASAE Paper No.922047.
[7]Kondo N,Nishitsuji Y,Ling P.Visual feedback guided robotic cherry tomato harvesting[J].Transactions of the ASAE,1996,39 (6):2331-2338.
[8]Takahashi T,Zhang S,Sun M,et al.New method of image processing for distance measurement by a passive stereo vision [Z].St.Joseph,Mich:ASAE,1998,ASAE Paper No.983031.
[9]Takahashi T,Zhang S,Fukuchi H,et al.Binocular stereo vision system for measuring distance of apples in orchard(Part 1)-Method due to composition of left and right images[J].Journal of the Japanese Society of Agricultural Machinery,2000,62(1): 89-99.
[10]Takahashi T,Zhang S,Fukuchi H,et al.Binocular stereo vision system for measuring distance of apples in orchard(Part 2)-Analysis of and solution to the correspondence problem[J]. Journal of the Japanese Society of Agricultural Machinery,2000, 62(3):94-102.
[11]王玲,劉思瑤,盧偉,等.面向采摘機(jī)器人的棉花激光定位算[J].農(nóng)業(yè)工程學(xué)報(bào),2014,30(14):42-48.Wang Ling,Liu Siyao,Lu Wei,et al.Laser detection method for cotton orientation in robotic cotton picking[J].Transactions of the Chinese Society of Agricultural Engineering(Transactions of the CSAE),2014,30(14):42-48.(in Chinese with English abstract)
[12]彭輝,文友先,翟瑞芳,等.結(jié)合SURF算子和極線約束的柑橘立體圖像對(duì)匹配[J].計(jì)算機(jī)工程與應(yīng)用,2011,47(8):157-160.Peng Hui,Wen Youxian,Zhai Ruifang,et al.Stereo matching for binocular citrus images using SURF operator and epipolar constraint[J].Computer Engineering and Applications,2011,47 (8):157-160.(in Chinese with English abstract)
[13]Lowe D G.Distinctive image features from scale-invariant key points[C].International Journal of Computer Vision,2004,60(2): pp91-110.
[14]Lowe D G.Object recognition from local scale invariant features [C].Proceeding of the Seventh International Conference on Computer.Vision.Washington,DC:IEEE Computer Society, 1999:1150.
[15]張開玉,梁鳳梅.基于改進(jìn)SURF的圖像配準(zhǔn)關(guān)鍵算法研究[J].科學(xué)技術(shù)與工程,2013,13(10):2875-2879.Zhang Kaiyu,Liang Fengmei.Research on the key algorithm for image matching based on improved SURF[J].Science Technology and Engineering,2013,13(10):2875-2879.(in Chinese with English abstract)
[16]Fischler M,Bolles R.Random sample consensus:A paradigm formodel fitting with application to image analysis and automated cartography[J].Communications of the ACM,1981(24):381-395.
[17]Richard I.Hartley.In defense of the 8-point algorithm[C],In Proceeding of International Conference on Computer Vision (ICCV),1995:1064-1070.
[18]Hartley,Richard.計(jì)算機(jī)視覺中的多視圖幾何[M].安徽:安徽大學(xué)出版社,2002:193.
[19]馬頌德,張正友.計(jì)算機(jī)視覺-計(jì)算理論與算法基礎(chǔ)[M].北京:科學(xué)出版社,1998:53~58.
[20]David A,Forsyth,Jean Ponce.計(jì)算機(jī)視覺-一種現(xiàn)代方法[M].北京:電子工業(yè)出版社,2004,54~55.
[21]Zhang Zhengyou.Flexible camera calibration by viewing a plane from unknown orientations[C],IEEE International Conference on Computer Vision,1999,1:666-673.
[22]Tsai R Y.An efficient and accurate camera calibration technique for 3D machine vision[C],CVPR,1986,364-374.
[23]Quanquan Gu,Jie Zhou.Belief propagation on Riemannian manifold for stereo matching[C].IEEE International Conference on Image Processing,2008,15:1788-1791.
[24]HughC.Longuet-Higgins.Acomputeralgorithm forreconstructing a scene from two projections[J].Nature,1981,293(5):133-135.
[25]Zhang Zhengyou.A new multistage approach to motion and structure estimation by gradually enforcing geometric constraints [C].Proceedings of the ACCV’98,Hong Kong,l998:567-574.
Cotton positioning technique based on binocular vision with implementation of scale-invariant feature transform algorithm
Zhu Rongjie,Zhu Yinghui,Wang Ling※,Lu Wei,Luo Hui,Zhang Zhichuan
(College of Engineering,Nanjing Agricultural University,Nanjing 210031,China)
Rapid development of mechanization in agriculture has made it possible to lower the manual labor hour and increase efficiency at the same time.In order to provide the mechanical arm of the cotton picking robot with the needed movement locus parameters,a cotton distance measuring device based on binocular vision with a full implementation of SIFT (scale-invariant feature transform)algorithm was introduced,which realized the positioning of all 11 pieces of cotton planted. Under indoor environment,the cotton images were captured with the control of projector flashlight and the unneeded backgrounds were segmented.Turn the RGB images into gray scale and enhance the gray value to make the cotton more obvious,and after sharpening the edges,the pretreatments of cotton images were finished.Blur the images through Gaussian filter with 8 different scales,calculate the DoG(difference of Gaussian)of Gaussian images and acquire the extrema of 26 neighboring pixels within neighboring scales,and thus SIFT key points were detected,all these key points were invariant to rotation,translation,zoom and affine,which was suitable for the match of cotton images.Calculate the gray gradient modulus value of the 4×4 seed points in 8 directions within the key point neighborhood,and the 128-dimensional SIFT descriptor of each key point was acquired.As to all the SIFT key points in the right image,select the dimension with the maximum variance,and calculate the median value of this dimension,find its corresponding key point and split the other key points according to the median value,repeat this step and the binary tree was built.As to every SIFT key point in the left image, search its potential matches(probably more than one)in the binary tree of the right image until its leaf node was found;save the brother nodes found along the path,establish priority sequence with BBF(best bin first)and expand from the brother nodes to their leaves,find the nearest and second nearest neighbors according to the similarity degree of the 128-dimensional key points between the potential matches until the sequence was empty or the algorithm exceeded its 200 times constraint. Thus 172 pairs of rough cotton matches of key points in 2 images were acquired,but there was still a possibility that there might be wrong matches among rough matches.In order to eliminate the wrong matches,estimate fundamental matrix with RANSAC(random sample consensus)algorithm and recover epipolar geometry constraint;during each sampling,use 8-point algorithm to compute an initial fundamental matrix,calculate the distance from every point to its corresponding epipolar line and count the ones within the threshold as inliers.Repeat this step and choose the fundamental matrix with the most inliers or the least error(in case there were more than one fundamental matrix with the same inlier number)as the final output fundamental matrix,and the corresponding inliers were called refined cotton matches.Using the RANSAC algorithm we got 151 pairs of refined cotton matches,and there were no wrong matches in the refined matches,which helped make the results of cotton three-dimensional(3D)reconstruction more accurate.Calibrate the camera to get its intrinsic matrix,and then get essential matrix according to fundamental matrix and intrinsic matrix through transformation.Split essential matrix and the camera′s external rotation matrix and translation vector were acquired.To this point,inputs needed for cotton 3D reconstruction were all ready,and they were 151 pairs of refined matches of cotton,intrinsic matrix,external rotation matrix and translation vector.Put these inputs into the equations and 2D cotton image coordinates could be transformed into 3D coordinates,and the 3D reconstruction of cotton point cloud on the plant was realized.At last the 3D coordinate values of every cotton were obtained and their centroid coordinate values were calculated.Result showed that all 11 pieces of cotton were all successfully 3D positioned,with an average error of 0.039 3m compared with manual measurement,which proves the calculated data are valid and this binocular vision system is reliable enough for practical application.
robots;image processing;vision;cotton;SIFT features;binocular vision;binary tree;RANSAC algorithm
10.11975/j.issn.1002-6819.2016.06.025
S24;TP242.6
A
1002-6819(2016)-06-0182-07
2015-12-01
2016-01-28
朱镕杰(1991-),男,江蘇南通人,主要從事雙目視覺技術(shù)研究。南京 南京農(nóng)業(yè)大學(xué)工學(xué)院 210031。Email:zrj564366@126.com
※通信作者:王 玲(1966-),女,江西南昌人,副教授,博士,碩士生導(dǎo)師,主要從事圖像處理與模式識(shí)別技術(shù)研究。南京 南京農(nóng)業(yè)大學(xué)工學(xué)院 210031。Email:Lingw@njau.edu.cn
農(nóng)業(yè)工程學(xué)報(bào)2016年6期