Classification of characters.
The operator ::do_ocr_multi assigns a class to every Character (character). For grayvalue features the grayvalues from the surrounding rectangles of the regions are used. The grayvalues will be taken from the parameter Image. For each character the corresponding class will be returned in Class and a confidence value will be returned in Confidence. The confidence value indicates the similarity between the input pattern and the assigned character.
|
Character (input_object) |
region(-array) -> Hobject: HRegion(Array) |
| Characters to be recognized. | |
|
Image (input_object) |
image -> Hobject: HImage |
| Grayvalues for the characters. | |
|
OcrHandle (input_control) |
ocr -> HTuple.long |
| ID of the OCR classifier. | |
|
Class (output_control) |
string(-array) -> (HTuple.) char * |
| Class (name) of the characters. | |
| Number of elements: Class == Character | |
|
Confidence (output_control) |
real(-array) -> (HTuple.) double * |
| Confidence values of the characters. | |
| Number of elements: Confidence == Character | |
char Class[128];
long orc_handle;
read_ocr("testnet",&orc_handle);
read_image(&Image,"character.tiff");
bin_threshold(Image,&Dark);
connection(Dark,&Character);
count_obj(Character,&num);
open_window(0,0,-1,-1,0,"","",&WindowHandle);
for (i=0; i<num; i++) {
select_obj(Character,&SingleCharacter,i);
do_ocr_multi(SingleCharacter,Image,orc_handle,&Class,_);
smallest_rectangle1(SingleCharacter,_,&col,&row,);
set_tposition(row,col);
write_string(WindowHandle,Class);
}
If the input parameters are set correctly, the operator ::do_ocr_multi returns the value H_MSG_TRUE. Otherwise an exception will be raised.
::traind_ocr_class_box, ::trainf_ocr_class_box, ::read_ocr, ::connection, ::sort_region
Optical character recognition