SDK for number plate recognition

From VIT company
Revision as of 13:21, 10 March 2015 by Sysop@vitcompany.com (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction


VIT AutoSDK (SDK) development kit isdesigned for recognition of vehicle number plates. SDK is a set of C/C++ runtime libraries and header files that arerequired for use of SDK inapplication level development.


Depending on supply, SDK can be used inx86 family computers(32/64 bit) under Unix OS (e.g. FreeBSD, Mac OS X, Linux) and Microsoft Windows OS (e.g. 2000, 2003, XP, Vista, Seven).


The maximum number of active principals , as well as the number of processed frames per second, depends on the supply.


SDK dynamic libraries are protected and cannot be used without special supplied hardware key.

Product structure

AutoSDK consists of:

  • AutoSDK file package
  • hardware key (allows to run SDK executable files)


<AutoSDK>

samples ;; examples of SDK usage
doc
ru
AutoSDK.pdf ;; developer documentation
en
AutoSDK.pdf
templates ;; images of number plate types (templates)
opt
include ;; header files
Vodi ;; SDK header files
Bo ;; support library
bin [Unix] ;; programs
vpwfetch ;; reads vehicle number plates
bin [Windows] ;; programs, dynamic libraries
vpwfetch.exe ;; reads vehicle number plates
Bo.dll ;; support library
Bo_g.dll ;; debug variant
Vodi.dll
Vodi_g.dll ;; debug variant
lib [Unix] ;; object files, dynamic and archive libraries
<PFX>Bo<SFX> ;; support library
<PFX>Bo_g<SFX> ;; debug variant
<PFX>Vodi<SFX>
<PFX>Vodi_g<SFX> ;; debug variant
lib [Windows] ;; object files, dynamic and stub libraries
Bo.lib ;; stub library Bo.dll
Bo_g.lib ;; debug variant
Vodi.lib ;; stub library Vodi.dll
Vodi_g.lib ;; debug variant
libexec ;; libraries with implicit linking
HASP


<PFX> - system-dependent prefix of dynamic libraries (for example, lib).


<SFX> - system-dependent suffix of dynamic libraries containing the file version and its extension (e.g. so.2.4.0; 2.4.0.dylib, -2_4_0. dll).

Product installation


We give installation recommendations, based on our traditions. You can use other installation approaches, based on our example,which will be more convenient for you.


Let’s assume that AUTOSDK is the path to the package you want to install (for more information on structure of the package, see “Product structure” section), and INSTALLDIR is the path to the directory where you want to install the product.

Installation for Windows

1. Copy content of the AUTOSDK into INSTALLDIR directory.
2. Add path to INSTALLDIR\opt\include to the header search path for C/C++ preprocessor. It can be done using Microsoft Visual Studio in “Additional Include Directories” section.
3. Add path to INSTALLDIR\opt\libto the library search path for linker. It can be done using Microsoft Visual Studio in “Additional Library Directories” section.
4. Create or add path to the INSTALLDIR\opt\bin into the environmental variable PATH.
5. Create or add path to the INSTALLDIR\opt\libexec\aopr\modules into the environmental variable AORP_MODULE_PATH.

First application

Module loading


It is necessary to load modules before working with the SDK.

static bo_status_t _t_load_requireds(struct aorp_error *anErrPtr)
{
	/*
	 * We will load 4 base modules:
	 * vpwf – base functional
	 * vpwc - additionalfunctional
	 * vipaz - recognizers
	 * vpwi – description of number plates
	*/
	static charconst *_s_requireds[] = {
		"vpwf-ia616oa245", "vpwc-f0p1", "vipaz-mlnn", "vipaz-gm", "vpwi-ru",
		NULL
	};

	bo_status_t status;
	charconst *name, **rqp;

	for (rqp = _s_requireds; NULL != (name = *rqp); ++rqp) {
		status = AorpMldLoad(name, NULL, 0, 0, anErrPtr);
		if (BoS_FAILURE(status)) {
			return (status);
			/* NOTREACHED */
		}
	}

	return (BoS_NORMAL);
}

Creation of the principal


To start number plate recognition, it is necessary to create/open an instance of the principal. When it is created, you can specify some parameters for its work.

static aorp_object_t _t_princ_open(struct aorp_error *anErrPtr)
{
	struct vodi_vpw_princ_param defaults = {
		/* .enable = */true,
		/* .thread_max = */0,
		/* .image_width = */100,
		/* .image_height = */100,
		/* .image_brightnes = */0,
		/* .image_contrast = */0,
		/* .image_blur = */13,
		/* .image_treshold = */21,
		/* .image_reversed = */false,
		/* .image_angle = */0,
		/* .analysed_zone = */ {0},
		/* .analysed_zone_count = */0,
		/* .plate_size_max = */200,
		/* .plate_size_min = */45,
		/* .plate_inverse_analyse = */true,
		/* .plate_probability_min = */15,
		/* .plate_star_max = */1,
		/* .md_enable = */false,
		/* .md_cell_size = */0,
		/* .md_threshold = */0,
		/* .md_square_min = */0,
		/* .md_mask = */NULL,
		/* .md_mask_h_size = */0,
		/* .md_mask_v_size = */0,
		/* .dynamic_enable = */false
	};
	aorp_object_tretval;

	VpwprincOpen(retval, 0, NULL, &defaults, anErrPtr);
	return (retval);
}

int main(intargc, char *argv[])
{
	aorp_object_t principal;
	struct aorp_error *err;

	...

	principal = _t_princ_open(err);

	...

	(void)AorpRelease(principal, 0, NULL); /* releasing the principal */

	...
}

Configuration


Once created, the principal can be set up for work. In this example, the configuration specifies the need to recognize Russian number plates. Other options can be found in the "Functional specification"section.

static bo_status_t
_t_princ_configure(aorp_object_t aPrincipal, struct aorp_error *anErrPtr)
{
	bo_status_t status;
	struct vodi_vpw_country_idtmpl = {
		/* .code = */643/* ru */,
		/* .id = */0,
		/* .sub_id = */0
	};

	assert(NULL != aPrincipal);

	status = VodiprincSetparam(
		aPrincipal, anErrPtr, VodiCTL_VPW_PLATE_TEMPLATE, &tmpl, 1
	);
	if (BoS_FAILURE(status)) {
		return (status);
		/* NOTREACHED */
	}
	
	/* other parameters */

	status = VodiprincApplyparam(result, anErrPtr);
	return (status);
}

Recognition


Now everything is ready for recognition. To do so, the image file should be packed into the structure vodi_image and passed to the operation VodiprincProcess. Each row of the image must be aligned to 4 bytes. It is also necessary to prepare the structure vodi_vpw_options with additional options (sequential number of the frame, its timestamp and size). If the image size changes, it is necessary to update values of VodiCTL_VPW_IMAGE_WIDTH and VodiCTL_VPW_IMAGE_HEIGHT to current.


In the case when number plates are detected in the image,the operation returns result ensemble.

static bo_status_t
_t_princ_recognize(
	aorp_object_t aPrincipal,
	struct vodi_image *anImage,
	size_t anAnalizeZonec,
	struct vodi_rectconst anAnalizeZonev[],
	struct vodi_ucontext *anUserCtx,
	aorp_object_t anInputEnsemble,
	aorp_object_t *anOutputEnsemblePtr,
	struct aorp_error *anErrPtr
	)
{
	bo_status_t status;
	unsigned width, height;
	struct vodi_vpw_options options;

	options.magic = VodiK_VPW_OPTIONS_WORK_MAGIC;
	options.img_seqnum = 0;
	options.img_timestamp = 0;
	options.imgsz.sz_width = width = anImage->img_width;
	options.imgsz.sz_height = height = anImage->img_height;
	
	status = VodiprincSetparam(
		aPrincipal, anErrPtr, VodiCTL_VPW_IMAGE_WIDTH, width
	);
	if (BoS_FAILURE(status)) {
		return (status);
		/* NOTREACHED */
	}
	status = VodiprincSetparam(
		aPrincipal, anErrPtr, VodiCTL_VPW_IMAGE_HEIGHT, height
	);
	if (BoS_FAILURE(status)) {
		return (status);
		/* NOTREACHED */
	}
	status = VodiprincApplyparam(aPrincipal, anErrPtr);
	if (BoS_FAILURE(status)) {
		return (status);
		/* NOTREACHED */
	}

	status = VodiprincProcess(
		aPrincipal, anImage, anAnalizeZonec, anAnalizeZonev,
		anUserCtx, anInputEnsemble, anOutputEnsemblePtr,
		&options, anErrPtr
	);
	return (status);
}

Processing recognition results


Processing of the results begins with the reading of the ensemble.

static bo_status_t
_t_ensemble_handle(aorp_object_t anEnsemble, struct aorp_error *anErrPtr)
{
	bo_status_t status;
	size_tresc;
	aorp_object_tresv[256], *resp;
	bo_index_t from;
	_Bool overflow;

	assert(NULL != anEnsemble);

	from = 0;
	do {
		status = VodiensGet(
			anEnsemble, from, -1, __myc_namembs(resv), resv, anErrPtr
		);
		if (!BoS_DOBRE(status))
			break;

		resc = (size_t)status;
		overflow = false;
		if (__myc_namembs(resv) <resc) {
			resc = __myc_namembs(resv);
			from += (bo_index_t)resc;
			overflow = true;
		}

		resp = resv;
		do {
			status = _t_result_handle(*resp++, anErrPtr);
			if (BoS_FAILURE(status)) {
				return (status);
				/* NOTREACHED */
			}
		}
		while (--resc);
	}
	while (overflow);

	return (BoS_NORMAL);
}


For each result from the ensemble we use the following function. The function reads the information from the result into the structure vodi_vpw_result_info using the VodiresFetchinfo operation. After using it to read the information, it must be destroyed using the VodiResultInfoDestroy.

static bo_status_t
_t_result_handle(aorp_object_t aResult, struct aorp_error *anErrPtr)
{
	bo_status_t status;
	struct vodi_result_info *info;
	struct vodi_vpw_result_info plateinfo;

	assert(NULL != aResult);

	info = (struct vodi_result_info *)&plateinfo;
	VODI_RESULT_INFO_TYPE(info) = VodiK_VPW_RESULT_INFO;
	status = VodiresFetchinfo(aResult, info, anErrPtr);
	if (BoS_FAILURE(status)) {
		return (status);
		/* NOTREACHED */
	}

	status = _t_plateinfo_handle(&plateinfo, anErrPtr);

	VodiResultInfoDestroy(info);

	return (status);
}


We apply another function to the read information, where you can do something with the result.

static bo_status_t
_t_plateinfo_handle(
	struct vodi_vpw_result_info *anInfo,
	struct aorp_error *anErrPtr
	)
{
	struct vodi_plate_info_spec *pis;
	struct vodi_plate *plate;

	assert(NULL != anInfo);

	pis = VODI_RESULT_INFO_SPEC(anInfo, plate);
	plate = &pis->pis_plate_variantv[0];

	/* do something */

	return (BoS_NORMAL);
}

Functional specification

VpwprincOpen

NAME
VpwprincOpen – open/create principal.
SYNTAX
#include <Vodi/objects/Vpwprinc.h>

void
__attribute__((nonnull(1,4))
VpwprincOpen(
	aorp_object_t&aResultRef,
	aorp_opflags_t Flags /* = 0 */,
	bo_pointer_t  aMemory /* = NULL */,
	struct vodi_vpw_princ_param *aParm,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
Function VpwprincOpen opens principal and sets on itaResultRef pointer.
Flags argument allows managing the process of object configuration. 0 can be passed by default.
With aMemory argument we can pass pointer to memory where object will be created. NULL can be passed by default. In this case the constructor will itself allocate memory for the objects.
With aParm argument we should pass initial parameters for the principal’s work. More detailed information can be found in the description of the VodiprincSetparam function.
vodi_vpw_princ_param structure contains the following fields:
enable Equivalent of the VodiCTL_VPW_PRINCIPAL_ENABLE.
thread_max Maximum number of recognition threads that if necessary, are created during work. Value 0 is equivalent to 1 (1 thread). Setting the value larger than number of cores with consideration of Hyper Threading is not recommended.
image_width Equivalent VodiCTL_VPW_IMAGE_WIDTH.
image_height Equivalent VodiCTL_VPW_IMAGE_HEIGHT.
image_brightnes Equivalent VodiCTL_VPW_IMAGE_BRIGHTNES.
image_contrast Equivalent VodiCTL_VPW_IMAGE_CONTRAST.
image_blur EquivalentVodiCTL_VPW_IMAGE_BLUR.
image_treshold Equivalent VodiCTL_VPW_IMAGE_THRESHOLD.
image_reversed Deprecated. Should be set to 0.
image_angle Equivalent VodiCTL_VPW_IMAGE_ANGLE.
analysed_zone Equivalent VodiCTL_VPW_IMAGE_ANALYSE_ZONE.
analysed_zone_count Current number of elements in the analysed_zone array.
plate_size_max EquivalentVodiCTL_VPW_PLATE_SIZE_MAX.
plate_size_min Equivalent VodiCTL_VPW_PLATE_SIZE_MIN.
plate_inverse_analyse Equivalent VodiCTL_VPW_PLATE_INVERSE_ANALYSE.
plate_probability_min Equivalent VodiCTL_VPW_PLATE_PROBABILITY_MIN.
plate_star_max Equivalent VodiCTL_VPW_PLATE_STAR_MAX.
md_enable Deprecated. Should be set to 0.
md_cell_size Deprecated.Should be set to 0.
md_threshold Deprecated. Should be set to 0.
md_square_min Deprecated. Should be set to 0.
md_mask Deprecated. Should be set to NULL.
md_mask_h_size Deprecated. Should be set to 0.
md_mask_v_size Deprecated. Should be set to 0.
dynamic_enable Equivalent VodiCTL_VPW_DYNAMIC_ENABLE.
log_settings Equivalent VodiCTL_VPW_LOG_SETTINGS.
RETURN VALUES
In case of success, the VpwprincOpen function sets aResultRef pointer to the created object. Otherwise, the function sets the aResultRef pointer to NULL as the status of an error and fills the description in the structure specified by the anErrPtr argument.

AorpRetain

NAME
AorpRetain - captures AORP object.
SYNTAX
#include <Bo/services/Ucntl.h>

ssize_t
__attribute__((nonnull(1))
AorpRetain(
	aorp_object_t aThis,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The AorpRetain function captures AORP object passed by the aThis argument. The result is the number of links to the object.
RETURN VALUES
In case of success, the AorpRetain function returns value greater or equal to 0.Otherwise, the function returns negative value as the status of an error and fills the description in the structure specified by the anErrPtr argument.

AorpRelease

NAME
AorpRelease - releases AORP object.
SYNTAX
#include <Bo/services/Ucntl.h>

ssize_t
__attribute__((nonnull(1))
AorpRelease(
	aorp_object_t aThis,
	aorp_opflags_t Flags /* = 0 */,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The AorpRelease function releases AORP object passed by the aThis argument.
RETURN VALUES
In case of success, the AorpRelease function returns the remaining number of references to the object. If the function returns 0, it means that the object was destroyed as a result of function’s work. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiprincGetparam

NAME

VodiprincGetparam – get the parameter.

SYNTAX
#include <Vodi/services/Vodiprinc.h>

bo_status_t
__attribute__((nonnull(1))
VodiprincGetparam(
	aorp_object_t aThis,
	struct aorp_error *anErrPtr /* = NULL */,
	int aParam,
	...
	);
DESCRIPTION
The VodiprincGetparam function returns a value of the parameter specified by the aParam argument. Depending on the type of the parameter, additional pointers may be passed to the function, which will store the current value of the parameter.
For more details on available parameters, see the section describing the VodiprincSetparam function.
RETURN VALUES
In case of success, the VodiprincGetparam function returns current value of the parameter that is greater than or equal to 0. Depending on the type of the parameter, additional pointers may be passed to the function, which will store the current value of the parameter.
Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiprincSetparam

NAME
VodiprincSetparam – set the parameter.
SYNTAX
#include <Vodi/services/Vodiprinc.h>

bo_status_t
__attribute__((nonnull(1))
VodiprincSetparam(
	aorp_object_t aThis,
	struct aorp_error *anErrPtr /* = NULL */,
	int aParam,
	...
	);
DESCRIPTION
The VodiprincSetparam function sets value to the parameter specified by the aParam parameter. Depending on the type of the parameter, additional arguments for setting the value may be passed to the function.
Available parameters:
VodiCTL_VPW_PRINCIPAL_ENABLE Enable/disable recognition. Type - int(boolean).
VodiCTL_VPW_PLATE_INVERSE_ANALYSE Enable/disable inversepicture analysis. Type - int(boolean).
VodiCTL_VPW_PLATE_PROBABILITY_MIN The minimum value of the special characteristic of the number plate to be so. Type - unsigned.
VodiCTL_VPW_PLATE_STAR_MAX The maximum number of unrecognized characters in the number plate to be so. Type - unsigned.
VodiCTL_VPW_PLATE_SIZE_MAX Maximum width of the number plate (in pixels) to be so.Type - unsigned.
VodiCTL_VPW_PLATE_SIZE_MIN Minimum width of the number plate (in pixels) to be so. Type - unsigned.
VodiCTL_VPW_ PLATE_EXTRA_ANGLE_ANALYSE Enable/disable the algorithm of processing the number plate image perspective. Type - int(boolean).
VodiCTL_VPW_PLATE_FILTER_ROFACTOR Coefficient of number plate filtration by the image density (first strategy). Type - unsigned.
VodiCTL_VPW_ PLATE_FILTER_RODROPFACTOR Coefficient of number plate filtration by the image density (second strategy). Type- unsigned.
VodiCTL_VPW_ PLATE_IMAGE_SCALE_FACTOR Coefficient of the imagesize change for further search of the number plates. Mutually exclusive with the VodiCTL_VPW_PLATE_IMAGE_SIZE parameter. Type – struct vodi_scale_factor *.
VodiCTL_VPW_PLATE_IMAGE_SIZE Necessary size of the image for further search of the number plates. Mutually exclusive with the VodiCTL_VPW_PLATE_IMAGE_SCALE_FACTOR parameter. Type - struct vodi_size *.
VodiCTL_VPW_PLATE_TEMPLATE Enable/disable the template indicated by the first argument. The second argument defines what is needed to be done (0 - disable,!0 - enable). Type of the first argument – struct vodi_vpw_country_id *. Type of the second argument - int(boolean).
VodiCTL_VPW_PLATE_FILTER_SYMCOUNT Enable/disable simple filtering algorithm of the number plate by the minimum number of possible characters in it. Type - int(boolean).
VodiCTL_VPW_IMAGE_WIDTH Width (inpixels) of the current analyzed image. Type- unsigned.
VodiCTL_VPW_IMAGE_HEIGHT Height (in pixels) of the current analyzed image. Type - unsigned.
VodiCTL_VPW_IMAGE_BRIGHTNES Prior to analysis image brightness adjustment. Is used in case of insufficient or excessive brightness. Type – int. Range of values– [-100, 100].
VodiCTL_VPW_IMAGE_CONTRAST Prior to analysis image contrast adjustment. Is used in case of insufficient or excessive contrast.Type – int. Range of values-[-100, 100].
VodiCTL_VPW_IMAGE_BLUR The recommended value is 13. Used for inner needs. Type – int.
VodiCTL_VPW_IMAGE_THRESHOLD The recommended value is 21. The binarization threshold of color pixels into black and white.Used for inner needs. Type – unsigned.
VodiCTL_VPW_IMAGE_ANALYSE_ZONE Detection zone array where presumably a number plate will appear. Type of the first argument– struct void_rect *. Type of the second argument– unsigned.
VodiCTL_VPW_IMAGE_AZONE_MASK Image-mask of the analysis zone. Type - struct vodi_image *.
VodiCTL_VPW_IMAGE_ANGLE Rotation of the original image by the angle (i.e., the entire image is rotated by an angle that would make orientation of number plates horizontal before analysis). Type – int. Range of values - [-180, 180].
VodiCTL_VPW_DYNAMIC_ENABLE Enable/disable “dynamic”mode. Type– int(boolean).
VodiCTL_VPW_DYNAMIC_OUTPUT_TIMEOUT Minimum time (in microseconds) of the number plate monitoring necessary before it can be given out to the user. Type - bo_usec_t.
VodiCTL_VPW_DYNAMIC_OUTPUT_PERIOD Time period (in microseconds) during which number plate is given out to the user. This option only takes place when VodiCTL_VPW_DYNAMIC_WITH_DUPLICATE parameter is set. Type - bo_usec_t.
VodiCTL_VPW_DYNAMIC_WITH_DUPLICATE Enable/disable periodic giving out of the number plates to the user. Type - int(boolean).
VodiCTL_VPW_ DYNAMIC_DURATION_WITHOUT_ACCESS Maximum time (in microseconds) during which the number plate is not being monitored. In the event when this time is exceeded,the number plate is considered lost and is given out to the user with VodiF_RESULT_LOSTflag. Type - bo_usec_t.
VodiCTL_VPW_LOG_SETTINGS Enable/disable writing into the log file list of all the recognition parameters. Type – int(boolean).
RETURN VALUES
In case of success, the VodiprincSetparam function returns value greater than or equal to 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiprincApplyparam

NAME
VodiprincApplyparam – apply parameters.
SYNTAX
#include <Vodi/services/Vodiprinc.h>

bo_status_t
__attribute__((nonnull(1))
VodiprincApplyparam(
	aorp_object_taThis,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiprincApplyparam function applies parameters set by the VodiprincSetparam function.
RETURN VALUES
In case of success, the VodiprincApplyparam function returns value greater than or equal to 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiprincProcess

NAME
VodiprincProcess – analyze the image.
SYNTAX
#include <Vodi/services/Vodiprinc.h>

bo_status_t
__attribute__((nonnull(1,2,7,8))
VodiprincProcess(
	aorp_object_taThis,
	struct vodi_image *anImage,
	size_t anAnalizeZonec /* = 0 */,
	struct vodi_rect const anAnalizeZonev[] /* = NULL */,
	struct vodi_ucontext const *anUserCtx /* = NULL */,
	aorp_object_t anInputEnsemble /* = NULL */,
	aorp_object_t *anOutputEnsemblePtr,
	void *Options,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiprincProcess function analyzes the image passed by the anImage parameter.
You can specify a rectangular area of the image where the function will perform the analysis. The number of such areas is specified by the anAnalizeZonec argument, and a pointer to an array of prepared rectangles is specified by the anAnalizeZonev argument. If 0 is passed as a number of areas,then the anAnalizeZonev argument is ignored, and the entire image will be analyzed.
Through the anUserCtx user context can be passed, which will be linked with each analysis result. Detailed information about user context can be found in the section about struct vodi_ucontext.
Each analysis result is stored in the ensemble, which can be passed by the anInputEnsemble argument. If the anInputEnsemble is NULL, then a new ensemble will be created.
Ensemble with analysis results is passed by the output argument anOutputEnsemblePtr.
For analysis/search of number, an additional parameter should be passed by the Optionsargument. In this case, the pointer must be on the struct void_vpw_options. Detailed information about the structure of the parameters can be found in the relevant section.
RETURN VALUES
In case of success, the VodiprincProcess function returns value greater than or equal to 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiprincFlush

NAME
VodiprincFlush – flush inner buffers.
SYNTAX
#include <Vodi/services/Vodiprinc.h>

bo_status_t
__attribute__((nonnull(1,3))
VodiprincFlush(
	aorp_object_t aThis,
	aorp_object_t anInputEnsemble /* = NULL */,
	aorp_object_t *anOutputEnsemblePtr,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiprincFlush function flushes inner buffers with analysis results in the “dynamic” mode.
Each result from the buffer is stored in the ensemble, which can be passed by the anInputEnsemble argument. If the anInputEnsemble is NULL, then a new ensemble will be created.
The results ensemble is passed by the output argument anOutputEnsemblePtr.
RETURN VALUES
In case of success, the VodiprincFlush function returns value greater than or equal to 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensCount

NAME
VodiensCount – number of results in the ensemble.
SYNTAX
#include <Vodi/services/Vodiens.h>

ssize_t
__attribute__((nonnull(1))
VodiensCount(
	aorp_object_t aThis,
	struct aorp_error *anErrPtr /* = NULL */
	);
RETURN VALUES
In case of success, the VodiensCount function returns the number of results in the ensemble.Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensClear

NAME
VodiensClear – clear the ensemble.
SYNTAX
#include <Vodi/services/Vodiens.h>

bo_status_t
__attribute__((nonnull(1))
VodiensClear(
	aorp_object_t aThis,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensClear function clears the ensemble passed by the aThis argument.In this case, the AorpRelease function is applied to all results in the ensemble.
RETURN VALUES
In case of success, theVodiensClearfunction returns value greater than or equal to 0.Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensAdd

NAME
VodiensAdd – add the result.
SYNTAX
#include <Vodi/services/Vodiens.h>

bo_status_t
__attribute__((nonnull(1,2))
VodiensAdd(
	aorp_object_taThis,
	aorp_object_taResult,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensAdd function adds the result passed by the aResultargument to the ensemble of the aThis argument.In this case, the AorpRetain function is applied for results.
RETURN VALUES
In case of success, the VodiensAdd function returns value greater than or equal to 0.Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensRemove

NAME
VodiensRemove – remove the result.
SYNTAX
#include <Vodi/services/Vodiens.h>

bo_status_t
__attribute__((nonnull(1,3))
VodiensRemove(
	aorp_object_taThis,
	bo_index_tanIndex,
	aorp_object_t *aResultPtr,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensRemove function removes results from the ensemble.
The index of the result that should be removed from the ensemble is specified by the anIndex argument (indexes start from 0).If a negative value is passed, the selection of the result will be performed from the end of the ensemble.
Removed result is stored in the output argument aResultPtr.
The AorpRetain/AorpRelease functions are not applied to the removed result.
RETURN VALUES
In case of success, the VodiensRemove function returns value greater than or equal to 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensDelete

NAME
VodiensDelete – delete the result.
SYNTAX
#include <Vodi/services/Vodiens.h>

bo_status_t
__attribute__((nonnull(1))
VodiensDelete(
	aorp_object_t aThis,
	bo_index_t anIndex,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensDelete function deletes results from the ensemble.
The index of the result that should be deleted from the ensemble is specified by the anIndex argument (indexes start from 0).If a negative value is passed, the selection of the result will be performed from the end of the ensemble.
The AorpRelease function will be applied to the selected result.
RETURN VALUES
In case of success, the VodiensDelete function returns value greater than or equal to 0.Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensGet

NAME
VodiensGet – get the result.
SYNTAX
#include <Vodi/services/Vodiens.h>

ssize_t
__attribute__((nonnull(1))
VodiensGet(
	aorp_object_t aThis,
	bo_index_t aFrom,
	bo_index_t aTo,
	size_t aCount,
	aorp_object_t aResultv[],
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensGet function selects results from the ensemble passed by the aThis argument.
Results are selected from the specified by the indexes [aFrom, aTo] range. Index with negative value points to the element located from the end of the ensemble.
The maximum number of the results that can be stored in the buffer is specified by the aCount argument. No error is produced, if the chosen number of results is greater than can be stored.
The AorpRetain/AorpRelease functions are not applied to the selected results.
RETURN VALUES
In case of success, the VodiensGet function returns selected number of the results (may be greater than specified in the aCount argument). Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensUnique

NAME
VodiensUnique – unique results.
SYNTAX
#include <Vodi/services/Vodiens.h>

ssize_t
__attribute__((nonnull(1,2))
VodiensUnique(
	aorp_object_t aThis,
	aorp_object_t aPrincipal,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensUnique function leaves only unique results in the ensemble passed by the aThis argument.
The aPrincipal argument should point to the principal with the help of which the given operation will be performed.
RETURN VALUES
In case of success, the VodiensUnique function returns the number of the remaining results. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensCombine

NAME
VodiensCombine – join the results.
SYNTAX
#include <Vodi/services/Vodiens.h>

ssize_t
__attribute__((nonnull(1,2))
VodiensCombine(
	aorp_object_t aThis,
	aorp_object_t aPrincipal,
	int anWithMerge,
	size_t anEnsc,
	aorp_object_t anEnsv[],
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensCombine function joins ensembles into one resulting passed by the aThis argument.
The aPrincipal argument should point to the principal with the help of which the given operation will be performed.
In case the value of the anWithMerge argument is 0, function will leave only unique results.
The number and array of ensembles for joining are defined by the anEnscandanEnsv arguments accordingly. Results from given ensembles will be deleted.
RETURN VALUES
In case of success, the VodiensCombine function returns the number of the remaining results. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiensCombine_v2

NAME
VodiensCombine_v2 – join the results.
SYNTAX
#include <Vodi/services/Vodiens.h>

ssize_t
__attribute__((nonnull(1,2))
VodiensCombine_v2(
	aorp_object_t aThis,
	aorp_object_t aPrincipal,
	aorp_opflags_t Flags,
	size_t anEnsc,
	aorp_object_t anEnsv[],
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
The VodiensCombine_v2 function joins ensembles into one resulting ensemble passed by the aThis argument.
The aPrincipal argument should point to the principal with the help of which the given operation will be performed.
The number and array of ensembles for joining are defined by the anEnscandanEnsv arguments accordingly. Results from given ensembles will be deleted.
The following flags may be passed into the operation by the Flags argument:
VodiensF_COMBINE_WITH_MERGE Leave only unique results.
VodiensF_COMBINE_WITH_DUP Do not delete results from ensembles passed by the anEnsv argument, make their copies.
RETURN VALUES
In case of success, the VodiensCombine_v2 function returns the number of the remaining results. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiresGetuserdata

NAME
VodiresGetuserdata – get user context.
SYNTAX
#include <Vodi/services/Vodires.h>

bo_status_t
__attribute__((nonnull(1,2))
VodiresGetuserdata(
	aorp_object_t aThis,
	struct vodi_ucontext *anUserCtx,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
VodiresGetuserdata function return user context, writing it by pointer anUserCtx.
VODI_UCONTEXT_DRetain operation doesn’t apply to the user context.
RETURN VALUES
In case of success, VodiresGetuserdata function returns value above or equal 0.Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiresSetuserdata

NAME
VodiresSetuserdata – set user context.
SYNTAX
#include <Vodi/services/Vodires.h>

bo_status_t
__attribute__((nonnull(1,2))
VodiresSetuserdata(
	aorp_object_t aThis,
	struct vodi_ucontext *anUserCtx,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
VodiresSetuserdata function sets user context transmitted by argument anUserCtx.
VODI_UCONTEXT_DRetain operation applies to the user contex.
RETURN VALUES
In case of success,VodiresSetuserdata function returns value above or equal 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiresFetchinfo

NAME
VodiresFetchinfo – read the information.
SYNTAX
#include <Vodi/services/Vodires.h>

bo_status_t
__attribute__((nonnull(1,2))
VodiresFetchinfo(
	aorp_object_t aThis,
	struct vodi_result_info *anInfo,
	struct aorp_error *anErrPtr /* = NULL */
	);
DESCRIPTION
VodiresFetchinfo function reads the information about result to buffer, specified by anInfo argument.
It demands, that ri_typefield of anInfo argument was determined. There are available the following values:
VodiK_VPW_RESULT_INFO The information about number. anInfo must point to the vodi_vpw_result_info structure.
VodiK_FCW_RESULT_INFO Reserved.
User must destroy the information that was written to buffer specified by an Info parameter by calling VodiResultInfoDestroy function for it.
RETURN VALUES
In case of success, VodiresFetchinfo function returns value above or equal 0. Otherwise, the function returns a negative value as an error status and fills the description in the structure specified by the anErrPtr argument.

VodiResultInfoDestroy

NAME
VodiResultInfoDestroy–destroy information about result.
SYNTAX
#include <Vodi/Vodilib.h>

void
__attribute__((nonnull(1))
VodiResultInfoDestroy(
	struct vodi_result_info *anInfo
	);
DESCRIPTION
VodiResultInfoDestroy function destroys information about result, specified by anInfo argument. It uses in pair with VodiresFetchinfo function.

struct void_vpw_country_id

NAME
struct vodi_vpw_country_id - identifier of the number plate template.
SYNTAX
#include <Vodi/Vpwtypes.h>

struct vodi_vpw_country_id {
	unsigned int code;
	unsigned int id;
	unsigned intsub_id;
};
DESCRIPTION
code ISO 3166.
id Template identifier(see the “Number plate templates” section for available templates). May be set to 0. In such case action will be performed on all templates for the country specified in the code field.
sub_id Reserved, should be set to 0.

struct void_image

NAME
struct vodi_image - image.
SYNTAX
#include <Vodi/Types.h>
Country code
struct vodi_image {
	unsigned      img_flags;
	long          img_width;  /* in pixels */
	long          img_height; /* in pixels */
	unsigned      img_bpp;    /* bits per pixel */
	bo_pointer_t  img_base;
};
DESCRIPTION
img_flags Set to VodiF_IMAGE_PLAIN.
img_width Width of the image.
img_height Height of the image.
img_bpp Number of bits per pixel. Setto 8.
img_base Pointer to the first row of the image. Each row of the image must be aligned to 4 bytes.

struct void_vpw_options

NAME
struct vodi_vpw_options - additional parameters for analysis.
SYNTAX
#include <Vodi/Vpwtypes.h>

struct vodi_vpw_options {
	int          magic;
	vodi_size_timgsz;      /* original-image-size */
	u_int32_t    img_seqnum; /* original image sequence mark */
	bo_utime_t img_timestamp; /* original image timestamp */
};
DESCRIPTION
magic Must be set to VodiK_VPW_OPTIONS_WORK_MAGIC.
imgsz Size of the image passed to the VodiprincProcess.
img_seqnum Sequential number of the image.
img_timestamp Timestamp of the image (in microseconds). Allows to do time analysis when monitoring number plates. Is used in the “dynamic” mode, with VodiensUnique, VodiensCombine functions in the “WithMerge” mode and VodiensCombine_v2with VodiensF_COMBINE_WITH_MERGE flag.

struct vodi_ucontext

NAME
struct vodi_ucontext – user context.
SYNTAX
#include <Vodi/Types.h>

struct vodi_ucontext {
	vodi_uctx_dup_fn uctx_dup;
	vodi_udata_retain_fn uctx_dretain;
	vodi_udata_release_fn uctx_drelease;
	vodi_uctx_change_fn    uctx_change;
	bo_pointer_t           uctx_udata;
};
DESCRIPTION
User context that can be passed to the VodiprincProcess function. It will be linked with each result when analyzing the image.
When binding context with the result, an operation specified in the uctx_dretain field is being called for context. If the value of this field is NULLF, the operation is not called.
It is sometimes necessary to duplicate an existing result when working with VodiprincProcess function. In such case, an operation specified in the uctx_dupfield is being called for linked context. If the value of this field is NULLF, the operation is not called.
When the result is destroyed,an operation specified in the uctx_drelease field is being called for linked context. If the value of this field is NULLF, the operation is not called.
In the "dynamic"operating mode the results obtained from different images are being joined. In such case, an operation specified in the uctx_change field is being called for linked context.If the value of this field is NULLF, the operation is not called.
The uctx_udata field may point to the interesting user data.

struct void_plate_info_spec

NAME
struct vodi_plate_info_spec – recognition result’s specification.
SYNTAX
#include <Bo/aorp/Vpwtypes.h>

struct vodi_plate_info_spec {
	size_t           pis_plate_variantc;
	vodi_plate_t     pis_plate_variantv[VodiL_VPW_VARIANT_MAX];

	vodi_rect_t      pis_outer_rect;
	vodi_rect_t      pis_exact_rect;
	_Bool            pis_inversed;
	vodi_motiondir_t pis_direction;
	double           pis_angle;
	double           pis_speed;
	size_t           pis_index;
	unsigned         pis_flags;
	_Bool            pis_move_in;
	size_t           pis_status;

	vodi_ucontext_t  pis_uctx;
	vodi_image_t     pis_image;

	bo_utime_t       pis_bftime;
	bo_utime_t       pis_ctime;
	bo_utime_t       pis_ltime;

	vodi_size_t      pis_imgsz;
	u_int32_t        pis_seqnum;
};
DESCRIPTION
pis_plate_variantc Number plate’s variant quantity.
pis_plate_variantv Array of number plate’s variants.
pis_outer_rect Rectangular field of number, specified relative to the image.
pis_exact_rect Rectangular field of number, specified relative to the image. Unlike the pis_outer_rect, it calculated more accurately.
pis_inversed A sign of inversion number.
pis_direction Motion direction of license plate.
pis_angle The angle of license plate.
pis_speed Motion speed of licence plate.
pis_index Identificator of licence plate.
pis_flags The following flags are available:

VodiF_RESULT_DUP Result is a duplicate. It sets in the "dynamic" operating mode with VodiCTL_VPW_DYNAMIC_WITH_DUPLICATE parameter. VodiF_RESULT_LOST Result was lost. It sets in the "dynamic" operating mode whena decision,that the object came out of the line of sight, is made. VodiF_RESULT_INVALID Result is invalid. It sets in the "dynamic"operating mode, when the decision,that this result is the consequence of a certain other, is made.

pis_move_in Reserved.
pis_status Reserved.
pis_uctx User context.
pis_image Licence plate’s image.
pis_bftime Timestamp of the best frame, there number was recognized.
pis_ctime Timestamp of the frame where number was recognized at first.
pis_ltime Timestamp of the frame where number was recognized at last.
pis_imgsz Reserved.
pis_seqnum Reserved.

struct void_plate

NAME
struct vodi_plate – license plate.
SYNTAX
#include <Bo/aorp/Vpwtypes.h>

struct vodi_plate_info {
	wchar_t     pv_plate_string[VodiL_VPW_SYMBOL_MAX + 1];
	wchar_t     pv_plate_type[VodiL_VPW_SYMBOL_MAX + 5];
	u_int32_t   pv_plate_id;
	u_int32_t   pv_country_id;
	float       pv_validity;
	float       pv_min_symb_validity;
	float       pv_max_geom_deviation;
	float       pv_max_symb_validity;
	float       pv_avg_symb_validity;
	float       pv_avg_geom_deviation;
	u_int32_t   pv_background;
	u_int32_t   pv_sym_color;
	size_t      pv_symbolc;
	vodi_plate_symbol_t  pv_symbolv[VodiL_VPW_SYMBOL_MAX];
};
DESCRIPTION
pv_plate_string Unicode string of license plate.
pv_plate_type Number’s type, specified by string:

z Small letter. Z Big letter. x Digit.| Space between symbols.

pv_plate_id Identificator of right template (see "Number plate templates")
pv_country_id Code of country ISO 3166.
pv_validity Characteristic of recognition quality.
pv_min_symb_validity Reserved.
pv_max_geom_deviation Reserved.
pv_max_symb_validity Reserved.
pv_avg_symb_validity Reserved.
pv_avg_geom_deviation Reserved.
pv_background The background color of lisence plate.
pv_sym_color The color of symbols on the lisence plate.
pv_symbolc The number of symbols on the licence plate.
pv_symbolv Array of symbols.

struct aorp_error

NAME
struct aorp_error – error description.
SYNTAX
#include <Bo/aorp/Types.h>

struct aorp_error {
	char const   *func;
	char const   *file;
	long          line;
	bo_status_t   status;
	syserrcode_t  syserr;
	unsigned      msgidx;
	unsigned      bufsz;
	char         *msg;
};
DESCRIPTION
func Name of the function where error had appeared.This is an optional field that is usually set in the debug versions of program.
file Path to the file, where the function that produced error is implemented. This is an optional field that is usually set in the debug versions of program.
line Line number in the file where error had appeared. Optional field that makes sense only if fileis not equal to NULL.
status Contains code of the error(see<Bo/Errors.h>) with a conventional area where this error had occurred.
syserr Adopted in the system code of the error. If the situation does not require you to use OS codes, use POSIX codes.
msgidx Sequential number of the message (see<Bo/SMessages.h>).
bufsz Size of the buffer (in bytes) to which msg fields are pointing.
msg Pointer to the string that describes error.

Glossary

AORP object is a representative of many AORP objects, which includeVpwprinc (principal), Vpwens (ensemble) and Vpwres (result).
Principal (Vpwprinc) is the object on which (among others)the number plates recognition operation (VodiprincProcess) is introduced.
Ensemble (Vpwens) is the list of number plate recognition results.
Result (Vpwres) represents theset ofnumber plate recognition results.
Shared library is the library of general use, also known as a dynamic library.
Archive library is the archive type library, also known as a static library.
Stub library is used in the Windows OS for linking with the shared library.

Number plate templates


In the folder /doc/templates there are folders with the name and country code, within which there are images of number plate types. The name of the image corresponds to the template identifier in the SDK. This identifier and country code are used by the struct vodi_vpw_country_id and struct vodi_plate structures.

Table of selection vpwc module according to your license

License type Module name
6 fps, 1 channel vpwc-f6p1
6 fps, 2 channels vpwc-f6p2
6 fps, 3 channels vpwc-f6p3
6 fps, 4 channels vpwc-f6p4
6 fps, 5 channels vpwc-f6p5
6 fps, 6 channels vpwc-f6p6
6 fps, 7 channels vpwc-f6p7
6 fps, 8 channels vpwc-f6p8
6 fps, 9 channels vpwc-f6p9
6 fps, 10 channels vpwc-f6p10
6 fps, 11 channels vpwc-f6p11
6 fps, 12 channels vpwc-f6p12
6 fps, 13 channels vpwc-f6p13
6 fps, 14 channels vpwc-f6p14
6 fps, 15 channels vpwc-f6p15
6 fps, 16 channels vpwc-f6p16
25 fps, 1 channel vpwc-f0p1
25 fps, 2 channels vpwc-f0p2
25 fps, 3 channels vpwc-f0p3
25 fps, 4 channels vpwc-f0p4
25 fps, 5 channels vpwc-f0p5
25 fps, 6 channels vpwc-f0p6
25 fps, 7 channels vpwc-f0p7
25 fps, 8 channels vpwc-f0p8
25 fps, 9 channels vpwc-f0p9
25 fps, 10 channels vpwc-f0p10
25 fps, 11 channels vpwc-f0p11
25 fps, 12 channels vpwc-f0p12
25 fps, 13 channels vpwc-f0p13
25 fps, 14 channels vpwc-f0p14
25 fps, 15 channels vpwc-f0p15
25 fps, 16 channels vpwc-f0p16

SDK_for_number_plate_recognition SDK_для_распознавания_номерных_знаков