C

Typedefs

typedefvoid OPENALPR

typedefvoid OPENALPRIMAGEBATCH

Enums

enumAlprCHardwareAcceleration

Values:

enumeratorALPRC_CPU

enumeratorALPRCNVIDIAGPU

Functions

OPENALPR *openalpr_init(const char *country, const char *configFile, const char *runtimeDir, const char *licenseKey)

Initializes the openALPR library and returns a pointer to the OpenALPR instance

The instance should be reused many times. Eventually you will want to destroy the instance when you are finished recognizing license plates.

see also openalpr_cleanup()

ReturnAn OpenALPR instance that can be used with other openalpr functions

OPENALPR *openalprinitgpu(const char *country, const char *configFile, const char *runtimeDir, const char *licenseKey, AlprCHardwareAcceleration acceleration_type, int gpu_id, int batch_size)

Initializes the openALPR library, overriding the openalpr.conf configuration for GPU returns a pointer to the OpenALPR instance

The instance should be reused many times. Eventually you will want to destroy the instance when you are finished recognizing license plates.

see also openalpr_cleanup()

ReturnAn OpenALPR instance that can be used with other openalpr functions

int openalprisloaded(OPENALPR *instance)

Verify that the OpenALPR library loaded correctly and can accept image inputs

see also alpr::Alpr::isLoaded()

ReturnReturns 1 if the library was loaded successfully, 0 otherwise

void openalprsetcountry(OPENALPR *instance, const char *country)

Set the country used for plate recognition see also alpr::Alpr::setCountry()

void openalprsetprewarp(OPENALPR *instance, const char *prewarp_config)

Update the prewarp setting without reloading the library

see also alpr::Alpr::setPrewarp()

void openalprsetmask(OPENALPR *instance, unsigned char *pixelData, int bytesPerPixel, int imgWidth, int imgHeight)

Update the detection mask without reloading the library

see also alpr::Alpr::setMask()

void openalprsetdetect_region(OPENALPR *instance, int detectRegion)

/deprecated Enables/disables state/province detection. Set this in openalpr.conf

see also alpr::Alpr::setDetectRegion()

void openalprsettopn(OPENALPR *instance, int topN)

Specify a region to use when applying patterns.

see also alpr::Alpr::setTopN()

void openalprsetdefault_region(OPENALPR *instance, const char *region)

Specify a region to use when applying patterns.

see also alpr::Alpr::setDefaultRegion()

char *openalprrecognizerawimage(OPENALPR *instance, unsigned char *pixelData, int bytesPerPixel, int imgWidth, int imgHeight, struct AlprCRegionOfInterest roi)

Recognizes the provided image and responds with JSON. Image is expected to be raw pixel data (BGR, 3 channels) Caller must call openalpr_free_response_string() on the returned object

see also alpr::Alpr::recognize()

ReturnJSON formatted plate recognition results

char *openalprrecognizeencodedimage(OPENALPR *instance, unsigned char *bytes, long long length, struct AlprCRegionOfInterest roi)

Recognizes the encoded (e.g., JPEG, PNG) image. bytes are the raw bytes for the image data. Caller must call openalpr_free_response_string() on the returned object

see also alpr::Alpr::recognize(), openalpr_recognize_rawimage()

ReturnJSON formatted plate recognition results

OPENALPR_IMAGE_BATCH *openalprcreateimage_batch()

Creates an object that can be used to send a batch of images to OpenALPR Make sure to free the memory with openalprreleaseimage_batch after you finish with the batch

Return a pointer that can be passed into openalpraddimagetobatch and openalprrecognizebatch

void openalpraddimagetobatch(OPENALPR_IMAGE_BATCH *batch, unsigned char *pixelData, int bytesPerPixel, int imgWidth, int imgHeight, struct AlprCRegionOfInterest roi)

Add an image to an OpenALPR batch object. Image is expected to be raw pixel data (BGR, 3 channels) The number of images should not exceed the configured batch_size property in openalpr.conf

void openalpraddencodedimageto_batch(OPENALPR_IMAGE_BATCH *batch, unsigned char *bytes, long long length, struct AlprCRegionOfInterest roi)

Add an encoded image (e.g., JPEG, PNG, BMP, etc) to the batch

Parameters

  • bytes: raw bytes for the encoded image

  • length: length of the data

  • roi: region of interest to look for license plates

char *openalprrecognizebatch(OPENALPR *instance, OPENALPR_IMAGE_BATCH *batch)

Recognizes the provided batch of images and responds with JSON. Caller must call openalpr_free_response_string() on the returned object

ReturnJSON formatted plate recognition results for each image in the batch

void openalprreleaseimage_batch(OPENALPR_IMAGE_BATCH *batch)

Free memory associated with an image batch crated by openalpr_create_image_batch()

void openalprfreeresponse_string(char *response)

Frees a char* response that was provided from a recognition request. You must call this function on every response to avoid memory leaks.

Parameters

  • response: The string returned from an openalpr_recognize function

void openalpr_cleanup(OPENALPR *instance)

Free the memory for the OpenALPR instance created with openalpr_init

Parameters

  • instance: OpenALPR instance object

structAlprCRegionOfInterest #include <alpr_c.h>

Specifies a region of interest to restrict the area that OpenALPR analyzes. The region(s) must be rectangular. The x,y positions are specified in pixels and correspond to the top left corners of the rectangle. The width and height are also specified in pixels. The coordinate system origin (0,0) is the top left of the image

Public Members

int x

int y

int width

int height