趙明巖,林 敏,徐 鵬,王勇金,宋天月,梁明軒,胡劍虹
·農(nóng)產(chǎn)品加工工程·
基于三維重構(gòu)的哈蜜瓜均瓣雕花算法
趙明巖1,林 敏1,徐 鵬2※,王勇金1,宋天月1,梁明軒1,胡劍虹1
(1. 中國(guó)計(jì)量大學(xué)機(jī)電工程學(xué)院,杭州 310018; 2. 中國(guó)計(jì)量大學(xué)理學(xué)院,杭州 310018)
為解決哈密瓜雕刻速度慢、花瓣大小不一致等問題,該研究提出了一種基于三維重構(gòu)的哈蜜瓜均瓣雕花算法。對(duì)多角度拍攝得到的哈蜜瓜照片進(jìn)行濾波處理,提取其圖像特征并進(jìn)行稀疏重建,通過點(diǎn)云坐標(biāo)得出哈蜜瓜的特征參數(shù);接著在稀疏點(diǎn)的基礎(chǔ)上利用CMVS/PMVS算法進(jìn)行稠密重建;最后調(diào)節(jié)八叉樹算法與泊松表面重建,得到哈密瓜精確三維空間坐標(biāo)。根據(jù)哈密瓜體型特征及設(shè)定花瓣數(shù)量,將點(diǎn)云三角網(wǎng)格化在深度優(yōu)先算法的基礎(chǔ)上結(jié)合粒子群算法,規(guī)劃雕刻起點(diǎn)、終點(diǎn)及雕刻深度,使每個(gè)花瓣體積相同。采用48個(gè)哈密瓜,雕刻花瓣數(shù)取15~30,雕刻深度為1.5、2.0、2.5 cm。其中切割花瓣數(shù)為28這一組精度最低,測(cè)得最大與最小花瓣體積分別為3.40與3.25 cm3,最大體積差為0.15 cm3,誤差小于5%。結(jié)果表明,該研究提出的基于三維重構(gòu)的哈蜜瓜均瓣雕花算法精度高,研究結(jié)果可為機(jī)器人雕刻哈密瓜提供技術(shù)支持。
圖像處理;粒子群算法;三維重構(gòu);均瓣雕花;點(diǎn)云拼接;三角網(wǎng)格化
自動(dòng)化是餐飲行業(yè)發(fā)展的必然趨勢(shì)。炒菜機(jī)器人[1-2]、送餐機(jī)器人[3-4]等已能夠部分取代人工,極大提高了工作效率。對(duì)于蔬果雕花作業(yè),目前仍然依靠人工手工雕刻,不僅費(fèi)時(shí)費(fèi)力,且存在安全隱患,人口老齡化及人工成本的日益增加使雕花熟練工的缺口越來越大。隨著生活水平的提高及餐飲智能化時(shí)代的到來,研制蔬果雕花機(jī)器人也刻不容緩。尤其對(duì)結(jié)構(gòu)雖然繁雜但具有一定規(guī)律的花型,機(jī)器人雕花具有巨大的優(yōu)勢(shì)。然而雕刻對(duì)象的大小、形狀、品種往往不完全一致,因此在實(shí)施雕刻之前,必須對(duì)雕刻對(duì)象進(jìn)行三維重構(gòu)[5-8],以獲得精確的三維空間坐標(biāo)[9],從而規(guī)劃執(zhí)行終端的雕刻路徑。
哈密瓜是一種常見的水果,常常被雕刻成花籃,盛放果肉、高檔菜品等。當(dāng)哈密瓜每個(gè)花瓣的體積完全相等時(shí),視覺效果最好。由于哈密瓜外形(以及去籽后的內(nèi)部)并非精確的軸對(duì)稱形狀,因此人工雕刻時(shí),很難做到每瓣體積完全相同。如果對(duì)哈密瓜進(jìn)行三維重構(gòu),得到哈密瓜外形(以及去籽后的內(nèi)部)的精確尺寸(空間坐標(biāo)點(diǎn)),就能規(guī)劃?rùn)C(jī)器人的雕刻路徑,從而實(shí)現(xiàn)預(yù)期效果。
澳大利亞的Lehnert等[10]設(shè)計(jì)了收割機(jī)器人Harvey,將機(jī)器人視覺技術(shù)和作物操作工具相結(jié)合,利用三維重構(gòu)技術(shù)通過點(diǎn)云顏色的突變來檢測(cè)甜椒臨界削根位置,對(duì)目標(biāo)甜椒花梗進(jìn)行定位,確定花梗的質(zhì)心,成功率達(dá)76.5%。郭彩玲等[11]使用三維激光掃描儀提出了基于靶球的KD-trees-ICP算法,用于高精度配準(zhǔn)蘋果樹冠層三維點(diǎn)云數(shù)據(jù),得到高于人工測(cè)量精度的枝干、果實(shí)、葉片參數(shù),相對(duì)誤差小于5%。柴宏紅等[12]基于甜菜多視角圖像序列構(gòu)建甜菜根的三維點(diǎn)云模型,較為準(zhǔn)確提取了甜菜最大直徑、根長(zhǎng)、頂投影面積、緊湊度、突起率等10個(gè)表型參數(shù),初步建立了產(chǎn)糖量與表型參數(shù)的關(guān)系。孔彥龍等[13]基于圖像綜合特征提取,得到馬鈴薯周長(zhǎng)和面積,進(jìn)而將馬鈴薯分選為圓形、橢圓形、畸形三類,分選準(zhǔn)確率達(dá)96%。吳丹等[14]通過輪廓投影方法重建水稻三維可視外殼點(diǎn)云模型,并利用反投影方法進(jìn)行點(diǎn)云著色,提取水稻更為全面的性狀參數(shù),但伴有誤匹配。Hui等[15]基于稠密重建(Multiple View Stereo,MVS)方法從黃瓜、辣椒、茄子的圖重建三維點(diǎn)云,提取和評(píng)價(jià)了植物結(jié)構(gòu)的表型參數(shù)。Mortensen等[16]通過萵苣的彩色三維點(diǎn)云分割,提取體積、表面積、葉面積的高度預(yù)測(cè)因子,并將鮮質(zhì)量進(jìn)行分析,得到較高預(yù)測(cè)精度(1值范圍0.88~0.91)。從以上分析可知三維重構(gòu)技術(shù)應(yīng)用廣泛,可測(cè)得大小、形狀不一的多種不規(guī)則對(duì)象的各項(xiàng)表型參數(shù)。但上述研究方法尚有不足之處,如提取三維點(diǎn)云數(shù)量少、精度低、耗時(shí)長(zhǎng),相關(guān)儀器費(fèi)用高、操作繁瑣等,且鮮有關(guān)于利用三維重構(gòu)結(jié)果進(jìn)行機(jī)器人路徑規(guī)劃的研究。
本文提出了基于三維重構(gòu)的哈密瓜均瓣雕花算法并應(yīng)用于機(jī)器人實(shí)現(xiàn)。獲取全面的三維層面表型信息后,在粒子群算法的輔助下[17],實(shí)現(xiàn)高精度雕花,為哈密瓜(或其他蔬果)三維幾何重建、機(jī)器人雕花提供技術(shù)支持。
為精確獲取欲雕花對(duì)象輪廓,采用雙攝像頭并行拍攝。為減少左右攝像頭的相互干擾,在暗室光源的選擇上采用條狀白光LED。將兩條功率為9.6 W的條狀LED安裝在蔬果雕花裝置中左右攝像頭的旁側(cè),暗室內(nèi)側(cè)作白色噴漆處理,通過光源的漫反射,可使待檢測(cè)區(qū)域達(dá)到檢測(cè)的光學(xué)環(huán)境[18]要求且無陰影。
另將主攝像頭固定在機(jī)械臂上,調(diào)整主攝像頭使相機(jī)光軸方向在水平方向上[19]。其中攝像頭使用固定光圈拍攝,拍攝時(shí)盡可能繞光心旋轉(zhuǎn),相鄰照片應(yīng)有一定重疊部分使最終的3D點(diǎn)云盡可能密集、光順。
調(diào)整攝像頭的高度,使攝像頭以30°俯視角對(duì)哈密瓜進(jìn)行拍攝,哈密瓜在托盤作用下勻速旋轉(zhuǎn)(轉(zhuǎn)速為4 r/min),托盤每轉(zhuǎn)動(dòng)3°攝像頭拍攝一張圖片,哈密瓜旋轉(zhuǎn)一周后,獲得一組序列圖像;再次調(diào)整攝像頭高度,使得攝像頭以30°仰視角對(duì)哈密瓜進(jìn)行拍攝,哈密瓜每轉(zhuǎn)動(dòng)3°攝像頭拍攝一張圖像,獲得一組序列圖像,如圖1所示。
通過多角度拍攝獲得多視圖后,根據(jù)運(yùn)動(dòng)結(jié)構(gòu)算法(Structure From Motion,SFM)得到相機(jī)位置[20],采用尺度不變特征變換算法(Scale-Invariant Feature Transform,SIFT)提取圖像中特征點(diǎn)的局部特征[21],在尺度空間中尋找極值點(diǎn),然后使用高斯差分算子建立圖像的多尺度表示,確定特征點(diǎn)的位置、尺度和方向參數(shù),并產(chǎn)生圖像描述符。
用Kd-tree模型[22]計(jì)算兩兩圖片相應(yīng)特征點(diǎn)之間的歐氏距離,進(jìn)行特征點(diǎn)的匹配,找到特征點(diǎn)匹配個(gè)數(shù)達(dá)到要求的圖像對(duì),計(jì)算對(duì)極幾何,估計(jì)矩陣并通過隨機(jī)抽樣一致算法(Random Sample Consensus,RANSAC)優(yōu)化改善匹配對(duì)[23],若特征點(diǎn)能在匹配對(duì)中鏈?zhǔn)絺鬟f,便能形成相機(jī)軌跡。
在算法中采用Kd-tree的數(shù)據(jù)結(jié)構(gòu)計(jì)算最鄰匹配,當(dāng)距離在設(shè)定的預(yù)知范圍內(nèi)時(shí)即判定為可接受的匹配對(duì),針對(duì)特征點(diǎn)不一定能一一對(duì)應(yīng)的問題,采用去除重復(fù)特征點(diǎn)匹配對(duì)的算法來解決。對(duì)于初選匹配對(duì)仍有可能不可靠的情況,如匹配到的特征點(diǎn)在實(shí)際場(chǎng)景中不符合物理規(guī)律等,引入幾何約束來檢測(cè)。通過計(jì)算對(duì)極幾何,矩陣將匹配對(duì)圖像中的像素坐標(biāo)聯(lián)系起來,其中包含相機(jī)的內(nèi)參信息,增加符合實(shí)際匹配對(duì)的像素坐標(biāo)均需滿足:
[1][1]T=0 (2)
式中[1]、[1]為匹配對(duì)像素坐標(biāo)。
用RANSAC算法將矩陣計(jì)算出的噪聲數(shù)據(jù)濾去,即可確定所有匹配對(duì)將匹配對(duì)之間出現(xiàn)的共同特征點(diǎn)相連形成軌跡,根據(jù)軌跡構(gòu)造圖像連接圖,連接圖包含每個(gè)圖像的節(jié)點(diǎn)并有著共同的軌跡邊緣。三維重構(gòu)算法流程如圖2所示。
1.3.1 平面檢測(cè)
通過隨機(jī)抽樣最大似然估計(jì)算法(Maximum Likelihood Estimation by Sample and Consensus,MLESAC)對(duì)3D點(diǎn)云進(jìn)行平面檢測(cè)[24],采用最大似然估計(jì)將問題轉(zhuǎn)化成求解代價(jià)函數(shù)的最小值問題,代價(jià)函數(shù)公式為:
用歸一化8點(diǎn)算法獲得基本矩陣,計(jì)算原始數(shù)據(jù)中每對(duì)匹配點(diǎn)之間的距離d[25],其中
1.3.2點(diǎn)云旋轉(zhuǎn)及點(diǎn)云降噪
由于拍攝角度變化等原因,重構(gòu)出的哈密瓜3D點(diǎn)云圖容易呈現(xiàn)傾斜姿態(tài),因此需要對(duì)其姿態(tài)進(jìn)行校正。
通過平面檢測(cè),確定蔬果所在平面,以該平面為標(biāo)準(zhǔn),采用三維放射變換矩陣M對(duì)整個(gè)點(diǎn)云進(jìn)行旋轉(zhuǎn)并縮放,最后,對(duì)處理過的點(diǎn)云進(jìn)行降噪。點(diǎn)云拼接過程如圖3所示,點(diǎn)云旋轉(zhuǎn)矩陣為:
將處理完成的點(diǎn)云坐標(biāo)導(dǎo)出,共計(jì)927 094個(gè)點(diǎn),可見點(diǎn)云數(shù)據(jù)能夠詳盡描述哈密瓜的各個(gè)特征。
根據(jù)相機(jī)的內(nèi)部參數(shù)與外部參數(shù),以及個(gè)視角下得到的條軌跡[26],能對(duì)哈密瓜的空間構(gòu)型實(shí)現(xiàn)基本的還原。為解決二維圖像到三維立體構(gòu)型過程存在的投影誤差問題,引入光束平差法(Bundle Adjustment, BA)對(duì)三維重建進(jìn)行優(yōu)化[27]。
式中為3D點(diǎn)個(gè)數(shù),為拍攝場(chǎng)景個(gè)數(shù),v為第個(gè)3D點(diǎn)在第個(gè)場(chǎng)景上的映射,(a,b)為點(diǎn)在場(chǎng)景的預(yù)測(cè)投影,x為第個(gè)3D點(diǎn)在第個(gè)場(chǎng)景中的實(shí)際坐標(biāo),(,)為向量,的歐式距離。
首先選擇有足夠多匹配點(diǎn)、有足夠遠(yuǎn)離相機(jī)中心的初始化匹配對(duì),用5點(diǎn)法估計(jì)初始化匹配對(duì)的外部參數(shù),然后利用軌跡三角化提供初始化的3D點(diǎn),對(duì)初始化的兩幀圖像進(jìn)行第一次BA。隨后不斷增加新的圖片和3D點(diǎn)進(jìn)行BA,直到剩下的圖片觀察到的特征點(diǎn)不超過20為止,結(jié)束BA。由此可以得到哈密瓜在空間中的稀疏3D點(diǎn)云,在稀疏點(diǎn)的基礎(chǔ)上利用集群多視角立體視覺算法(Cluster Multi-view Stereo, CMVS)和基于面片的三維多視角立體視覺算法(Patch-based Multi-view Stereo,PMVS)進(jìn)行稠密重建,調(diào)節(jié)八叉樹深度控制細(xì)節(jié)精度,再進(jìn)行泊松表面重建,修復(fù)流型邊緣,最后進(jìn)行參數(shù)化和紋理投影得到重構(gòu)后的哈密瓜,即三維重構(gòu)完成,如圖4所示。
在重構(gòu)過程中,密瓜由927 094個(gè)點(diǎn)云拼接而成,在眾多點(diǎn)云中以任意一點(diǎn)為基準(zhǔn)尋找距離該點(diǎn)最近的兩個(gè)點(diǎn)形成初始三角形,再以三角形的三條邊為基準(zhǔn)線繼續(xù)向外拓展三角形,直至所有點(diǎn)云都被包含于該哈密瓜空間立體三角網(wǎng)模型中,如圖5a所示。
待點(diǎn)云三角網(wǎng)格化完成后,將空間立體三角網(wǎng)投影到坐標(biāo)軸的面。設(shè)坐標(biāo)(1,1,1),(2,2,2),(3,3,3),1(4,4,0),1(5,5,0),1(6,6,0),如圖5b所示。
通過海倫公式計(jì)算投影三角形面積,以投影后3個(gè)點(diǎn)坐標(biāo)的平均值作為高,進(jìn)而計(jì)算得到三棱錐體積。
三角形各邊長(zhǎng)分別為:
式中1、2、3為三角形三邊邊長(zhǎng),cm。
Δ111周長(zhǎng)的一半為:
式中為三角形周長(zhǎng)的一半,cm。
Δ111面積為:
式中為三角形面積,cm2。
三棱錐的高為:
式中為三棱錐的高,cm。
三棱錐的體積為:
式中為三棱錐的體積,cm3。
重復(fù)的二維平面圖形可重構(gòu)出哈密瓜的點(diǎn)云模型,通過視覺處理識(shí)別深度、顏色、輪廓等特征,從而進(jìn)行布點(diǎn)。
2.2.1 獲取哈密瓜表型參數(shù)
圖6為上位機(jī)重構(gòu)得到的三維哈密瓜正視圖,選取該目標(biāo)擬合出一個(gè)外接矩形,需要事先定義一個(gè)比率來測(cè)量每個(gè)給定度量單位的像素?cái)?shù)pixels_per_metric(比率指標(biāo))。為了確定被雕刻哈密瓜的實(shí)際高度,需要使用一個(gè)參照物作為校準(zhǔn)線,通過比率指標(biāo)可求出矩形最上條邊與校準(zhǔn)線的實(shí)際高度,將實(shí)際高度傳送給機(jī)械臂,實(shí)際高度對(duì)應(yīng)的就是機(jī)械臂軸的值。
2.2.2 俯視角度計(jì)算下刀口密度與軸及軸機(jī)械坐標(biāo)
在上位機(jī)的俯視圖中,通過OpenCV函數(shù)引用cv2類的輪廓周長(zhǎng)變量得到哈密瓜周長(zhǎng)數(shù)據(jù)[28]:
perimeter = cv2.arcLength(cnt,True) (13)
式中perimeter為輪廓周長(zhǎng),cv2.arcLength()為計(jì)算輪廓周長(zhǎng)的函數(shù)。
假設(shè)計(jì)算得到哈密瓜周長(zhǎng)為68 cm,在其輪廓上均勻地取34個(gè)點(diǎn)記為預(yù)起點(diǎn),這樣相鄰點(diǎn)之間的弧長(zhǎng)為68/34=2.0 cm,再將這34個(gè)點(diǎn)與哈密瓜內(nèi)核圓心相連接,連接線與內(nèi)核輪廓的34個(gè)交點(diǎn)記為走刀路徑的預(yù)終點(diǎn)。這34個(gè)預(yù)終點(diǎn)與之前的34個(gè)預(yù)起點(diǎn)就會(huì)形成34段預(yù)雕刻路徑,如圖7所示。
哈密瓜形態(tài)不同,重構(gòu)結(jié)果也不同,為使雕刻效果最好,應(yīng)使雕刻后每一瓣果肉體積相同。首先,確定哈密瓜切削高度與深度,保留該高度與深度下的密瓜點(diǎn)云,剔除其他點(diǎn)云的坐標(biāo)信息;然后,根據(jù)密瓜最外圈點(diǎn)云擬合出圓弧函數(shù)確定圓心,將360°除以雕刻瓣數(shù)確定雕刻預(yù)起點(diǎn)、預(yù)雕刻終點(diǎn)、預(yù)雕刻路徑;而后以每一瓣花瓣體積相等為目標(biāo)函數(shù),以每一瓣花瓣切削深度相等、切削角度相等為限制條件,在深度優(yōu)先算法[29]的基礎(chǔ)上結(jié)合粒子群算法,通過不斷地遞歸迭代在密瓜點(diǎn)云坐標(biāo)中找到較優(yōu)解;最后將找到的較優(yōu)點(diǎn)云坐標(biāo)儲(chǔ)存為新的數(shù)據(jù)集,上位機(jī)調(diào)用數(shù)據(jù)集中的點(diǎn)云坐標(biāo)控制機(jī)械臂走刀,對(duì)哈密瓜進(jìn)行雕刻。雕刻刀切割次數(shù)取決于取點(diǎn)的個(gè)數(shù),可由用戶自定義設(shè)置。
對(duì)于復(fù)雜的三維模型,可在已知三維重構(gòu)點(diǎn)云的基礎(chǔ)上通過算法獲得。在哈密瓜外側(cè)標(biāo)記出新數(shù)據(jù)集中的點(diǎn)云坐標(biāo)。
圖8中,輪廓1為刀具的定位圓,半徑為(+2 mm),2 mm的半徑差保證了在每次切入時(shí)刀具不會(huì)誤觸蜜瓜側(cè)面;輪廓2為待雕刻蜜瓜的最小外接圓,半徑為(mm);輪廓3起到了確定雕刻深度的作用,不僅保證了花瓣的整齊,也能保證切斷余料。姿勢(shì)點(diǎn)1為定位點(diǎn),姿勢(shì)點(diǎn)2為切入點(diǎn),姿勢(shì)點(diǎn)3為退刀點(diǎn)。
在每個(gè)花瓣的雕刻過程中,姿勢(shì)點(diǎn)1、2、3共線。刀具先移動(dòng)到姿勢(shì)點(diǎn)1調(diào)整到合適的姿態(tài)角后從姿勢(shì)點(diǎn)2切入,接著沿刀具的刀脊運(yùn)動(dòng)一定深度到姿勢(shì)點(diǎn)3并退刀至姿勢(shì)點(diǎn)1,然后刀具沿著哈密瓜的外側(cè)運(yùn)動(dòng)至下一個(gè)相鄰的姿勢(shì)點(diǎn)1,重復(fù)上述過程,完成哈密瓜的整體雕刻。雕刻機(jī)器人為納智(NACHI)MZ04-01-CFD-0000的6自由度機(jī)器人。雕刻裝置采用特殊的刀具,集合了雕刻圓刀,玉婉刀以及鋸齒刀,刀具送行速度可達(dá)8.03 rad/s,雕刻時(shí)刀具與水平面夾角維持在60°,切割深度為設(shè)定值,如圖9所示。
雕刻完成后,每個(gè)花瓣的體積均相同,達(dá)到最佳視覺效果。為驗(yàn)證該算法的精確度,分別通過計(jì)算規(guī)則及不規(guī)則模型的體積進(jìn)行試驗(yàn)驗(yàn)證,構(gòu)建正方體、三棱錐、半球模型。通過坐標(biāo)點(diǎn)信息可以計(jì)算出正方體、三棱錐、半球的體積與表面積值。為進(jìn)一步驗(yàn)證算法的可行性,計(jì)算得到不規(guī)則石塊、哈密瓜體積后,再用排水法測(cè)得其對(duì)應(yīng)體積。為了計(jì)算模型體積,在構(gòu)建的模型上提取點(diǎn)云數(shù)據(jù),構(gòu)造空間Delaunay三角網(wǎng)[30],將構(gòu)建的空間三角網(wǎng)中的每個(gè)三角形投影到面,計(jì)算出投影三角形的面積與3個(gè)頂點(diǎn)縱坐標(biāo)的平均值后,相乘得到三棱錐體積,將所有三棱錐體積累加即可得到模型總體積。各模型計(jì)算值與實(shí)測(cè)值的對(duì)比如表1所示。
由測(cè)試結(jié)果可知,對(duì)于正方體、三棱錐模型的體積、表面積,計(jì)算值與實(shí)測(cè)值一致,絕對(duì)誤差為0;對(duì)于半球模型的體積和表面積,計(jì)算值與實(shí)測(cè)值誤差小于0.02%,只有十分微小的偏差。由此可知該方法用于規(guī)則模型的體積與表面積計(jì)算是可行的。對(duì)于不規(guī)則的石塊、哈密瓜,通過點(diǎn)云三角網(wǎng)重建計(jì)算得到的體積與實(shí)測(cè)體積誤差小于5%。
表1 不同形狀模型計(jì)算值與實(shí)測(cè)值對(duì)比
基于多視角拍攝圖片重建的哈密瓜三維模型包含其相應(yīng)的顏色、紋理、幾何尺寸等信息,并可根據(jù)三維點(diǎn)云提取哈密瓜的各種表型參數(shù)。為驗(yàn)證擬合后哈密瓜橫截面輪廓精度,提取哈密瓜不同高度所對(duì)應(yīng)的最大直徑參數(shù),其計(jì)算值與實(shí)測(cè)值對(duì)比如表2所示。
表2 哈密瓜直徑計(jì)算值與實(shí)測(cè)值對(duì)比
通過以上數(shù)據(jù)可知,高度為7.38 cm的哈密瓜,其最大直徑為15.79 cm;直徑實(shí)際測(cè)量值與計(jì)算值的最大誤差值為0.39 cm,不同高度的哈密瓜直徑測(cè)量值與其計(jì)算值基本吻合。
進(jìn)一步驗(yàn)證雕刻后哈密瓜花瓣的每一瓣體積是否相等。試驗(yàn)樣本數(shù)量為48個(gè)哈密瓜,每3個(gè)哈密瓜分為一組,雕刻花瓣數(shù)取15~30,雕刻深度取1.5、2.0、2.5 cm,結(jié)果如表3所示。
對(duì)各個(gè)哈密瓜雕花模型進(jìn)行重構(gòu)雕花驗(yàn)證,其中切割花瓣數(shù)=28這一組精度最低,哈密瓜花瓣體積的實(shí)際測(cè)量值與計(jì)算值如圖10所示。
表3 哈密瓜組間花瓣平均體積的差異統(tǒng)計(jì)
注:絕對(duì)誤差為花瓣平均體積與花瓣理論體積之差;為雕刻深度。
Note: The absolute error is the difference between the average volume of petals and the theoretical volume of petals.is the engraving depth.
由圖10可知28瓣哈密瓜花瓣體積實(shí)測(cè)值分布在計(jì)算值的上下兩側(cè)。根據(jù)試驗(yàn)數(shù)據(jù)可知雕刻深度=1.5 cm時(shí),最大花瓣體積為3.40 cm3,最小花瓣體積為3.25 cm3,花瓣體積差值的最大值僅為0.15 cm3;雕刻深度=2.0 cm時(shí),最大花瓣體積為4.37cm3,最小花瓣體積為4.25 cm3,花瓣體積差值的最大值僅為0.12 cm3;雕刻深度=2.5 cm時(shí),最大花瓣體積為5.06 cm3,最小花瓣體積為4.95 cm3,花瓣體積差值的最大值僅為0.11 cm3;誤差小于5%,視覺效果較好。
1)建立了哈密瓜的點(diǎn)云模型,對(duì)多角度拍攝得到的哈蜜瓜照片進(jìn)行濾波處理,提取其圖像特征并進(jìn)行稀疏重建,接著在稀疏點(diǎn)的基礎(chǔ)上利用CMVS/PMVS算法進(jìn)行稠密重建,得到哈密瓜點(diǎn)云的坐標(biāo);
2)提出了哈密瓜均瓣雕花算法,通過Delaunay三角網(wǎng)將點(diǎn)云三角化,將單個(gè)計(jì)算得到的三棱錐體積累加,在各花瓣體積相等的目標(biāo)函數(shù)及多個(gè)約束條件下輔以粒子群算法,最終得到機(jī)器人雕刻路線;
3)將均瓣雕花算法應(yīng)用于計(jì)算正方體、三棱錐、半球體等模型,體積誤差最大值不超過0.02%;應(yīng)用于石塊、哈密瓜等不規(guī)則體誤差最大值不超過5%;
4)本文提出了一種基于三維重構(gòu)的哈蜜瓜均瓣雕花算法,除了準(zhǔn)對(duì)稱回轉(zhuǎn)體,也可用于其他非均勻?qū)ΨQ幾何模型體積、表面積的求解以及形態(tài)特征參數(shù)的提取,適用于智慧餐廳、智慧農(nóng)業(yè)領(lǐng)域。
[1] 杜險(xiǎn)峰,張培茵,蘆健萍. 烹飪機(jī)器人創(chuàng)新實(shí)驗(yàn)平臺(tái)開發(fā)[J]. 對(duì)外經(jīng)貿(mào),2018(1):136-138.
Du Xianfeng, Zhang Peiyin, Lu Jianping. Development of innovative experimental platform for cooking robot[J]. Foreign Economic Relations & Trade, 2018(1): 136-138. (in Chinese with English abstract)
[2] 鄧威,楊淋暉,劉唯. 智慧餐廳炒菜機(jī)器人工業(yè)設(shè)計(jì)實(shí)踐研究[J]. 產(chǎn)業(yè)科技創(chuàng)新,2020,2(19):61-62.
Deng Wei, Yang Linhui, Liu Wei. Industrial design and practice of intelligent restaurant cooking robot[J]. Industrial Technology Innovation, 2020, 2(19): 61-62. (in Chinese with English abstract)
[3] 黃云峰. 基于E-puck機(jī)器人自主巡線智能小車的餐廳送餐系統(tǒng)設(shè)計(jì)[J]. 自動(dòng)化與儀器儀表,2020(9):75-78.
Huang Yunfeng. Design of restaurant food delivery system based on E-Puck robot autonomous patrol intelligent car[J]. Automation & Instrumentation, 2020(9): 75-78. (in Chinese with English abstract)
[4] 劉彩霞,顧帥,楊正濤. 校園送餐機(jī)器人控制系統(tǒng)的設(shè)計(jì)[J]. 制造業(yè)自動(dòng)化,2021,43(1):93-95.
Liu Caixia,Gu Shuai,Yang Zhengtao. Design of control system of campus meal delivery robot[J]. Manufacturing Automation, 2021, 43(1): 93-95. (in Chinese with English abstract)
[5] Jiang D L, Hu Y X, Yan S C, et al. Efficient 3D reconstruction for face recognition[J]. Pattern Recognition, 2005, 38(6): 787-798.
[6] 朱浩然,高琪,王洪平,等. 基于機(jī)器學(xué)習(xí)方法的三維粒子重構(gòu)技術(shù)[J]. 實(shí)驗(yàn)流體力學(xué),2021,35(3):88-93.
Zhu Haoran, Gao Qi, Wang Hongping, et al. Particle reconstruction of volumetric particle image velocimetry with strategy of machine learning[J]. Journal of Experiments in Fluid Mechanics, 2021, 35(3): 88-93. (in Chinese with English abstract)
[7] 駱涌,周開鄰,馬琳,等. 多平行平面SEM圖像的計(jì)算機(jī)輔助三維重構(gòu)[J]. 電子顯微學(xué)報(bào),1996(6):126.
Luo Yong, Zhou Kailin, Ma Lin, et al. Computer aided 3D reconstruction of multi parallel plane SEM images[J]. Journal of Chinese Electron Microscopy Society, 1996(6): 126. (in Chinese with English abstract)
[8] 宋小春,趙大興,鐘毓寧. 基于漏磁檢測(cè)數(shù)據(jù)的缺陷三維重構(gòu)技術(shù)[J]. 中國(guó)機(jī)械工程,2008,19(8):905-908.
Song Xiaochun, Zhao Daxing, Zhong Yuning. 3D reconstruction technology of the MFL inspection data[J]. China Mechanical Engineering, 2008, 19(8): 905-908. (in Chinese with English abstract)
[9] Zhang Aiwu, Li Mingzhe, Hu Shaoxing, et al. 3D measurement technology based on computer vision[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2001, 17(1): 32-37.
張愛武,李明哲,胡少興,等. 基于計(jì)算機(jī)視覺的三維測(cè)量技術(shù)[J]. 農(nóng)業(yè)工程學(xué)報(bào),2001,17(1):32-37. (in English with Chinese abstract)
[10] Lehnert C, Mccool C, Sa I, et al. Performance improvements of a sweet pepper harvesting robot in protected cropping environments[J]. Journal of Field Robotics, 2020, 37(7): 1-27.
[11] 郭彩玲,宗澤,張雪,等. 基于三維點(diǎn)云數(shù)據(jù)的蘋果樹冠層幾何參數(shù)獲取[J]. 農(nóng)業(yè)工程學(xué)報(bào),2017,33(3):175-181.
Guo Cailing, Zong Ze, Zhang Xue, et al. Apple tree canopy geometric parameters acquirement based on 3D point clouds[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2017, 33(3): 175-181. (in Chinese with English abstract)
[12] 柴宏紅,邵科,于超,等. 基于三維點(diǎn)云的甜菜根表型參數(shù)提取與根型判別[J]. 農(nóng)業(yè)工程學(xué)報(bào),2020,36(10):181-188.
Cai Honghong, Shao Ke, Yu Chao, et al. Extraction of phenotypic parameters and discrimination of beet root types based on 3D point cloud[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2020, 36(10): 181-188. (in Chinese with English abstract)
[13] 孔彥龍,高曉陽,李紅玲,等. 基于機(jī)器視覺的馬鈴薯質(zhì)量和形狀分選方法[J]. 農(nóng)業(yè)工程學(xué)報(bào),2012,28(17):143-148.
Kong Yanlong, Gao Xiaoyang, Li Hongling, et al. Potato grading method of mass and shapes based on machine vision[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2012, 28(17): 143-148. (in Chinese with English abstract)
[14] 吳丹,葉軍立,王康,等. 基于輪廓投影的盆栽水稻三維重建方法研究[J]. 中國(guó)農(nóng)業(yè)科技導(dǎo)報(bào),2020,22(9):87-95.
Wu Dan, Ye Junli, Wang Kang, et al. Three-dimension reconstruction method based on silhouette for pot rice[J]. Journal of Agricultural Science and Technology, 2020, 22(9): 87-95. (in Chinese with English abstract)
[15] Hui F, Zhu J Y, Hu P C, et al. Image-based dynamic quantification and high-accuracy 3D evaluation of canopy structure of plant populations.[J]. Annals of Botany, 2018, 121(5): 1-10.
[16] Mortensen A K, Bender A, Whelan B, et al. Segmentation of lettuce in coloured 3D point clouds for fresh weight estimation[J]. Computers and Electronics in Agriculture, 2018, 154: 373-381.
[17] Li X Z, Mao K Z, Lin F F, et al. Particle swarm optimization with state-based adaptive velocity limit strategy[J]. Neurocomputing, 2021, 447: 1-16.
[18] 王曉東,胡松鈺. 激光結(jié)構(gòu)光測(cè)量連續(xù)調(diào)節(jié)智能光源控制器設(shè)計(jì)[J]. 紅外與激光工程,2021,50(3):165-173.
Wang Xiaodong, Hu Songyu. Research on echo filtering algorithm of multi pulse laser range extended target in dynamic clutter background of airborne platform[J]. Infrared and Laser Engineering, 2021, 50(3): 165-173. (in Chinese with English abstract)
[19] 張建宇,高天宇,于瀟雁,等. 基于自適應(yīng)時(shí)延估計(jì)的空間機(jī)械臂連續(xù)非奇異終端滑模控制[J]. 機(jī)械工程學(xué)報(bào),2021,57(11):177-183.
Zhang Jianyu, Gao Tianyu, Yu Xiaoyan, et al. Continuous non-singular terminal sliding mode control of space robot based on adaptive time delay estimation[J]. Journal of Mechanical Engineering, 2021, 57(11): 177-183. (in Chinese with English abstract)
[20] Shu L, Schlüter A D, Ecker C, et al. Extremely long dendronized polymers: Synthesis, quantification of structure perfection, individualization, and SFM manipulation[J]. Angewandte Chemie, 2001, 113: 4802-4805.
[21] Kumar P, Henikoff S, Ng P C. Predicting the effects of coding non-synonymous variants on protein function using the SIFT algorithm.[J]. Nature Protocols, 2009, 4(8): 1073-1081.
[22] Hu K, Jiang M, Zhang H, et al. Design of fault diagnosis algorithm for electric fan based on LSSVM and Kd-Tree[J]. Applied Intelligence, 2021, 51(6): 1-15.
[23] Schnabel R, Wahl R, Klein R. Efficient RANSAC for point-cloud shape detection[J]. Computer Graphics Forum, 2010, 26(2): 214-226.
[24] 劉宇,熊有倫. 基于法矢的點(diǎn)云拼合方法[J]. 機(jī)械工程學(xué)報(bào),2007(8):7-11.
Liu Yu, Xiong Youlun. Registration method for point clouds based on normal vectors[J]. Journal of Mechanical Engineering, 2007(8): 7-11. (in Chinese with English abstract)
[25] Tordoff B J, Murray D W. Guided-MLESAC: Faster image transform estimation by using matching priors[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2005, 27(10): 1523-1535.
[26] 張恒康,何玉明,張耿耿,等. 一種單相機(jī)測(cè)量三維運(yùn)動(dòng)軌跡的方法[J]. 固體力學(xué)學(xué)報(bào),2010,31(S1):171-176.
Zhang Hengkang, He Yuming, Zhang Genggeng, et al. A new method of binoculars stereo vision with single camera[J]. Chinese Journal of Solid Mechanics, 2010, 31(S1): 171-176. (in Chinese with English abstract)
[27] Granshaw S I. Bundle adjustment methods in engineering photogrammetry[J]. The Photogrammetric Record, 2006, 10(56):181-207.
[28] Gong S N, Kumar R, Kumutha D. Design of lighting intelligent control system based on OpenCV image processing technology[J]. International Journal of Uncertainty, Fuzziness and Knowledge-Based Systems, 2021, 29(Suppl 1): 1-21.
[29] 屈立成,呂嬌,趙明,等. 基于三維時(shí)空地圖和運(yùn)動(dòng)分解的多機(jī)器人路徑規(guī)劃算法[J]. 計(jì)算機(jī)應(yīng)用,2020,40(12):3499-3507.
Qu Licheng, Lü Jiao, Zhao Ming, et al. Multi-robot path planning algorithm based on 3D spatiotemporal maps and motion decomposition[J]. Journal of Computer Applications, 2020, 40(12): 3499-3507. (in Chinese with English abstract)
[30] Shewchuk J R. Delaunay refinement algorithms for triangular mesh generation[J]. Computational Geometry Theory & Applications, 2014, 47(1/2/3): 741-778.
Algorithm for the uniform petal carving of Hami melon based on three-dimensional reconstruction
Zhao Mingyan1, Lin Min1, Xu Peng2※, Wang Yongjin1, Song Tianyue1, Liang Mingxuan1,Hu Jianhong1
(1.,,310018,; 2.,,310018,)
Higher carving speed and uniform petal size of Hami melon are critical for the robot carving Hami melon. It is very necessary to plan the cutting path of the execution terminal (carving knife) in real-time, according to the three-dimensional coordinates of different processing objects. In this study, a uniform petal carving of Hami melon was proposed using point cloud splicing. The image features were extracted and reconstructed sparsely. The feature parameters of melon were firstly obtained by point cloud coordinates. Secondly, CMVS/PMVS algorithm was selected for dense reconstruction using the sparse points. Finally, the octree and Poisson surface reconstruction were used to obtain the accurate 3D spatial coordinates of melon. Different shapes of Hami melon was led to different reconstructions. Each piece of flesh presented the same volume after carving. The specific procedure was as follows. Firstly, the cutting height and depth of melon were determined to extract the point cloud. An arc function was then fitted to determine the center of the circle, according to the point cloud of the outermost circle of Hami melon. The number of carving petals was divided 360° to determine the pre carving start point, end point, and path. Specifically, the initial triangle was formed to search for the two closest points from any point in the numerous point clouds as the benchmark, and then to expand the triangle outward with the three sides of the triangle as the baseline, where the equal volume of each petal was taken as the objective function, while the equal cutting depth and cutting angle of each petal as the limiting conditions. Until all the point clouds were included in the three-dimensional triangle network, the area of the projected triangle was calculated by the Helen formula, where the average value for thecoordinates of three projected points was taken as the height, and then to calculate the volume of the triangular pyramid. After depth-first and particle swarm optimization, the optimal solution was found in the coordinates of Hami melon point cloud through continuous recursive iteration. Finally, better cloud coordinates were stored as new datasets and then marked on the outside of Hami melon. As such, the manipulator was controlled to evenly carve the Hami melon. Specifically, the cutter first adjusted to the appropriate posture angle as posture point 2, then moved along the cutter ridge to a certain depth to posture point 1, and retreated to posture point 3, and finally, the cutter moved along the outer surface of Hami melon to the next adjacent posture point 2. These steps were repeated to complete the overall carving of the Hami melon. The regular and irregular models were also selected to verify the accuracy. The calculated volumes of cube, pyramid, and irregular body were compared with the real. 48 Hami melons (16 groups, 3 in each group) were divided, where the number of carved petals was 15-30, and the carving depth was 1.5, 2.0, and 2.5 cm. It was found that the precision of the group was the lowest with the number of cut petalsequal to 28. The maximum and minimum petal volumes were measured as 3.40 and 3.25 cm3, respectively, where the maximum volume difference was 0.15 cm3, and the error was less than 5%. Consequently, the melon petal carving using point cloud splicing presented a higher precision than before. The findings can provide strong technical support for robot carving Hami melon.
image processing; Particle Swarm Optimization(PSO); 3D reconstruction; uniform petal carving; point cloud splicing; triangular meshing
趙明巖,林敏,徐鵬,等. 基于三維重構(gòu)的哈蜜瓜均瓣雕花算法[J]. 農(nóng)業(yè)工程學(xué)報(bào),2021,37(19):276-283.doi:10.11975/j.issn.1002-6819.2021.19.032 http://www.tcsae.org
Zhao Mingyan, LinMin, Xu Peng, et al. Algorithm for the uniform petal carving of Hami melon based on three-dimensional reconstruction[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2021, 37(19): 276-283. (in Chinese with English abstract) doi:10.11975/j.issn.1002-6819.2021.19.032 http://www.tcsae.org
2021-05-22
2021-07-22
國(guó)家自然科學(xué)基金(51876196)和國(guó)家自然科學(xué)基金青年基金(51705494、51605462)
趙明巖,副教授,研究方向?yàn)橹悄苻r(nóng)業(yè)裝備及農(nóng)業(yè)機(jī)器人。Email:zhaomingyan@cjlu.edu.cn
徐鵬, 博士,教授,研究方向?yàn)橛?jì)算機(jī)仿真和工業(yè)傳輸過程。Email:xupeng@cjlu.edu.cn
10.11975/j.issn.1002-6819.2021.19.032
TP391.41
A
1002-6819(2021)-19-0276-08