This is an example of how to handle OCR's error code. More details about this example.
#include <iostream>
#include <string>
int SRErrorReturnCode = -1;
#define CheckSROCRErrors(status, handle, testResult)\
{ \
eErrorType e = status; \
if (e != NO_ERROR_OUT) \
{ \
PrintErrorType(e); \
SR_DestroyOCRTestHandle(handle); \
SR_DeleteOCRTestResult(testResult); \
return SRErrorReturnCode; \
} \
}
int main()
{
std::wstring data_dir = L"../../../examples/data";
std::wstring boxModelPath = data_dir + L"/models/ocr.srOcrBox";
std::wstring textModelPath = data_dir + L"/models/ocr.srOcrText";
if (handle == nullptr)
{
std::cerr << "SaigeVision Segmentation Error: invalid file path" << std::endl;
std::cin.get();
return -1;
}
int gpu_index = -1;
std::cout << "SaigeVision successfully completed, please press enter key to terminate" << std::endl;
std::cin.get();
return 0;
}