Halcon 中的形態學
Halcon中的形態學算法,以下代碼使用矩形因子,寬為1則豎直方向不受影響:
read_image (Image, 'C:/Users/Administrator/Desktop/china.png') * 二值化 binary_threshold(Image, Region, 'max_separability', 'light', UsedThreshold) * 腐蝕 erosion_rectangle1(Region, RegionErosion, 50, 1) * 膨脹 dilation_rectangle1(Region, RegionDilation, 50, 1) * 開運算,先腐蝕再膨脹,清除噪點 opening_rectangle1(Region, RegionOpening, 50, 1) * 閉運算,先膨脹再腐蝕,填充縫隙與空洞 closing_rectangle1(Region, RegionClosing, 50, 1)
原圖:

二值化結果:

腐蝕運算結果,文字橫向縮小:

膨脹運算結果,文字橫向擴大:

開運算結果,水平線得以保留:

閉運算結果,文字內部被填充:


浙公網安備 33010602011771號