How to get intermediate results

Besides getting the results like barcode format, value, location, Dynamsoft Barcode Reader also provides APIs for you to get the intermediate results like original image, transformed grayscale image, binarized image, text zone, etc. for further analysis.

To learn more about what intermediate results you can get, see enum IntermediateResultType.

Here we take the original image as example and show how to get the original image and save it to your file system.

    int iRet = -1;
    hBarcode = DBR_CreateInstance();
    DBR_InitLicense(hBarcode, "t0068MgAAAGotN***"); // Set the trial license

    DBR_GetRuntimeSettings(hBarcode,&runtimeSettings);
    runtimeSettings.intermediateResultTypes = IRT_ORIGINAL_IMAGE; 
    // Here we save it to the file system. You can also save it to memory according to your needs.
    runtimeSettings.intermediateResultSavingMode = IRSM_FILESYSTEM;
    iRet = DBR_UpdateRuntimeSettings(hBarcode,&runtimeSettings,szErrorMsg,256);
    // Set the folder path which stores the intermediate result (original image). Please make sure you have write permission to this folder.
    iRet = DBR_SetModeArgument(hBarcode, "IntermediateResultSavingMode", 0, "FolderPath", "D:\DBRLogs", szErrorMsg, 256); 
    if (iRet != DBR_OK) // If error occurs
    {
        printf("Error code: %d. Error message: %s\n", iRet, szErrorMsg);
        return -1;
    }
    DBR_DecodeFile(hBarcode, "<Your Image Path here>","");
    IntermediateResultArray* pResults;
    DBR_GetIntermediateResults(hBarcode, &pResults);

    DBR_DestroyInstance(hBarcode);

results matching ""

    No results matching ""