首页 > 代码库 > Halcon学习之条形码实时扫描
Halcon学习之条形码实时扫描
dev_open_window(1,1,400,400,‘blue‘,ThisHandle)create_bar_code_model([], [], BarCodeHandle)set_bar_code_param(BarCodeHandle,‘element_size_max‘,8)set_bar_code_param(BarCodeHandle,‘check_char‘,‘present‘)set_bar_code_param(BarCodeHandle,‘persistence‘,1)set_bar_code_param(BarCodeHandle,‘composite_code‘,‘none‘)set_bar_code_param(BarCodeHandle,‘meas_thresh‘,0.1)set_bar_code_param(BarCodeHandle,‘num_scanlines‘,10)set_bar_code_param(BarCodeHandle,‘min_identical_scanlines‘,2)set_bar_code_param(BarCodeHandle,‘max_diff_orient‘,10)set_bar_code_param(BarCodeHandle,‘element_height_min‘,8)set_bar_code_param(BarCodeHandle,‘stop_after_result_num‘,1)*read_image(img,‘C:/Users/IBM_ADMIN/Desktop/Halcon/2.jpg‘)*get_image_size (img, Width, Height)*dev_set_window_extents (0, 0, Width-1, Height-1)*find_bar_code(img,SymbolRegions,BarCodeHandle,‘auto‘,DecodedataStrings)*get_bar_code_result(BarCodeHandle,‘all‘,‘decoded_types‘,DecodedDataTypes)*dev_close_window()* open computer cameraopen_framegrabber (‘DirectShow‘, 1, 1, 0, 0, 0, 0, ‘default‘, -1, ‘gray‘, -1, ‘default‘, ‘default‘, ‘0‘, -1, -1, AcqHandle1)* open another USB camera*open_framegrabber (‘DirectShow‘, 1, 1, 0, 0, 0, 0, ‘default‘, -1, ‘gray‘, -1, ‘default‘, ‘default‘, ‘1‘, -1, -1, AcqHandle1)condition := trueset_window_param(ThisHandle,‘background_color‘,‘gray‘)*grab_image_start(AcqHandle1,-1000)while(condition) *grab_image_async(BarImage,AcqHandle1, -1000) grab_image (BarImage, AcqHandle1) find_bar_code(BarImage,SymbolRegions,BarCodeHandle,‘auto‘,scannString) if(|scannString| >= 1) dev_display(BarImage) disp_message(ThisHandle,scannString,‘window‘,12,12,‘blue‘,‘false‘) disp_continue_message(ThisHandle,‘black‘,‘true‘) stop() condition := false endifendwhileclear_all_bar_code_models()close_all_framegrabbers()dev_close_window()
Halcon学习之条形码实时扫描
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。