ImageGear for C and C++ on Windows v19.6 - Updated
Monitor Progress
User Guide > How to Work with... > OCR > How to... > Assess and Analyze OCR Output > Monitor Progress

Typically, the most time-consuming processes invoked by the Recognition component are the recognition processes (IG_REC_PID_RECOGNITION1, IG_REC_PID_RECOGNITION2, and IG_REC_PID_RECOGNITION3) and the final output document generation (IG_REC_PID_WRITEFOUTDOC). In some particular cases, other processes like image loading (IG_REC_PID_IMGINPUT) or image preprocessing (IG_REC_PID_IMGPREPROCESS) might also take considerable time.

Sometimes it is advisable to provide the application user with feedback about these processes. The application can register a callback procedure for progress monitoring with the IG_REC_progress_CB_register() function. The Recognition component will invoke the registered callback procedure during processing with a pointer to a AT_REC_PROGRESS_MONITOR structure containing information about the current process. The application can provide progress indication with this procedure. If the callback function returns a value other than IG_REC_EXT_OK, it signals an interruption of the current process. This can be used to provide the application user with a cancel button.

The ProcessId field of the AT_REC_PROGRESS_MONITOR structure identifies the current process (e.g., IG_REC_PID_DECOMPOSITION, IG_REC_PID_WRITEFOUTDOC, etc.) The Percent member provides the progress information for the ProcessId process.

Sample Callback Function for Progress Monitoring

C
Copy Code
static char aTmp[256];
enumIGRecError __stdcall ProgressMon(LPAT_REC_PROGRESS_MONITOR lpProgressMonitor, LPVOID lpContext)
{
    int id = (int)lpProgressMonitor->ProcessId;
    char *strProcNames[] = {"IMAGEINPUT", "IMGPREPROCESS", "DECOMPOSITION", "RECOGNITION1",
        "RECOGNITION2", "RECOGNITION3", "SPELLING", "FORMATTING", "WRITEFOUTDOC", "CONVERTIMG"};
    sprintf(aTmp, "Process: %s %d%%", strProcNames[id], lpProgressMonitor->Percent);
    return IGE_REC_EXT_OK;
}
VOID Using_ProgressMonitor()
{
    AT_ERRCOUNT nErrCount;
    // register callback function
    nErrCount = IG_REC_progress_CB_register(ProgressMon, NULL);
}