Matches text from an ImageGear recognition document that has already undergone OCR recognition.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_REC_approx_regex_search_rec_document( const HIG_REC_APPROX_REGEX higRecApproxRegex, const HIG_REC_DOCUMENT higRecDocument, const AT_REC_MATCH_RESULT **const match_result_array, AT_INT *const match_result_size ); |
Arguments:
higRecApproxRegex | The handle to an approximate regex instance. |
higRecDocument | A recognition document. |
match_result_array | A pointer to a vector of match result instances. The approximate regex owns this data. Callers that require access to this data after the approximate regex is deleted must duplicate this data and assume ownership of the copy. |
match_result_size | The number of match results in match_result_array. |
Return Value:
The number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.Supported Raster Image Formats:
This function does not process image pixels.
Supported Raster Image Formats:
See IG_REC_image_import.
Remarks:
Text is scanned for pattern matches.
Supports matching Asian language text. |
The following installed callbacks are invoked during execution of this function:
- Match Callback. Invoked after a pattern match is detected. Matched text may be either accepted or rejected. Only accepted matches will be redacted from the source document. If a Match Callback is not installed, then all matches are accepted.
- Progress Callback. Invoked periodically to abort a lengthy search operation. If the search is stopped, then only those matches already found will be returned in match_result_array.
Example:
Copy Code | |
---|---|
const AT_INT after_last = -1 ; AT_ERRCOUNT errCount = 0 ; HMIGEAR higDocument = 0 ; UINT page_count = 0 ; HIG_REC_DOCUMENT higRecDocument = 0 ; LPAT_WCHAR patterns [] = { L".+" } ; const AT_REC_MATCH_RESULT* match_result_array = 0 ; AT_INT match_result_size = 0 ; AT_INT i = 0 ; HIG_REC_APPROX_REGEX higApproxRegex = 0 ; IG_mpi_create( &higDocument, 0 ); IG_mpi_file_open( "multi.tif", higDocument , IG_FORMAT_UNKNOWN , IG_MP_OPENMODE_READONLY ); IG_mpi_page_count_get( higDocument , &page_count ) ; IG_mpf_page_load( higDocument , 0 , page_count ) ; IG_REC_document_create( NULL , &higRecDocument ) ; for ( i = 0 ; i < ( AT_INT )page_count ; i++ ) { HIGEAR higPage = 0 ; HIG_REC_IMAGE higRecPage = 0 ; IG_mpi_page_get( higDocument , i , &higPage ) ; IG_REC_image_import( higPage , &higRecPage ) ; IG_REC_image_preprocess( higRecPage ) ; IG_REC_image_recognize( higRecPage ) ; IG_REC_document_page_insert( higRecDocument , higRecPage , after_last ) ; } IG_mpi_delete( higDocument ) ; IG_REC_approx_regex_create( &higApproxRegex ) ; IG_REC_approx_regex_pattern_set( higApproxRegex , patterns , 1 ) ; errCount = IG_REC_approx_regex_search_rec_document ( higApproxRegex, higRecDocument, &match_result_array, &match_result_size ) ; IG_REC_approx_regex_delete( higApproxRegex ) ; IG_REC_document_close( higRecDocument ) ; |