LogoLogo
Buy SoftwareBuy HardwareOpen a ticket
Developer Ecosystem
Developer Ecosystem
  • 🚘Rekor CarCheck®
    • Rekor CarCheck® Overview
    • Countries and Regions Supported
    • Vehicle Characteristics Supported
    • Create an Account
    • Integration
    • Code Samples
    • Web Dashboard
  • ⚙️Vehicle Recognition SDK
    • Vehicle Recognition SDK Overview
    • Countries and Regions Supported
    • Vehicle Characteristics Supported
    • Request a License
    • Installation
      • Windows
      • Ubuntu Linux
    • Vehicle Recognition Image API
      • C++
      • C
      • Samples
    • Vehicle Recognition Stream API
      • C++
      • C
      • Samples
Powered by GitBook
LogoLogo

Platforms

  • Rekor Discover® for Urban Mobility
  • Rekor Command® for Transportation
  • Rekor Scout® for Public Safety

Systems

  • Rekor Edge Flex™ (Classificaiton)
  • Rekor Edge Max™ (Classification)
  • Rekor Edge Pro (ALPR)
  • Rekor Edge Max™ (ALPR)

Developers

  • Vehicle Recognition SDK
  • Rekor CarCheck®
  • Rekor AutoNotice™

Resources

  • About Us
  • Customer Stories
  • Newsroom
  • Help Center

© 2025 Rekor Systems, Inc. All Rights Reserved.

On this page

Was this helpful?

  1. Vehicle Recognition SDK
  2. Vehicle Recognition Image API

C++

OPENALPRDLLEXPORT

namespacealpr

Enums

enumAlprHardwareAcceleration

Values:

enumeratorALPR_CPU

enumeratorALPRNVIDIAGPU

classAlpr

Public Functions

Alpr(const std::string country, const std::string configFile, const std::string runtimeDir, const std::string licenseKey)

Initialize the OpenALPR library. This operation should be performed once per thread.

Parameters

  • country: The country used for recognition (e.g., us for North American, eu for European, br for Brazil, etc.)

  • configFile: The path to the openalpr.conf file. Default is /etc/openalpr/openalpr.conf

  • runtimeDir: The path to the runtime_data directory. Default is /usr/share/openalpr/runtime_data/

  • licenseKey: The OpenALPR commercial license key

~Alpr()

Alpr(const std::string country, const std::string configFile = "", const std::string runtimeDir = "")

Deprecated - Legacy constructor to support existing symbols.

Initialize the OpenALPR library. This operation should be performed once per thread. Overrides the configuration in openalpr.conf to set GPU usage explicitly

Parameters

  • country: The country used for recognition (e.g., us for North American, eu for European, br for Brazil, etc.)

  • configFile: The path to the openalpr.conf file. Default is /etc/openalpr/openalpr.conf

  • runtimeDir: The path to the runtime_data directory. Default is /usr/share/openalpr/runtime_data/

  • licenseKey: The OpenALPR commercial license key

  • acceleration_type: Nvidia GPU or CPU

  • gpu_id: The ID of the GPU to use. Default=0

  • batch_size: The number of images to process on the GPU simultaneously. Default=10

void setCountry(std::string country)

Set the country used for plate recognition

Parameters

  • country: Country code (e.g., us, eu, in, etc.)

void setPrewarp(std::string prewarp_config)

Parameters

  • prewarp_config: A specially constructed string produced by the openalpr_calibrate utility

void setMask(unsigned char *pixelData, int bytesPerPixel, int imgWidth, int imgHeight)

Update the detection mask without reloading the library. The detection mask is used to improve processing efficiency (by ignoring areas for recognition) and to reduce false positives (by disqualifying plates found in areas where there could not be plates).

The Mask is simply a black/white image that should match the input resolution of the images. If it does not match, it will be stretched to fit. The white portions are areas that should be included for processing and the black areas will be ignored.

Parameters

  • pixelData: raw image bytes for BGR channels

  • bytesPerPixel: Number of bytes for each pixel (e.g., 3)

  • imgWidth: Width of the image in pixels

  • imgHeight: Height of the image in pixels

void setDetectRegion(bool detectRegion)

Deprecated:

Enables/disables detection of state/province for applicable countries

Parameters

  • detectRegion: true to enable region detection, false to disable

void setTopN(int topN)

Set the maximum number of plate candidates to return

Parameters

  • topN: an integer specifying the maximum possible plate results to return (default: 10)

void setDefaultRegion(std::string region)

Specify a region to use when applying patterns. For example, if the camera is installed in Germany, and 90% of the license plates will be German plates, using a pattern of “de” would try to match the results against the German plate patterns and improve accuracy.

Parameters

  • region: The state/province to use as the default for pattern matching (e.g., md for USA/Maryland, be for Europe/Belgium).

Recognize from an image on disk. The file should be an image in an encoded format such as JPG, PNG, BMP, GIF, etc.

ReturnThe results of the ALPR recognition for this imageParameters

  • filepath: Location of the file on disk (e.g., /tmp/image.jpg)

Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).

ReturnThe results of the ALPR recognition for this imageParameters

  • imageBytes: array of bytes for the image

Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).

ReturnThe results of the ALPR recognition for this imageParameters

  • imageBytes: Image bytes for the encoded image

  • regionsOfInterest: an array of regions to recognize. Areas not covered by a region of interest would be ignored. You may pass an empty array to scan the entire image.

Recognize from raw pixel data.

ReturnThe results of the ALPR recognition for this imageParameters

  • pixelData: raw image bytes for BGR channels

  • bytesPerPixel: Number of bytes for each pixel (e.g., 3)

  • imgWidth: Width of the image in pixels

  • imgHeight: Height of the image in pixels

  • regionsOfInterest: an array of regions to recognize. Areas not covered by a region of interest would be ignored. You may pass an empty array to scan the entire image.

Recognize a batch of images from byte data representing encoded images (e.g., BMP, PNG, JPG, GIF etc).

ReturnThe results of the ALPR recognition for this imageParameters

  • imageBytes: An array of encoded image bytes

Recognize a batch of images from raw pixel data. Batch processing is recommended when using a GPU for processing. Sending a batch of images allows the GPU to process them in parallel improving the overall efficiency.

ReturnThe results of the ALPR recognition for this imageParameters

  • pixelData: raw image bytes for BGR channels

  • bytesPerPixel: Number of bytes for each pixel (e.g., 3)

  • imgWidth: Width of the image in pixels

  • imgHeight: Height of the image in pixels

  • num_images: The number of images in the batch

  • regionsOfInterest: an array of regions to recognize. Areas not covered by a region of interest would be ignored. You may pass an empty array to scan the entire image.

bool isLoaded()

Verifies whether the OpenALPR instance was properly loaded

**Return**true if the engine is ready to use, false otherwise

bool getUseGpu()

int getGpuBatchSize()

int getGpuId()

Config *getConfig()

Public Static Functions

Returna properly formatted JSON string describing the ALPR resultsParameters

std::string getVersion()

Gets the current version of the OpenALPR software

**Return**A version string (e.g., 2.4.102)

Private Members

AlprImpl *impl

structAlprCoordinate

Public Members

int x

int y

structAlprPlate #include <alpr.h>

An individual plate result.

Public Members

std::string characters

The string characters of the plate (e.g., ABC123)

float overall_confidence

The confidence score from 0-100.

bool matches_template

Whether the plate matches a template for the province.

classAlprPlateResult

Public Functions

AlprPlateResult()

~AlprPlateResult()

std::string toJson(bool serialize_crop = false)

Exports this object to a JSON representation.

Public Members

int requested_topn

The number requested is always >= the topNPlates count.

std::string country

The country (training data code) that was used to recognize the plate.

the best plate is the topNPlate with the highest confidence

A list of possible plate number permutations.

float processingtimems

The processing time for this plate.

the X/Y coordinates of the corners of the plate (clock-wise from top-left)

int plate_index

The index of the plate if there were multiple plates returned.

std::string region

When province detection is enabled, this returns the region (e.g., md).

int regionConfidence

The confidence for the detected region (0-100)

A bounding box where the car is likely to be found.

std::vector<unsigned char> platecropjpeg

A cropped image (encoded as a JPEG) for the plate.

Public Static Functions

Rebuilds this object from a JSON string.

classAlprRegionOfInterest #include <alpr.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 Functions

AlprRegionOfInterest()

AlprRegionOfInterest(int x, int y, int width, int height)

Public Members

int x

int y

int width

int height

classAlprResults

Public Functions

AlprResults()

~AlprResults()

std::string toJson(bool serialize_crop = false)

Exports this object to a JSON representation.

Public Members

int64_t epoch_time

The time (in epoch ms) when the image for this image was captured.

int64_t frame_number

The relative frame number for this image.

int img_width int img_height

float totalprocessingtime_ms

The total processing time for detecting and recognizing all plates in the image.

std::string image_uuid

A globally unique ID for this image.

bool error

True if an error occurred during processing, false otherwise.

std::string error_message

An error message if there was an error processing.

An array of plate results.

The regions of interest provided when requesting recognition.

Public Static Functions

Rebuilds this object from a JSON string.

PreviousVehicle Recognition Image APINextC

Was this helpful?

Alpr(const std::string country, const std::string configFile, const std::string runtimeDir, const std::string licenseKey, acceleration_type, int gpu_id = 0, int batch_size = 10)

Deprecated. This function no longer functions. Since version 2.4.101, the accuracy at angles has improved that setting a prewarp value is no longer used. The parameter has a detrimental affect on both performance and accuracy. Simple image rotation in can be handled with gstreamer parameters.

recognize(std::string filepath)

recognize(std::vector<char> imageBytes)

recognize(std::vector<char> imageBytes, std::vector<> regionsOfInterest)

recognize(unsigned char *pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector<> regionsOfInterest)

std::vector<> recognize_batch(std::vector<std::vector<char>> imageBytes)

std::vector<> recognize_batch(unsigned char **pixelData, int bytesPerPixel, int imgWidth, int imgHeight, int num_images, std::vector<std::vector<>> regionsOfInterest)

std::string toJson(const std::vector<> results)

std::string toJson(const results)

Deprecated: Converts the AlprResult object to JSON Use the toJson/fromJson on the and classes

results: an object to convert to JSON

std::string toJson(const result)

fromJson(std::string json)

bestPlate

std::vector<> topNPlates

plate_points[4]

vehicle_region

fromJson(std::string json_string)

std::vector<> plates

std::vector<> regionsOfInterest

fromJson(std::string json_string)

⚙️
AlprHardwareAcceleration
AlprStream
AlprResults
AlprResults
AlprResults
AlprRegionOfInterest
AlprResults
AlprRegionOfInterest
AlprResults
AlprResults
AlprRegionOfInterest
AlprResults
AlprResults
AlprResults
AlprPlateResult
AlprResults
AlprPlateResult
AlprResults
AlprPlate
AlprPlate
AlprCoordinate
AlprRegionOfInterest
AlprPlateResult
AlprPlateResult
AlprRegionOfInterest
AlprResults