例程程序解读
1
光学字符识别
/bottle.hdev
*******
(
1
)首先,分割图像,获得每个数字区域
dev_update_window ('off')
****
读取图像
read_image (Bottle, 'bottle2')
****
获得图像大小
get_image_size (Bottle, Width, Height)
dev_close_window ()
****
打开窗口,
2
倍
dev_open_window (0, 0, 2 * Width, 2 * Height, 'black', WindowID)
set_display_font (WindowID, 20, 'mono', 'true', 'false')
dev_display (Bottle)
****
全局阈值处理,获得区域
threshold (Bottle, RawSegmentation, 0, 95)
****
根据形状特征填充空洞
fill_up_shape (RawSegmentation, RemovedNoise, 'area', 1, 5)
****
利用圆形结构元素,执行开运算。作用:消除小区域,光滑边界
opening_circle (RemovedNoise, ThickStructures, 2.5)