Products and Technology - Software and Hardware

  Automatic License Plate Recognition

License Plate Recognition API & SDK

Applications which offer License Plate Recognition functionalities utilise the license plate recognition capabilities and functions of a License Plate Recognition Engine.

The License Plate Recognition Engine (the core recognition module) has an Application Programming Interface (API), which is a series of functions that the application program can use to make the LPR Engine do the difficult work of recognition. It provides an interface between the processes of the application and the core image recognition tasks of license plate recognition.

The Application and the License Plate Recognition Engine

In order to work with the API - to develop applications using the functions offered by the API - software developers need proper documentation, sample codes and program tools for the API. The collection of this documentation, set of programs and tools are called Software Development Kit (SDK).

The License Plate Recognition Software Development Kit includes everything developers need to write, build, test, and deploy license plate recognition enabled applications.

The basic and essential part of the SDK is the documentation of the API. The documentation contains the exact description of the definitions, functions and variables of the API.

For demonstration purposes we show here a part of the SDK of the CARMEN License Plate Recognition Engine of Adaptive Recognition Hungary.

The native CARMEN API provides interface using the C++ programming language to the recognition services of the CARMEN Recognition Engine.

The API contains a C++ function named cm_findfirst which is responsible for finding and reading the first plate from an image (as there may be more than one).

Bellow is the documentation of this cm_findfirst function as it can be found in the CARMEN SDK.

cm_findfirst By calling the cm_findfirst function the application can read a number plate from an image. The function returns the character tips of the number plate, and the text of the plate in ASCII and Unicode string format.
declaration int cm_findfirst(
    gxHANDLE  hanpr,
    const gxIMAGE*  pimage,
    cmNP**  panprresult
The gxHANDLE value retrieved by the gx_openmodule function of the gxsd module.
Points to the gxIMAGE structure which contains the image to be scanned for license plates.
Points to the cmNP* pointer which receives the data of the found license plate. The panprresult pointer is allowed to be 0 or the cmNP* pointer retrieved by a previous call of one of the cm_findfirst, cm_findnext or cm_format functions. In both cases the CMANPR module allocates enough memory space for the result if necessary. The application has to free this pointer. If the function returns NULL for the *panprresult pointer it means that no plate is found. (See later the detailed description of this structure.)
Copyright(C) 2007 by Adaptive Recognition Hungary

All functions, definitions and variables of the CARMEN API have the same style of description.

In order to help development work (reduce development time and costs) the SDK should provide well structured sample programs in source code.

The CARMEN SDK provides a very simple, still fully functional sample program in C++. The ready-to-compile sample program captures an image from the video source (this is done by calling the functions of a separate Video Capture Module), reads the license plate from the captured digital image and outputs the result(s) on the screen.

Bellow is the sample1.cpp C++ source code of the sample1.exe demo program of the CARMEN SDK.

   cmanpr sample1.cpp
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "gxsd.h"
#include "gxerr.h"
#include "fxvd4.h"
#include "cmanpr.h"
//set the int property for the module specified by handle
int setintproperty(gxHANDLE handle,const char* propname,int value)
char   v[256];
   return gx_setmoduleproperty(handle,propname,v);
//get the int property from the module specified by handle
int getintproperty(gxHANDLE handle,const char* propname,int* value)
char   v[256];
   if (!gx_getmoduleproperty(handle,propname,v,256)) return 0;
   *value = atoi(v);
   return 1;
void main(int argc,char *argv[])
gxIMAGE   image;      //gxIMAGE object to recognize
   //initialise image
   //if command line parameter is provided, then it is assumed to be either
   // a) the name of the picture file, or
   // b) the channel number
   if (argc == 2)
      if (isdigit(**argv))   // considered as channel number
      gxHANDLE         hcap;      //handle for the fxvd4 module
         //open fxvd4 module
         if (!gx_openmodule(&hcap,"fxvd4","default")) goto error_ret;
         //set the capture settings
         if (!setintproperty(hcap,"channel",atoi(*argv))) goto error_ret;
         if (!setintproperty(hcap,"format",GX_GRAY)) goto error_ret;
         if (!setintproperty(hcap,"xres",50)) goto error_ret;
         if (!setintproperty(hcap,"yres",50)) goto error_ret;
         if (!setintproperty(hcap,"sline",0)) goto error_ret;
         //capture an image
         if (!gx_capture(hcap,&image,0))
            goto error_ret;
         //close fxvd4 module
      else // possible the name of a file
         if (!gx_loadimage(&image,*argv,0)) goto error_ret;
      gxHANDLE      hanpr;      //handle for the cmanpr module
      cmNP*         result;      //recognized number plate results
      char         anprname[256]="";   //the name of the engine
      int            nplate = 0;
         //open cmanpr module
         if (!gx_openmodule(&hanpr,"cmanpr","")) goto error_ret;
         if (!gx_getmoduleproperty(hanpr,"anprname",anprname,256)) goto error_ret;
         if (strcmp(anprname,"")) printf("Name of the anpr module: %s\n\n",anprname);
            printf("No engine installed.\n");
            goto end;
         //read number plates from the image
         result = 0;
         nplate = 0;
         if (!cm_findfirst(hanpr,&image,&result)) goto error_ret;
            printf("Found plate: %s\n",result->text?result->text:"No plate text");
            //write the position of the frame of the plate
            printf("Frame of the plate: (%3i,%3i) - (%3i,%3i)\n",result->frame.x1,result->frame.y1,result->frame.x2,result->frame.y2);
            printf(" | | \n");
            printf(" (%3i,%3i) - (%3i,%3i)\n",result->frame.x4,result->frame.y4,result->frame.x3,result->frame.y3);
            //the application must free the result structure
            result = 0;
            nplate ++;
            if (!cm_findnext(hanpr,&result)) goto error_ret;
         if (nplate == 0) printf("No plate found.\n");
         //close cmanpr module
      goto end;
      char      errmsg[256];   //error message
      int         error;         //error code
         gx_geterror(&error,errmsg,256);   //obtain error message
         printf("ErrorCode: 0x%08x - %s\n",error,errmsg);
      printf("usage: sample1.exe [channel] or sample1.exe [filename]\n");
   printf("press any key to exit...");
Copyright(C) 2007 by Adaptive Recognition Hungary

Keywords: API, SDK, application programming interface, software development kit, license plate recognition software, license plate recognition SDK, license plate recognition toolkit, license plate recognition source code, recognise letters, read plate text, software development kit, LPR software library, ANPR software library, software developers kit, editable license number text, image recognition source code, image processing, LPR source code, C++ source code, demo software, software source code, license plate recognition process, license plate recognition