电路宽度测量halcon例子
生活随笔
收集整理的這篇文章主要介紹了
电路宽度测量halcon例子
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一個halcon處理的例子
目錄
- 處理要求:
- 原圖:
- 處理程序:
- 處理結果:
處理要求:
根據客戶給的寬度,計算出電路寬度太窄的為NG
原圖:
處理程序:
read_image (Image, '1.png') rgb1_to_gray(Image, GrayImage) threshold(GrayImage, Region, 130, 255) connection (Region, ConnectedRegions) select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 10000, 99999) opening_circle(SelectedRegions, RegionOpening, 2.5) get_image_size (GrayImage, Width, Height) distance_transform (RegionOpening, DistanceImage, 'city-block', 'true', Width, Height) threshold (DistanceImage, Regions, 6, 127) fill_up(Regions, RegionFillUp) erosion_circle (RegionFillUp, RegionErosion, 2.5) skeleton (RegionErosion, Skeleton) junctions_skeleton (Skeleton, EndPoints, JuncPoints) dilation_circle (EndPoints, RegionDilation, 10.5) dilation_circle (JuncPoints, RegionDilation1, 5.5) difference (Skeleton, RegionDilation, RegionDifference) difference (RegionDifference, RegionDilation1, RegionDifference1) gen_contours_skeleton_xld (RegionDifference1, Contours, 1, 'filter') union_adjacent_contours_xld (Contours, UnionContours, 50, 5, 'attr_keep') smooth_contours_xld (UnionContours, SmoothedContours, 23) select_shape_xld(SmoothedContours, SelectedXLD, 'contlength', 'and', 500, 99999) dev_display (GrayImage) dev_display (SelectedXLD)處理結果:
總結
以上是生活随笔為你收集整理的电路宽度测量halcon例子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Windows 环境下运用Python制
- 下一篇: Misc混合halcon算子,持续更新