码迷,mamicode.com
首页 > 其他好文 > 详细

HALCON学习之条形码实时扫描

时间:2016-05-04 17:04:48      阅读:530      评论:0      收藏:0      [点我收藏+]

标签:

 1 dev_open_window(1,1,400,400,blue,ThisHandle)
 2 create_bar_code_model([], [], BarCodeHandle)
 3 set_bar_code_param(BarCodeHandle,element_size_max,8)
 4 set_bar_code_param(BarCodeHandle,check_char,present)
 5 set_bar_code_param(BarCodeHandle,persistence,1)
 6 set_bar_code_param(BarCodeHandle,composite_code,none)
 7 set_bar_code_param(BarCodeHandle,meas_thresh,0.1)
 8 set_bar_code_param(BarCodeHandle,num_scanlines,10)
 9 set_bar_code_param(BarCodeHandle,min_identical_scanlines,2)
10 set_bar_code_param(BarCodeHandle,max_diff_orient,10)
11 set_bar_code_param(BarCodeHandle,element_height_min,8)
12 set_bar_code_param(BarCodeHandle,stop_after_result_num,1)
13 *read_image(img,C:/Users/IBM_ADMIN/Desktop/Halcon/2.jpg)
14 *get_image_size (img, Width, Height)
15 *dev_set_window_extents (0, 0, Width-1, Height-1)
16 *find_bar_code(img,SymbolRegions,BarCodeHandle,auto,DecodedataStrings)
17 *get_bar_code_result(BarCodeHandle,all,decoded_types,DecodedDataTypes)
18 *dev_close_window()
19 * open computer camera
20 open_framegrabber (DirectShow, 1, 1, 0, 0, 0, 0, default, -1, gray, -1, default, default, 0, -1, -1, AcqHandle1)
21 * open another USB camera
22 *open_framegrabber (DirectShow, 1, 1, 0, 0, 0, 0, default, -1, gray, -1, default, default, 1, -1, -1, AcqHandle1)
23 condition := true
24 set_window_param(ThisHandle,background_color,gray)
25 *grab_image_start(AcqHandle1,-1000)
26 while(condition)    
27     *grab_image_async(BarImage,AcqHandle1, -1000)
28     grab_image (BarImage, AcqHandle1)
29     find_bar_code(BarImage,SymbolRegions,BarCodeHandle,auto,scannString)
30     if(|scannString| >= 1)
31         dev_display(BarImage)
32         disp_message(ThisHandle,scannString,window,12,12,blue,false)
33         disp_continue_message(ThisHandle,black,true)
34         stop()
35         condition := false
36     endif
37 endwhile
38 clear_all_bar_code_models()
39 close_all_framegrabbers()
40 dev_close_window()

 

HALCON学习之条形码实时扫描

标签:

原文地址:http://www.cnblogs.com/liuzebei/p/5458700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!