# C

**Typedefs**

***typedef*****void** `OPENALPR`

***typedef*****void** `OPENALPRIMAGEBATCH`

**Enums**

***enum***`AlprCHardwareAcceleration`

*Values:*

***enumerator***`ALPRC_CPU`

***enumerator***`ALPRCNVIDIAGPU`

**Functions**

[**OPENALPR**](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) **\***`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()](http://doc.openalpr.com/api.html#alpr__c_8h_1a4e2d460fe939b24cddb53dda570bde3c)

**Return**An OpenALPR instance that can be used with other openalpr functions

[**OPENALPR**](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) **\***`openalprinitgpu`(*const* char \**country*, *const* char \**configFile*, *const* char \**runtimeDir*, *const* char \**licenseKey*, [AlprCHardwareAcceleration](http://doc.openalpr.com/api.html#_CPPv425AlprCHardwareAcceleration) *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()](http://doc.openalpr.com/api.html#alpr__c_8h_1a4e2d460fe939b24cddb53dda570bde3c)

**Return**An OpenALPR instance that can be used with other openalpr functions

**int** `openalprisloaded`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*)

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

see also [alpr::Alpr::isLoaded()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1a105195ec73d893aba36c7bc62cc3f002)

**Return**Returns 1 if the library was loaded successfully, 0 otherwise

**void** `openalprsetcountry`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, *const* char \**country*)

Set the country used for plate recognition see also [alpr::Alpr::setCountry()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1aa7830f5934fde471d0fb617963a8e3eb)

**void** `openalprsetprewarp`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, *const* char \**prewarp\_config*)

Update the prewarp setting without reloading the library

see also [alpr::Alpr::setPrewarp()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1aadb52333305bc6e4eac2d66059ba7a38)

**void** `openalprsetmask`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, unsigned char \**pixelData*, int *bytesPerPixel*, int *imgWidth*, int *imgHeight*)

Update the detection mask without reloading the library

see also [alpr::Alpr::setMask()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1a6fa6879edb1bb62ebb3623cd108823b8)

**void** `openalprsetdetect_region`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, int *detectRegion*)

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

see also [alpr::Alpr::setDetectRegion()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1a230dcc47b5e69c1e06cfaf8e3c9d7afa)

**void** `openalprsettopn`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, int *topN*)

Specify a region to use when applying patterns.

see also [alpr::Alpr::setTopN()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1a34a8020f42e59c322b0e8a9184185efc)

**void** `openalprsetdefault_region`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, *const* char \**region*)

Specify a region to use when applying patterns.

see also [alpr::Alpr::setDefaultRegion()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1a4e46e1f08cbdb666c36cb0dac7466669)

**char \***`openalprrecognizerawimage`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, unsigned char \**pixelData*, int *bytesPerPixel*, int *imgWidth*, int *imgHeight*, *struct* [AlprCRegionOfInterest](http://doc.openalpr.com/api.html#_CPPv421AlprCRegionOfInterest) *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()](http://doc.openalpr.com/api.html#alpr__c_8h_1a5f97250d29133e163e9da75652c7407a) on the returned object

see also [alpr::Alpr::recognize()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1ae66ae791407d90b6ed99e026729e6b15)

**Return**JSON formatted plate recognition results

**char \***`openalprrecognizeencodedimage`([OPENALPR](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, unsigned char \**bytes*, long long *length*, *struct* [AlprCRegionOfInterest](http://doc.openalpr.com/api.html#_CPPv421AlprCRegionOfInterest) *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()](http://doc.openalpr.com/api.html#alpr__c_8h_1a5f97250d29133e163e9da75652c7407a) on the returned object

see also [alpr::Alpr::recognize()](http://doc.openalpr.com/api.html#classalpr_1_1Alpr_1ae66ae791407d90b6ed99e026729e6b15), [openalpr\_recognize\_rawimage()](http://doc.openalpr.com/api.html#alpr__c_8h_1a5c6e8f60814d50a4ec4a31a0b139e3d1)

**Return**JSON formatted plate recognition results

[**OPENALPR\_IMAGE\_BATCH**](http://doc.openalpr.com/api.html#_CPPv420OPENALPR_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 openalpr*release*image\_batch after you finish with the batch

**Return** a pointer that can be passed into openalpr*add*image*to*batch and openalpr*recognize*batch

**void** `openalpraddimagetobatch`([OPENALPR\_IMAGE\_BATCH](http://doc.openalpr.com/api.html#_CPPv420OPENALPR_IMAGE_BATCH) \**batch*, unsigned char \**pixelData*, int *bytesPerPixel*, int *imgWidth*, int *imgHeight*, *struct* [AlprCRegionOfInterest](http://doc.openalpr.com/api.html#_CPPv421AlprCRegionOfInterest) *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](http://doc.openalpr.com/api.html#_CPPv420OPENALPR_IMAGE_BATCH) \**batch*, unsigned char \**bytes*, long long *length*, *struct* [AlprCRegionOfInterest](http://doc.openalpr.com/api.html#_CPPv421AlprCRegionOfInterest) *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](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*, [OPENALPR\_IMAGE\_BATCH](http://doc.openalpr.com/api.html#_CPPv420OPENALPR_IMAGE_BATCH) \**batch*)

Recognizes the provided batch of images and responds with JSON. Caller must call [openalpr\_free\_response\_string()](http://doc.openalpr.com/api.html#alpr__c_8h_1a5f97250d29133e163e9da75652c7407a) on the returned object

**Return**JSON formatted plate recognition results for each image in the batch

**void** `openalprreleaseimage_batch`([OPENALPR\_IMAGE\_BATCH](http://doc.openalpr.com/api.html#_CPPv420OPENALPR_IMAGE_BATCH) \**batch*)

Free memory associated with an image batch crated by [openalpr\_create\_image\_batch()](http://doc.openalpr.com/api.html#alpr__c_8h_1a1e7fc9bf7abed5110e20e3270d322f01)

**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](http://doc.openalpr.com/api.html#_CPPv48OPENALPR) \**instance*)

Free the memory for the OpenALPR instance created with openalpr\_init

**Parameters**

* `instance`: OpenALPR instance object

***struct***`AlprCRegionOfInterest`\
\&#xNAN;*#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`
