原图
要读取该图像中的环形条形码
read_image (Image, 'circular_barcode')
* 中值滤波
mean_image (Image, ImageMean, 211, 211)
* 动态阈值分割
dyn_threshold (Image, ImageMean, RegionDynThresh, 15, 'dark')
* 连通性
connection (RegionDynThresh, ConnectedRegions)
* 筛选
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 95000, 96000)
* 获取最外圈的轮廓
gen_contour_region_xld (SelectedRegions, Contours, 'border')
* 拟合圆
fit_circle_contour_xld (Contours, 'algebraic', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
* 生成两个圆形,获取中间区域
gen_circle (Circle, Row, Column, Radius)
gen_circle (Circle1, Row, Column, Radius - 30)
difference (Circle, Circle1, RegionDifference)
* 极坐标展开
polar_trans_image_ext (Image, PolarTransImage, Row, Column, 1.570797, 7.853985, Radius-50, Radius, 1024, 30, 'nearest_neighbor')
* 绕中旋转180度
rotate_image (PolarTransImage, ImageRotate, 180, 'constant')
* 将输入的极坐标变换后的图像进行反转(即颜色取反)
invert_image (PolarTransImage, ImageInvert)
* 对输入的反转后的图像进行缩放操作
zoom_image_factor (ImageInvert, ImageZoomed, 1, 2, 'weighted')
* 创建条码读取器的模板
create_bar_code_model ([], [], BarCodeHandle)
* 配置解码方式
set_bar_code_param (BarCodeHandle, 'element_size_min', 1)
* 读取条码
find_bar_code (ImageZoomed, SymbolRegions, BarCodeHandle, 'auto', DecodedDataStrings)
dev_display (Image)
disp_message (200000, DecodedDataStrings, 'window', 20, 20, 'red', 'false')
结果