一个喷码识别的案例
read_image (Image, 'D:/用户目录/Desktop/2.png')
rgb1_to_gray(Image, Image)
get_image_size (Image, Width, Height)
* 获取喷码区域的方法很多 比如可以用mean+dyn的动态阈值
dots_image (Image, DotImage, 5, 'dark', 2)
threshold (DotImage, Region, 30, 255)
*这里是形态学运算操作 目的就是要将单体字符连在一起
*这里面用到的自定义核大家可以学习一下
closing_rectangle1 (Region, RegionClosing1, 1, 7)
closing_rectangle1 (RegionClosing1, RegionClosing2, 7, 1)
gen_rectangle2 (Rectangle, 10, 10, rad(45), 3, 0)
closing (RegionClosing2, Rectangle, RegionClosing3)
gen_rectangle2 (Rectangle, 10, 10, rad(135), 3, 0)
closing (RegionClosing3, Rectangle, RegionClosing4)
connection (RegionClosing4, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ['area','height'], 'and', [100,50], [1000,70])