Tag Archives: HALCON

HALCON error #2036: could not find license file in operator set_ Part solution

HALCON error #2036: could not find license file in operator set_part
operator set_part
copy the license folder into the root directory of exe, then you can run the program normally



2019-03-04
change the license_xxx.dat to license.dat and put it in the root directory of the running program to solve the license_xxx.dat. Please note that the license_xxx.dat must be valid and have no expired certificates

Simple license plate recognition based on Halcon

simple license plate recognition

Graph

  • code
  • results
    • positioning location results
    • recognition results

    original

    code

    dev_close_window ()
    *车牌定位及倾斜旋转
    read_image (Car, 'E:/Halcon_Learn/car.jpg')
    get_image_size (Car, Width, Height)
    dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
    dev_set_color ('green')
    dev_set_line_width (3)
    decompose3 (Car, Image1, Image2, Image3)
    threshold (Image1, Regions, 0, 31)
    connection (Regions, ConnectedRegions)
    select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 4636.72, 5508.59)
    dilation_circle (SelectedRegions, RegionDilation, 3.5)
    erosion_circle (RegionDilation, RegionErosion, 3.5)
    fill_up (RegionErosion, RegionFillUp)
    orientation_region (RegionFillUp, Phi)
    area_center (RegionFillUp, Area, Row, Column)
    vector_angle_to_rigid (Row, Column, Phi, Row, Column, rad(180), HomMat2D)
    affine_trans_image (Car, ImageAffineTrans, HomMat2D, 'constant', 'false')
    affine_trans_region (RegionFillUp, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
    reduce_domain (ImageAffineTrans, RegionAffineTrans, ImageReduced)
    *显示定位车牌
    dev_display (ImageAffineTrans)
    overpaint_region (ImageAffineTrans, RegionAffineTrans, [0,255,0], 'margin')
    dump_window_image (Image_define, WindowHandle)
    write_image (Image_define, 'jpg', 0, 'E:/Halcon_Learn/car_define')
    stop ()
    *字符分割
    rgb1_to_gray (ImageReduced, GrayImage)
    invert_image (GrayImage, ImageInvert)
    threshold (GrayImage, Regions1, 61, 126)
    connection (Regions1, ConnectedRegions1)
    select_shape (ConnectedRegions1, SelectedRegions1, ['area','height'], 'and', [219,31.607], [321.78,40.742])
    sort_region (SelectedRegions1, SortedRegions, 'character', 'true', 'row')
    
    *字符识别
    read_ocr_class_mlp ('Industrial_0-9A-Z_NoRej.omc', OCRHandle)
    do_ocr_multi_class_mlp (SortedRegions, ImageInvert, OCRHandle, Class, Confidence)
    
    *显示
    smallest_rectangle1 (SortedRegions, Row1, Column1, Row2, Column2)
    count_obj (SortedRegions, Number)
    dev_display (Car)
    for i := 1 to Number by 1
       * disp_message (WindowHandle, Class[i-1], 'window', Row2[i-1], Column1[i-1], 'red', 'false')
         set_tposition (WindowHandle, Row2[i-1], Column1[i-1])
         write_string (WindowHandle, Class[i-1])
    endfor
    
    dump_window_image (Image, WindowHandle)
    write_image (Image, 'jpg', 0,'E:/Halcon_Learn/car_result')
    

    Results the

    positioning result

    recognition result