halcon学习笔记——实例篇(1)车牌识别
实例一:车牌识别
素材图片:
halcon代码:
1: read_image(Image,'D:/MyFile/halcon/车牌识别/图片.jpg')
2: decompose3(Image,ImageR,ImageG,ImageB)
3: trans_from_rgb(ImageR,ImageG,ImageB,ImageResult1, ImageResult2, ImageResult3, 'hsv')
4:
5: threshold (ImageResult3, Regions, 135, 255)
6: connection (Regions, Connection)
7: select_shape (Connection, SelectedRegions, ['area','width','height','roundness'], 'and', [127.38,11.89,24.9602,0.4808], [168.73,14.077,26.0097,0.54074])
8: connection(SelectedRegions, ConnectedRegions)
9: sort_region(ConnectedRegions,SortRegions,'upper_left','true','column')
10:
11: read_ocr_class_mlp('Industrial_0-9A-Z.omc',OCRHandle)
12: do_ocr_multi_class_mlp(SortRegions,ImageResult2,OCRHandle, Class, Confidence)
13:
14: *显示识别的结果
15: area_center(SortRegions, Area, Row, Column)
16: for Index := 0 to 5 by 1
17: disp_message(3600, Class[Index], 'window', Row[Index], Column[Index], 'black', 'true')
18: endfor
作者:韩兆新
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。