Skip to content

HOCR_SDK_runAsyncQueueBase64

Included header

#include <HOCR_SDK_COMMON.h>

Description

Asynchronous engine module execution API; request is sent as a base64 string, results are delivered via a queue returned by this function

HOCR_SDK_runAsyncQueueBase64()

void* HOCR_SDK_runAsyncQueueBase64(void* obj, char* openApiName, char* requestId, int imgWidth, int imgHeight, int colorSpace, char* imgData, char* requestOptionJsonStr)
Parameters
NameTypeDescription
objvoid*

Pointer to 'ArgoEngineApi' object

openApiNamechar*

Name of the engine module to use

requestIdchar*

Request ID (value to identify the request)

imgWidthint

Image width

imgHeightint

Image height

colorSpaceint

Image color type

Note: RGB 0, RGBA 1, BGR 2, BGRA 3, YUV 4, GRAY 5

imgDatachar*

Image pixel data

Note: String data containing the base64 encoding of the raw pixel data already decoded by an image processing library, etc.

requestOptionJsonStrchar*

JSON string to set options of the engine module obtained via HOCR_SDK_getOpenApiOption

Return value

void *: Queue object to receive the execution result

Pass this object to HOCR_SDK_waitResult to wait for results

After use, you must release the queue object by calling HOCR_SDK_releaseQueue

Examples

  • Using the OpenCV library
std::string openApiName = "TEXT_RECOGNITION";
std::string requestId = "random-string";
int width = 1024;
int height = 768;
char *base64 = "...";
std::string requestOptionJsonStr = "{}";

void * resultQueue = HOCR_SDK_runAsyncQueue(
obj,
openApiName.data(),
requestId.data(),
width,
height,
2, /* RGB 0, RGBA 1, BGR 2, BGRA 3, YUV 4, GRAY 5 */
base64,
requestOptionJsonStr.data()
);

char *resultJsonStr = nullptr;
int resultSize = HOCR_SDK_waitResult(resultQueue, &resultJsonStr);
std::string resultJson(resultJsonStr, resultSize);

bool isSuccess = HOCR_SDK_releaseQueue(resultQueue);