- ??博客主頁(yè):https://loewen.blog.csdn.net
- ??歡迎點(diǎn)贊 ?? 收藏 ?留言 ?? 如有錯(cuò)誤敬請(qǐng)指正!
- ??本文由 丶布布原創(chuàng),首發(fā)于 CSDN,轉(zhuǎn)載注明出處??
- ??現(xiàn)在的付出,都會(huì)是一種沉淀,只為讓你成為更好的人?
一. 3D無序抓取原理
通過3D
成像系統(tǒng)(激光三角、結(jié)構(gòu)光+單/雙目等),對(duì)物體表面輪廓進(jìn)行掃描,形成點(diǎn)云數(shù)據(jù)。選擇其中一個(gè)物體的點(diǎn)云數(shù)據(jù)作為模板,去對(duì)其他物體的點(diǎn)云數(shù)據(jù)進(jìn)行「三維點(diǎn)云匹配」,獲取各個(gè)物體的姿態(tài)信息(x、y、z、Rx、Ry、Rz
+1個(gè)旋轉(zhuǎn)類型)。
根據(jù)物體所在的世界坐標(biāo)系和機(jī)械手坐標(biāo)系之間的「3D手眼標(biāo)定」關(guān)系,將各個(gè)「物體坐標(biāo)系下的姿態(tài)轉(zhuǎn)換成機(jī)械手坐標(biāo)系下的姿態(tài)」,從未完成機(jī)械手對(duì)物體的抓取。當(dāng)然,抓取時(shí)還需要考慮避障、路徑規(guī)劃等。
針對(duì)上面無序抓取涉及到的三個(gè)核心點(diǎn),本文主要講解Halcon
三維點(diǎn)云匹配:
⑴基于表面的三維點(diǎn)云匹配:參考案例 — `分類 — 方法 — 三維匹配(基于表面)`
⑵基于形狀的三維點(diǎn)云匹配:參考案例 — `分類 — 方法 — 三維匹配(基于形狀)`
二. 點(diǎn)云匹配核心算子
1、create_surface_model ( : : ObjectModel3D, RelSamplingDistance, GenParamName, GenParamValue : SurfaceModelID) — 創(chuàng)建3D點(diǎn)云模型
參數(shù):
ObjectModel3D(in):要讀取的文件的文件名。
RelSamplingDistance(in):代表采樣距離在點(diǎn)云最小外界球體直徑的比例。
GenParamName(in):參數(shù)名稱。
GenParamValue (in):參數(shù)名稱對(duì)應(yīng)的值。
SurfaceModelID(out) :3D點(diǎn)云模板的句柄。
重點(diǎn)解釋一下第二個(gè)參數(shù)RelSamplingDistance
:
曲面模型是通過以一定距離對(duì)三維對(duì)象點(diǎn)云模型進(jìn)行采樣來創(chuàng)建的,采樣距離即為點(diǎn)云模型最小外界球體的直徑D
與比例參數(shù)RelSamplingDistance
乘積,即D*RelSamplingDistance
。
例如,如果RelSamplingDistance
設(shè)置為0.05
,而ObjectModel3D
的直徑為“10 cm
”,則從對(duì)象曲面采樣的點(diǎn)之間的距離將約為“5 mm
”。
參數(shù)RelSamplingDistance
越小,則創(chuàng)建點(diǎn)云模板所參與的坐標(biāo)點(diǎn)越多,匹配精度提高但匹配速度會(huì)下降,反之亦然。采樣點(diǎn)用于運(yùn)算符find_surface_model
中的近似匹配,可以使用值“sampled_model”
使用操作符get_surface_model_param
獲得采樣點(diǎn)。通過參數(shù)選取采樣點(diǎn)的時(shí)候,應(yīng)避免對(duì)象模型中的異常點(diǎn),因?yàn)樗鼈儠?huì)破壞直徑。
三. 點(diǎn)云匹配具體流程
3.1、讀取硬幣點(diǎn)云模型數(shù)據(jù)
如圖所示:
read_object_model_3d ('C:/Users/Administrator/Desktop/2020-01-22-71816.om3', 'mm', [], [], ObjectModel3D, Status)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], ['lut','color_attrib'], ['color1','coord_z'], [], [], [], PoseOut)
3.2、創(chuàng)建硬幣點(diǎn)云模板
如圖所示:
* 提取出硬幣的點(diǎn)云數(shù)據(jù)(類似二維的Blob分析)
get_object_model_3d_params (ObjectModel3D, 'point_coord_z', GenParamValue)
select_points_object_model_3d (ObjectModel3D, 'point_coord_z', 12, 14, ObjectModel3DThresholded)
connection_object_model_3d (ObjectModel3DThresholded, 'distance_3d', 1.5, ObjectModel3DConnected)
select_object_model_3d (ObjectModel3DConnected, 'num_points', 'and', 30000, 45000, ObjectModel3DSelected)
* 對(duì)硬幣的點(diǎn)云數(shù)據(jù)進(jìn)行三角曲面重建
triangulate_object_model_3d (ObjectModel3DSelected, 'greedy', [],[], TriangulatedObjectModel3D, Information)
visualize_object_model_3d (WindowHandle, TriangulatedObjectModel3D, [], [], ['lut','color_attrib'], ['color1','coord_z'], [], [], [], PoseOut)
* 創(chuàng)建硬幣點(diǎn)云數(shù)據(jù)模板,SFM句柄
create_surface_model (TriangulatedObjectModel3D, 0.03, [], [], SFM)
3.3、對(duì)硬幣點(diǎn)云數(shù)據(jù)進(jìn)行三維匹配并顯示
如圖所示:文章來源:http://www.zghlxwxcb.cn/news/detail-719051.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-719051.html
* 對(duì)整個(gè)場(chǎng)景三角曲面重建(因?yàn)槭菍?duì)經(jīng)過三角曲面重建的硬幣點(diǎn)云數(shù)據(jù)創(chuàng)建的模板)
triangulate_object_model_3d (ObjectModel3D, 'greedy', [],[], TriangulatedObjectModel3D1, Information)
* 三維點(diǎn)云匹配,獲取當(dāng)前匹配對(duì)象的Pose
find_surface_model (SFM, TriangulatedObjectModel3D1, 0.03, 0.5, 0.9, 'true', 'num_matches', 6, Pose, Score, SurfaceMatchingResultID)
* 獲取場(chǎng)景信息和關(guān)鍵點(diǎn)
get_surface_matching_result (SurfaceMatchingResultID, 'sampled_scene', [], SampledScene)
get_surface_matching_result (SurfaceMatchingResultID, 'key_points', [], KeyPoints)
visualize_object_model_3d (WindowHandle, [ObjectModel3D,SampledScene,KeyPoints], [], [], ['color_' + [0,1,2],'point_size_' + [0,1,2]], ['gray','cyan','yellow',1.0,3.0,5.0], [], [], [], PoseOut)
ObjectModel3DResult:=[]
* 有可能會(huì)匹配到多個(gè)點(diǎn)云數(shù)據(jù),所以遍歷依次顯示(本文只有一個(gè))
for Index2 := 0 to |Score| - 1 by 1
if (Score[Index2] < 0.11)
continue
endif
CPose := Pose[Index2 * 7:Index2 * 7 + 6]
* 當(dāng)前被找到物體的點(diǎn)云數(shù)據(jù) = 原始點(diǎn)云模板 * 匹配得到的當(dāng)前物體姿態(tài)
rigid_trans_object_model_3d (TriangulatedObjectModel3D, CPose, ObjectModel3DRigidTrans)
ObjectModel3DResult := [ObjectModel3DResult,ObjectModel3DRigidTrans]
endfor
visualize_object_model_3d (WindowHandle, [ObjectModel3D,ObjectModel3DResult], [], [], ['color_' + [0,1],'point_size_0'], ['gray','red',1.0], [], [], [], PoseOut)
下雨天,最愜意的事莫過于躺在床上靜靜聽雨,雨中入眠,連夢(mèng)里也長(zhǎng)出青苔。 |
到了這里,關(guān)于[3D&Halcon] 三維點(diǎn)云匹配&無序抓取的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!