SaigeVision C/C++  1.4.7
SaigeVision API document for C/C++
ExampleDetErrorHandling.cpp

This is an example of how to handle Detection's error code. More details about this example.

#include <iostream>
#include <string>
// User's error code
int SRErrorReturnCode = -1;
#define CheckSRDetErrors(status, handle, testResult)\
{ \
eErrorType e = status; \
if (e != NO_ERROR_OUT) \
{ \
PrintErrorType(e); \
SR_DestroyDetTestHandle(handle); \
SR_DeleteDetTestResult(testResult); \
return SRErrorReturnCode; \
} \
}
int main()
{
std::wstring data_dir = L"../../../examples/data";
std::wstring model_path = data_dir + L"/models/lego_sample_model.srDet";
if (handle == nullptr)
{
std::cerr << "SaigeVision Detection Error: invalid file path" << std::endl;
std::cin.get();
return -1;
}
int gpu_index = -1;
CheckSRDetErrors(SR_LoadDetTestNetworkInGPU(handle, gpu_index), handle, nullptr);
std::cout << "SaigeVision successfully completed, please press enter key to terminate" << std::endl;
std::cin.get();
return 0;
}
SR_CreateDetTestHandleByWideCharPath
DetTestHandle SR_CreateDetTestHandleByWideCharPath(const wchar_t *filePath)
Create a DetTestHandle via wide char path.
DetectorTestDLL.h
Header file for Detection Module.
SR_LoadDetTestNetworkInGPU
eErrorType SR_LoadDetTestNetworkInGPU(DetTestHandle handle, int GPUNumber)
Allocate required cpu & gpu memory.
SR_DestroyDetTestHandle
eErrorType SR_DestroyDetTestHandle(DetTestHandle handle)
Destruct a DetTestHandle.
DetTestHandle
void * DetTestHandle
Detection file handler.
Definition: DetectorTestDLL.h:52