<Halcon>分割粘连区域(分水岭算法)
生活随笔
收集整理的這篇文章主要介紹了
<Halcon>分割粘连区域(分水岭算法)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
read_image (Image, 'F:/培訓/Halcon培訓/2.jpg')
rgb1_to_gray (Image, GrayImage)*平滑圖片去噪
mean_image (GrayImage, ImageMean, 3, 3)
get_image_size (ImageMean, Width, Height)*截取中心ROI區域
gen_circle (ROI_0, 480, 490, 450)
reduce_domain (ImageMean, ROI_0, ImageReduced)threshold (ImageReduced, Regions, 96, 234)
connection (Regions, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 200, 99999)*計算輸入區域(或其補碼)的每個點到區域邊界的距離
*參數Foreground決定是為區域內的所有點計算距離(Foreground= 'true')
*區域外的所有點計算距離(Foreground= 'false')
distance_transform (SelectedRegions, DistanceImage, 'euclidean', 'true', Width, Height)
invert_image (DistanceImage, ImageInvert)*圖像比例增強 按最大比例增強對比度
scale_image_max (ImageInvert, ImageScaleMax)*分水嶺算法
watersheds_threshold (ImageScaleMax, Basins, 15)
gen_contour_region_xld (Basins, Contours, 'border')*取出兩個區域中重疊的部分
intersection (Basins, SelectedRegions, RegionIntersection)
總結
以上是生活随笔為你收集整理的<Halcon>分割粘连区域(分水岭算法)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 详解JavaScript(ECMAScr
- 下一篇: 【C++】初级面试整理