Fork me on GitHub

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
posted @ 2013-02-09 18:05  韩兆新  阅读(16351)  评论(0编辑  收藏  举报