read_bar_code_model( : : FileName : BarCodeHandle)
函数说明:从一个文件中读取一个一维条码模型并新建一个模型
函数参数:
FileName:输入要读取的一维码模型文件,文件的后缀为.dcm
BarCodeHandle:输出一维码模型句柄
以下代码为 Code 128 类型条码,调用模型的实例:
*一维码
read_image (Image, 'D:/kaycee_yu/Desktop/halcon/20231107141225484.bmp')
gen_rectangle1 (Rectangle, 3376.81, 2042.71, 4113.43, 3368.12)
reduce_domain (Image, Rectangle, Image)
dev_display (Image)
*优化条码图像
decompose3 (Image, Image1, Image2, Image3)
scale_image (Image1, ImageScaled, 3, -300)
emphasize (ImageScaled, ImageEmphasize, 9, 9, 1)
zoom_image_factor (ImageEmphasize, ImageZoomed, 0.5, 0.5, 'constant')
dev_display (ImageZoomed)
*创建条码模型
* create_bar_code_model ([], [], BarCodeHandle)
read_bar_code_model ('Code 128.dcm', BarCodeHandle)
find_bar_code (ImageZoomed, SymbolRegions1, BarCodeHandle, ['Code 128'], BarCodeStrings)
*清除条码模型
clear_bar_code_model (BarCodeHandle)
stop ()
read_data_code_2d_model( : : FileName : DataCodeHandle)
函数说明:从一个文件中读取一个二维条码模型并新建一个模型
函数参数:
FileName:输入要读取的二维码模型文件,文件的后缀为.dcm
BarCodeHandle:输出二维码模型句柄
以下代码为Data Matrix ECC 200 类型二维码,调用模型实例:
*二维码
read_image (Image, 'D:/kaycee_yu/Desktop/halcon/20231107141225484.bmp')
gen_rectangle1 (Rectangle, 2495.6, 2649.86, 2997.91, 2968.88)
reduce_domain (Image, Rectangle, Image)
dev_display (Image)
*优化条码图像
decompose3 (Image, Image1, Image2, Image3)
scale_image (Image1, ImageScaled, 6, -300)
emphasize (ImageScaled, ImageEmphasize, 9, 9, 1)
zoom_image_factor (ImageEmphasize, ImageZoomed, 0.5, 0.5, 'constant')
dev_display (ImageZoomed)
*创建条码模型
* create_data_code_2d_model ('Data Matrix ECC 200', 'default_parameters', 'enhanced_recognition', BarCodeHandle)
read_data_code_2d_model ('Data Matrix ECC 200.dcm', DataCodeHandle)
find_data_code_2d (ImageZoomed, Contour, DataCodeHandle, 'train', 'all', ResultHandles, DecodedDataStrings)
*清除条码模型
clear_bar_code_model (BarCodeHandle)
stop ()
因篇幅问题不能全部显示,请点此查看更多更全内容