当前位置:首页 >> 计算机软件及应用 >>

ocr训练与读取HACION


dev_close_window ()
count_seconds (Start)
read_image (Image, 'C:/Users/Administrator/Desktop/121203/xiao130_3.bmp')
dev_open_window (0, 0, 512, 400, 'black', WindowHandle)
dev_set_draw ('margin')
dev_set_line_width (3)
dev_display (Image)
threshold (Image, Region, 84, 255)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 300, 1000)
median_image (Image, ImageMedian, 'square', 1, 'continued')
mean_image (ImageMedian, ImageMean,25, 30)
dyn_threshold (Image, ImageMean, RegionDynThresh, 190, 'light')
threshold (ImageMean, Region1, 65, 255)
connection (Region1, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions1, 'area', 'and', 150, 99999)
select_shape (SelectedRegions1, Chars, ['height','width'], 'and', [20,20], [180,180])
sort_region (Chars, SortedChars, 'character', 'true', 'row')
count_obj (SortedChars, Number)
Classes := ['3','0','1','1']
write_ocr_trainf (SortedChars, Image, Classes, 'D:/dc.trf')
read_ocr_trainf_names ('dc.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, 20, \
'none', 81, 42, OCRHandle)
trainf_ocr_class_mlp (OCRHandle, 'dc.trf', 100, 0.01, 0.01, Error, \
ErrorLog)
do_ocr_multi_class_mlp (SortedChars, Image, OCRHandle, Class, Confidence)
shape_trans (SortedChars, CharsArea, 'rectangle1')
dilation_rectangle1 (CharsArea, CharsAreaBig, 5, 5)
gen_rectangle2 (Rectangle, 0, 0, rad(60), 2, 1)
area_center (Rectangle, Area, Row, Column)
Str := ''
for i := 0 to |Class| - 1 by 1
Str := Str + Class
endfor
dev_display (Image)
dev_set_colored (12)
dev_set_draw ('margin')
dev_display (Chars)
count_seconds (End)
time := End - Start
disp_message (WindowHandle, 'Number is: ' + Str + ' ' + 'Time is:' + time + 'ms', 'window', 5, 10, 'black', 'true')

相关文章:
更多相关标签: