text_recognizer.h¶
-
struct mmdeploy_text_recognition_t¶
-
typedef struct mmdeploy_text_recognizer *mmdeploy_text_recognizer_t¶
-
int mmdeploy_text_recognizer_create(mmdeploy_model_t model, const char *device_name, int device_id, mmdeploy_text_recognizer_t *recognizer)¶
Create a text recognizer instance.
- Parameters
model – [in] an instance of mmocr text recognition model created by mmdeploy_model_create_by_path or mmdeploy_model_create in model.h
device_name – [in] name of device, such as “cpu”, “cuda”, etc.
device_id – [in] id of device.
recognizer – [out] handle of the created text recognizer, which must be destroyed by mmdeploy_text_recognizer_destroy
- Returns
status code of the operation
-
int mmdeploy_text_recognizer_create_by_path(const char *model_path, const char *device_name, int device_id, mmdeploy_text_recognizer_t *recognizer)¶
Create a text recognizer instance.
- Parameters
model_path – [in] path to text recognition model
device_name – [in] name of device, such as “cpu”, “cuda”, etc.
device_id – [in] id of device.
recognizer – [out] handle of the created text recognizer, which must be destroyed by mmdeploy_text_recognizer_destroy
- Returns
status code of the operation
-
int mmdeploy_text_recognizer_apply(mmdeploy_text_recognizer_t recognizer, const mmdeploy_mat_t *images, int count, mmdeploy_text_recognition_t **results)¶
Apply text recognizer to a batch of text images.
- Parameters
recognizer – [in] text recognizer’s handle created by mmdeploy_text_recognizer_create_by_path
images – [in] a batch of text images
count – [in] number of images in the batch
results – [out] a linear buffer contains the recognized text, must be release by mmdeploy_text_recognizer_release_result
- Returns
status code of the operation
-
int mmdeploy_text_recognizer_apply_bbox(mmdeploy_text_recognizer_t recognizer, const mmdeploy_mat_t *images, int image_count, const mmdeploy_text_detection_t *bboxes, const int *bbox_count, mmdeploy_text_recognition_t **results)¶
Apply text recognizer to a batch of images supplied with text bboxes.
- Parameters
recognizer – [in] text recognizer’s handle created by mmdeploy_text_recognizer_create_by_path
images – [in] a batch of text images
image_count – [in] number of images in the batch
bboxes – [in] bounding boxes detected by text detector
bbox_count – [in] number of bboxes of each
images
, must be same length asimages
results – [out] a linear buffer contains the recognized text, which has the same length as
bboxes
, must be release by mmdeploy_text_recognizer_release_result
- Returns
status code of the operation
-
void mmdeploy_text_recognizer_release_result(mmdeploy_text_recognition_t *results, int count)¶
Release result buffer returned by mmdeploy_text_recognizer_apply or mmdeploy_text_recognizer_apply_bbox.
- Parameters
results – [in] result buffer by text recognizer
count – [in] length of
result
-
void mmdeploy_text_recognizer_destroy(mmdeploy_text_recognizer_t recognizer)¶
destroy text recognizer
- Parameters
recognizer – [in] handle of text recognizer created by mmdeploy_text_recognizer_create_by_path or mmdeploy_text_recognizer_create
-
int mmdeploy_text_recognizer_create_v2(mmdeploy_model_t model, mmdeploy_context_t context, mmdeploy_text_recognizer_t *recognizer)¶
Same as mmdeploy_text_recognizer_create, but allows to control execution context of tasks via context.
-
int mmdeploy_text_recognizer_create_input(const mmdeploy_mat_t *images, int image_count, const mmdeploy_text_detection_t *bboxes, const int *bbox_count, mmdeploy_value_t *output)¶
Pack text-recognizer inputs into mmdeploy_value_t.
- Parameters
images – [in] a batch of images
image_count – [in] number of images in the batch
bboxes – [in] bounding boxes detected by text detector
bbox_count – [in] number of bboxes of each
images
, must be same length asimages
- Returns
value created
-
int mmdeploy_text_recognizer_apply_v2(mmdeploy_text_recognizer_t recognizer, mmdeploy_value_t input, mmdeploy_value_t *output)¶
-
int mmdeploy_text_recognizer_apply_async(mmdeploy_text_recognizer_t recognizer, mmdeploy_sender_t input, mmdeploy_sender_t *output)¶
Same as mmdeploy_text_recognizer_apply_bbox, but input and output are packed in mmdeploy_value_t.
-
int mmdeploy_text_recognizer_apply_async_v3(mmdeploy_text_recognizer_t recognizer, const mmdeploy_mat_t *imgs, int img_count, const mmdeploy_text_detection_t *bboxes, const int *bbox_count, mmdeploy_sender_t *output)¶
-
int mmdeploy_text_recognizer_continue_async(mmdeploy_sender_t input, mmdeploy_text_recognizer_continue_t cont, void *context, mmdeploy_sender_t *output)¶
-
int mmdeploy_text_recognizer_get_result(mmdeploy_value_t output, mmdeploy_text_recognition_t **results)¶
Unpack text-recognizer output from a mmdeploy_value_t.
- Parameters
output – [in]
results – [out]
- Returns
status of the operation