* dev前綴的算子表示開發編譯器相關的函數
dev_update_window ('off')//halcon編輯器圖形輸出界面參數是否都更新,off表示手動,on表示全部更新
dev_close_window ()//關閉圖形窗口
dev_open_window (0, 0, 728, 512, 'black', WindowID)//打開圖形窗口
read_image (Bond, 'die/die_03')//讀圖到Bond變量
dev_display (Bond)//顯示圖像
set_display_font (WindowID, 14, 'mono', 'true', 'false')//設置顯示的字體
disp_continue_message (WindowID, 'black', 'true')//顯示繼續消息,
stop ()//等待用戶按F5繼續執行,如下圖所示
threshold (Bond, Bright, 50, 255)//閾值處理
shape_trans (Bright, Die, 'rectangle2')//形狀轉化
'convex':加凸殼。
'ellipse':和輸入區域具有相同的長短測度的橢圓。
Ellipse with the same moments and area as the input region.
'outer_circle':包含區域的最小圓形。
'inner_circle':被區域包含的最大圓。
'rectangle1':最小包含矩形,平行於坐標軸。
'rectangle2':包含區域的最小矩形。
'inner_rectangle1': 適合區域大小的和區域最大長度方向一致的內矩形。
'inner_center':抽取內部骨架點,到區域中心距離最小
reduce_domain (Bond, Die, DieGrey)//重新用Die的區域定於圖像Bond的定義域,並輸出到DieGrey
threshold (DieGrey, Wires, 0, 50)//閾值處理
fill_up_shape (Wires, WiresFilled, 'area', 1, 100)//填充具有某種形狀特征的區域,並輸出填充區域。
形狀特征包括:'area', 'compactness', 'convexity', 'anisometry', 'phi', 'ra', 'rb', 'inner_circle', 'outer_circle'
注: min表示符合填充的面積的最小值,max表示符合填充的面積的最大值。其他形狀類同
opening_circle (WiresFilled, Balls, 15.5)//找到具有圓形結構的區域,並對圓形區域開運算,即先腐蝕再膨脹
closing_circle()是先膨脹后腐蝕
select_shape (ConnectedRegions, SelectedRegions['holes_num','rect2_len1','rect2_len2'], 'and', [1,120,120], [1,200,200])//選擇符合數組內三個特征參數和分別在限定的區域內的 區域。操作符and與全部符合才算,or只要有一個就算
sort_region (IntermediateBalls, FinalBalls, 'first_point', 'true', 'column')//排序,按照第一個點的列排序
dev_set_colored (12)//顯示region 是用到的顏色數目
smallest_circle (FinalBalls, Row, Column, Radius)//計算最小外接圓的圓心坐標和半徑
difference (SingleBalls, Rect, IntermediateBalls)//差異計算,計算兩者的不同,並將不同的放在IntermediateBalls里
gen_empty_region (Forbidden)//創建一個空的區域
expand_gray (IntermediateBalls, Bond, Forbidden, RegionExpand, 4, 'image', 6)//依據灰度值或顏色填充兩個區域的間隙或分割重疊區域,
//將IntermediateBalls上大於6灰度值的像素全部畫到Bond上,像素位置不變,並輸出到RegionExpand