CARRIDA Python Bindings

CARRIDA Python-Bindings

For more information visit https://www.carrida-technologies.com/doc/

class alpr.Capture_type

Types of the input stream supported by the capturing library (see Capture class).

Members:

e_cap_auto

e_cap_vc_nano

e_cap_usb

e_cap_v4l2

e_cap_image_folder

e_cap_stream

e_cap_video_file

e_cap_video_folder

e_cap_ptgrey

e_cap_sentech

e_cap_avt

property name
class alpr.Distance_change_type

Vehicle moving direction with respect to the camera position.

Members:

LPR_distance_change_static

LPR_distance_change_approaching

LPR_distance_change_leaving

property name
class alpr.LPR_Roi

Image region of interest structure.

This structure contains shrink values in pixels from all image sizes

property shrink_bottom

Shrink value on the image bottom.

property shrink_left

Shrink value on the image left.

property shrink_right

Shrink value on the image right.

property shrink_top

Shrink value on the image top.

class alpr.LPR_color

Color values for license plate and its characters.

Members:

LPR_color_black

LPR_color_grey

LPR_color_white

LPR_color_blue

LPR_color_green

LPR_color_red

LPR_color_orange

LPR_color_yellow

property name
class alpr.LPR_draw_options

Draw options that are used by the visualise_plate() function.

property alpha_blending

Alpha value for blending in the visualization (default: 0.8f).

property show_characters_info

If non-zero, character positions and confidences will be shown.

property show_confidence

Show confidence value.

property show_exact_position

Draw license plate exact position if available.

property show_make_and_model

Show make and model information if available.

property show_make_and_model_confidence

Show confidence value for make and model information.

property show_region

Show plate region.

property show_state

Show state code in the output string.

property show_vehicle_class

Show vehicle class (car/truck/bus…).

property show_vehicle_class_confidence

Show vehicle class confidence value.

property show_vehicle_position

Show vehicle position.

property show_vehicle_view

Show vehicle view (front/rear).

property show_vehicle_view_confidence

Show vehicle view confidence.

class alpr.LPR_engine_configuration

CARRIDA performance modes - trade-off’s between speed and accuracy.

Members:

LPR_engine_unknown

LPR_engine_fastest

LPR_engine_fast

LPR_engine_standard

LPR_engine_high

LPR_engine_best

lpr_engine_ultimate

property name
class alpr.LPR_error_code

These are error codes that lprcarrida library can return.

Members:

LPR_SUCCESS

LPR_COULD_NOT_OPEN

LPR_NO_IMAGE

LPR_INVALID_IMAGE_TYPE

LPR_INVALID_PARAMETER

LPR_NO_DATA

LPR_INSUFFICIENT_DATA

LPR_NULL_POINTER

LPR_STDEXCEPTION_ERROR

LPR_UNKNOWN_ERROR

LPR_UNHANDLED_EXCEPTION

LPR_INVALID_ROI

LPR_ITEM_NOT_FOUND

LPR_UNSUPPORTED_OPERATION

LPR_INVALID_IMAGE_DIMENSION

LPR_NO_DONGLE

LPR_LICENSE_MISSING

LPR_INVALID_OBJECT

property name
class alpr.LPR_operation_mode

Operation mode - can be a combination of following flags.

Members:

lpr_operation_anpr

lpr_operation_make_model

lpr_operation_vehicle_classification

property name
class alpr.LPR_param_name

List of the parameters that can be set on fly or aquired using set_parameter() and get_parameter() functions.

For the description of the parameters, please refer to the https://www.carrida-technologies.com/doc/Parameter/parameters4.html manual.

Members:

LPR_param_engine_preset

LPR_param_stream_preset

LPR_param_min_plate_conf

LPR_param_min_letter_height

LPR_param_max_letter_height

LPR_param_min_letters

LPR_param_max_letters

LPR_param_max_plates

LPR_param_max_plate_angle

LPR_param_do_state_recognition

LPR_param_filter_only_digits

LPR_param_filter_only_letters

LPR_param_search_inverted

LPR_param_min_contrast

LPR_param_filter_noise

lpr_param_states_to_accept

lpr_param_states_to_reject

lpr_param_states_main

LPR_param_deinterlace

LPR_param_resize_width

LPR_param_resize_height

LPR_param_rotation

LPR_param_fine_rotation

LPR_param_mask_image

LPR_param_mask_polygon

LPR_param_border

LPR_param_use_drop_ms

LPR_param_drop_after_ms

LPR_param_buffer_size

LPR_param_drop_after_frames

LPR_param_matching_distance

lpr_param_min_detections

LPR_param_border_width_scale

LPR_param_border_height_scale

LPR_param_blocking_mode

LPR_param_reset_after_ms

LPR_param_has_make_model

LPR_param_operation_mode

LPR_param_has_vehicle_classification

LPR_param_supports_plate_finder

lpr_param_filter_non_plates

LPR_param_processors_to_use

property name
class alpr.LPR_plate_exact_position

Exact four coordinates of the license plate if available. If not available, all values will be negative (-1).

property score1

Score of upper left point

property score2

Score of upper right point

property score3

Score of lower right point

property score4

Score of lower left point

property x1

first x-coordinate (upper left)

property x2

second x-coordinate (upper right)

property x3

third x-coordinate (lower right)

property x4

fourth x-coordinate (lower left)

property y1

first y-coordinate (upper left)

property y2

second y-coordinate (upper right)

property y3

third y-coordinate (lower right)

property y4

fourth y-coordinate (lower left)

class alpr.LPR_plate_position

This structure contains all information that is relevant to the LPR::find_plates() function.

property confidence

Plate rectangle height.

property height

Plate rectangle height.

property inverted

Plate rectangle height.

property width

Plate rectangle width.

property x

Plate rectangle upper left x coordinate.

property y

Plate rectangle upper left y coordinate.

class alpr.LPR_processing_result

Output parameter of the LPR::process() function, indicating if input frame is to be processed.

Members:

LPR_processing_ok

LPR_processing_full_queue

LPR_processing_no_motion

property name
class alpr.LPR_rect_float

This is a simple float rectangle structure.

property height

Rectangle height.

property width

Rectangle width.

property x

Rectangle upper left x coordinate.

property y

Rectangle upper left y coordinate.

class alpr.LPR_rect_int

This is a simple integer rectangle structure.

property height

Rectangle height.

property width

Rectangle width.

property x

Rectangle upper left x coordinate.

property y

Rectangle upper left y coordinate.

class alpr.LPR_rotation

Rotation parameter - an image can be optionally rotated with 90 degrees step before processing begin.

Members:

LPR_rotation_none

LPR_rotation_right

LPR_rotation_left

LPR_rotation_180

LPR_rotation_flip_hor

LPR_rotation_flip_ver

property name
class alpr.LPR_stream_configuration

Presets for streaming parameters - please refer also to the documentation at https://www.carrida-technologies.com/doc/Parameter/parameters4.html.

Members:

LPR_stream_single

LPR_stream_parking

LPR_stream_offline

LPR_stream_freeflow

property name
class alpr.License_error_code

Possible error codes that can be returned by all licensing functions.

Members:

LICENSE_STATUS_OK

LICENSE_MEM_RANGE

LICENSE_INV_PROGNUM_OPT

LICENSE_INSUF_MEM

LICENSE_TMOF

LICENSE_ACCESS_DENIED

LICENSE_INCOMPAT_FEATURE

LICENSE_LICENSE_NOT_FOUND

LICENSE_TOO_SHORT

LICENSE_INV_HND

LICENSE_INV_FILEID

LICENSE_OLD_DRIVER

LICENSE_NO_TIME

LICENSE_SYS_ERR

LICENSE_NO_DRIVER

LICENSE_INV_FORMAT

LICENSE_REQ_NOT_SUPP

LICENSE_INV_UPDATE_OBJ

LICENSE_KEYID_NOT_FOUND

LICENSE_INV_UPDATE_DATA

LICENSE_INV_UPDATE_NOTSUPP

LICENSE_INV_UPDATE_CNTR

LICENSE_INV_VCODE

LICENSE_ENC_NOT_SUPP

LICENSE_INV_TIME

LICENSE_NO_BATTERY_POWER

LICENSE_NO_ACK_SPACE

LICENSE_TS_DETECTED

LICENSE_RDP_DETECTED

LICENSE_FEATURE_TYPE_NOT_IMPL

LICENSE_UNKNOWN_ALG

LICENSE_INV_SIG

LICENSE_FEATURE_NOT_FOUND

LICENSE_NO_LOG

LICENSE_LOCAL_COMM_ERR

LICENSE_UNKNOWN_VCODE

LICENSE_INV_SPEC

LICENSE_INV_SCOPE

LICENSE_TOO_MANY_KEYS

LICENSE_TOO_MANY_USERS

LICENSE_BROKEN_SESSION

LICENSE_REMOTE_COMM_ERR

LICENSE_FEATURE_EXPIRED

LICENSE_OLD_LM

LICENSE_DEVICE_ERR

LICENSE_UPDATE_BLOCKED

LICENSE_TIME_ERR

LICENSE_SCHAN_ERR

LICENSE_STORAGE_CORRUPT

LICENSE_NO_VLIB

LICENSE_INV_VLIB

LICENSE_SCOPE_RESULTS_EMPTY

LICENSE_VM_DETECTED

LICENSE_HARDWARE_MODIFIED

LICENSE_USER_DENIED

LICENSE_UPDATE_TOO_OLD

LICENSE_UPDATE_TOO_NEW

LICENSE_OLD_VLIB

LICENSE_UPLOAD_ERROR

LICENSE_INV_RECIPIENT

LICENSE_INV_ACTION

LICENSE_TOO_MANY_PRODUCTS

LICENSE_INV_PRODUCT

LICENSE_UNKNOWN_RECIPIENT

LICENSE_INV_DURATION

LICENSE_CLONE_DETECTED

LICENSE_UPDATE_ALREADY_ADDED

LICENSE_LICENSE_INACTIVE

LICENSE_NO_DETACHABLE_FEATURE

LICENSE_TOO_MANY_HOSTS

LICENSE_REHOST_NOT_ALLOWED

LICENSE_LICENSE_REHOSTED

LICENSE_REHOST_ALREADY_APPLIED

LICENSE_CANNOT_READ_FILE

LICENSE_EXTENSION_NOT_ALLOWED

LICENSE_DETACH_DISABLED

LICENSE_REHOST_DISABLED

LICENSE_DETACHED_LICENSE_FOUND

LICENSE_RECIPIENT_OLD_LM

LICENSE_SECURE_STORE_ID_MISMATCH

LICENSE_DUPLICATE_HOSTNAME

LICENSE_MISSING_LM

LICENSE_FEATURE_INSUFFICIENT_EXECUTION_COUNT

LICENSE_NO_API_DYLIB

LICENSE_INV_API_DYLIB

LICENSE_INVALID_PARAMETER

LICENSE_INVALID_OBJECT

LICENSE_ALREADY_LOGGED_IN

LICENSE_ALREADY_LOGGED_OUT

LICENSE_OPERATION_FAILED

LICENSE_NO_EXTBLOCK

LICENSE_INV_PORT_TYPE

LICENSE_INV_PORT

LICENSE_NET_DLL_BROKEN

LICENSE_NOT_IMPL

LICENSE_INT_ERR

LICENSE_FIRST_HELPER

LICENSE_FIRST_LICENSE_ACT

LICENSE_NEXT_FREE_VALUES

LICENSE_FILE_NOT_FOUND

property name
class alpr.Plate_type

Possible license plate types.

Members:

LPR_plate_type_unknown

LPR_plate_type_small

LPR_plate_type_medium

LPR_plate_type_long

property name
class alpr.Vehicle_type

Possible vehicle types.

Members:

LPR_vehicle_type_unknown

LPR_vehicle_type_private

LPR_vehicle_type_taxi

LPR_vehicle_type_export

LPR_vehicle_type_transport

LPR_vehicle_type_learner

LPR_vehicle_type_school

LPR_vehicle_type_bus

LPR_vehicle_type_police

LPR_vehicle_type_military

LPR_vehicle_type_dealer

LPR_vehicle_type_motorbike

LPR_vehicle_type_commercial

LPR_vehicle_type_classic

LPR_vehicle_type_transfer

property name
alpr.lpr_license_activate(activation: str) alpr.License_error_code

Activate using vendor license represented as large string.

alpr.lpr_license_activate_from_file(file_name: str) alpr.License_error_code

Activate using vendor license *.v2c (vendor to customer) file.

alpr.lpr_license_get_fingerprint() Tuple[alpr.License_error_code, str]

Create a fingerprint of the local machine as large string.

alpr.lpr_license_is_activated() alpr.License_error_code

Check if a license is activated.

alpr.lpr_license_save_fingerprint(file_name: str) alpr.License_error_code

Create a hardware fingerprint *.c2v (customer to vendor) request file.

alpr.lpr_license_update(activation: str) alpr.License_error_code

Update an existing license using activation string received from the vendor.

alpr.lpr_license_update_from_file(file_name: str) alpr.License_error_code

Update an existing license using vendor license *.v2c file.

class alpr.svPixelFormat

Pixel format of an Image.

Members:

GRAY8

GRAY10

GRAY16

RGB24

BGR24

BAYER_RGGB8

BAYER_RGGB10

BAYER_RGGB16

BAYER_RGGB12

YUYV

GRAY12

RAW8

RAW12

RAW16

YCbCrSP_NV12

YCbCrPlane

ARGB

RGBA

BAYER_GBGR8

BAYER_GBGR10

BAYER_GBGR16

BAYER_GBGR12

BAYER_GRGB8

BAYER_GRGB10

BAYER_GRGB16

BAYER_GRGB12

GRAY8P

GRAY10P

GRAY12P

GRAY16P

BAYER_RGGB10P

BAYER_RGGB12P

SENSOR_NATIVE

pixTypeUnknown

property name
class alpr.svcaptureErrorCode

These are error codes that svcapture library can return.

Members:

SVCAP_SUCCESS

SVCAP_ERR_COULD_NOT_OPEN

SVCAP_ERR_NULL_POINTER

SVCAP_ERR_INVALID_OBJECT

SVCAP_ERR_NO_IMAGE

SVCAP_ERR_UNSUPPORTED_IMAGE_TYPE

SVCAP_ERR_STDEXCEPTION_ERROR

SVCAP_ERR_UNHANDLED_EXCEPTION

SVCAP_ERR_INVALID_IMAGE_DIMENSION

property name

Equivalent of the CARRIDA namespace in the C++ API

class alpr.carrida.LPR

License plate recognition class.

An object of class LPR must be initialized with the configuration file as parameter and can then be used to read license plates with the process() function.

EXAMPLE:

import alpr

try:
    lpr = alpr.carrida.LPR("example.ini", None)
    images = [ # initialise svcapture images ]

    for image in images:
        results = lpr.process(image)

        # handle results
        for result in results:
            for plate in result.plates:
                print(plate.value_unicode_with_spaces)
except Exception as err:
    print(str(err))
classifier_info(self: alpr.carrida.LPR) Tuple[str, str]

Get info of the current classifier.

finish(self: alpr.carrida.LPR) List[alpr.carrida.LPR_result]

Process remaining frames and close engine.

get_capabilities(self: alpr.carrida.LPR) str

Get current engine parameters as one lage string.

get_last_results(*args, **kwargs)

Overloaded function.

  1. get_last_results(self: alpr.carrida.LPR) -> List[alpr.carrida.LPR_result]

This is a non-const overloaded variant of get_last_results function.

  1. get_last_results(self: alpr.carrida.LPR) -> List[alpr.carrida.LPR_result]

    Get latest available ANPR results (after last call of process() function).

    Each video result represents one image with corresponding timestamps and ANPR readings. Array of such results is returned as it is possible that results for sevelal successive frame has become available.

    Note: this function can to be used only in synchronous mode (if listener was not set). In asynchronous mode, listener’s result_ready() function will be called instead for each single result. When using this function in asynchronous mode, the resulting array will be always empty.

get_parameter(self: alpr.carrida.LPR, name: alpr.LPR_param_name) Union[str, int, float, float, List[int[128]], List[float[128]], List[str[128]]]

Generic function that can be used to get the value of one of the lpr parameters. For the list of currently supported parameters, see lprparameters.h.

static get_version_info() Tuple[str, str, str, str]

Returns library version, compilation date and description.

init(self: alpr.carrida.LPR, filename: str, listener: alpr.carrida.LPR_listener) None

Engine initialization.

Load the configuration file and initialize and allocate internal data structures.

If some critical error has occurred during the initialization process (e.g. the classifier file was not found), a std::exception will be thrown.

is_initialised(self: alpr.carrida.LPR) bool

Check if engine is initialised. Only initialised engine can execute process() function.

listener(self: alpr.carrida.LPR) alpr.carrida.LPR_listener

Get listener (NULL if not set).

print_license_info(self: alpr.carrida.LPR) str

Get all license parameters as string. Returns license parameters as string (max cores, max instances etc.).

process(self: alpr.carrida.LPR, image: alpr.svcapture.Image) Tuple[alpr.LPR_processing_result, List[alpr.carrida.LPR_result]]

The core function of ANPR engine that detects and reads license plates.

Returns the latest available results. NOTE: Depending on ANPR parameters specified in ini-file, (see ANPR_STREAM section parameters), current results may be related not to the current image but to one of the previous images. NOTE: If listener has been specified during the initialisation, the output of the process() function will be allways empty - instead, listener result_ready() function will be called for each single result.

process_remaining(self: alpr.carrida.LPR, arg0: bool) List[alpr.carrida.LPR_result]

Force process remaining frames in processing queue.

All images that are currently in a processing queue will be processed. After call of this function, queue will become empty. Returns all results for all remaining images in queue.

set_listener(self: alpr.carrida.LPR, arg0: alpr.carrida.LPR_listener) None

Set listener (to reset listener, set it to NULL).

set_parameter(self: alpr.carrida.LPR, name: alpr.LPR_param_name, val: Union[str, int, float, float, List[int[128]], List[float[128]], List[str[128]]]) None

Generic function to set one of the lpr parameters. For the list of currently supported parameters, see lprparameters.h.

static visualise_plate(arg0: alpr.svcapture.Image, arg1: alpr.carrida.License_plate, arg2: alpr.LPR_draw_options) None

Visualization of a license plate that was recognized by the “process” function.

The visualization can include plate bounding box, all characters bounding boxes and the recognized text.

class alpr.carrida.LPR_listener

Listener for LPR class.

To get results in asynchronous mode (immediately when results are becoming available), inherit your custom class from this one and register it in the Carrida::LPR object either during initialisation or with the help of set_listener() function. After that, each time new result becomes available, result_ready() function will be called.

result_ready(self: alpr.carrida.LPR_listener, arg0: alpr.carrida.LPR_result) None

Virtual function for collection of results, has to be overwritten.

class alpr.carrida.License_plate

License plate structure.

This structure contains all information related to one license plate. This includes bounding box position in absolute coordinates within the image, positions, values and confidences of all characters, country code, number of rows in the license plate, and optionally region, city, colour, type of both license plate and a vehicle (available information depends on a used engine).

property characters

Array of plate characters.

property color_characters

Color of license plate characters

property color_plate

Color of license plate itself

property confidence

License plate confidence [0..100].

property direction_angle

Direction angle in degrees, range is [0..360]. Negative value means that drection information is not (yet) available - e.g. if vehicle is detected only in one frame Angles are to be interpreted in clockwise direction with zero angle heading up.

property direction_type

Vehicle direction with respect to the camera position.

property ending

Ending name - for some states, ending abbreviation has some meaning, e.g. “TX” can stay for “Taxi”.

property ending_short

Ending abbreviation, analysed from last license plate letters.

property hash

Hash value of the plate text (64 bytes).

property is_first_reading

True if this is a first reading for a vehicle, false otherwise.

property is_right_to_left

This value is set to “true” for plates with right to left scripts (e.g. Arabic). In these cases output plate string has to be postprocessed by user, as CARRIDA always returns characters in left to right order.

property make

Vehicle make if available.

property make_model_confidence

Vehicle make and model confidence if available.

property model

Vehicle model if available.

property num_rows

Number of rows for this license plate (normally 1 or 2).

property plate_type

License plate type (short, medium, long).

property position

Plate position (bounding box).

property region

Region name - analysed from first license plate letters and state recognition result Note: can be empty for some states.

property region_city

Region city name - analysed from first license plate letters and state recognition result Note: can be empty for some states.

property region_short

Region abbreviation, analysed from first license plate letters.

property state

State (e.g. Germany)

property state_confidence

State confidence [0..100].

property state_string

State string as Alpha-2 code (e.g. “DE” for Germany).

property state_string_alpha3

State string as Alpha-3 code (e.g. “DEU” for Germany).

property value

Recognized license plate string.

property value_unicode

Recognized license plate string (unicode).

property value_unicode_with_spaces

Better readable version of license plate string (e.g. “ABC 123” instead of “ABC123”).

property value_without_stacked

License palte string without stacked characters (in case if stacked characters classifier was specified)

property vehicle_class

Vehicle class like car/truck/bus etc.

property vehicle_class_confidence

Vehicle class confidence value [0..100]

property vehicle_id

Id of the vehicle for this number plate - this can be useful when number plates are detected more than ones per vehicle to order them to corresponding vehicle.

property vehicle_position

Vehicle position if available

property vehicle_type

Vehicle type (private, taxi, etc.)

property vehicle_view

Vehicle view if available (front or rear)

property vehicle_view_confidence

Vehicle view confidence [0..100]

class alpr.carrida.Plate_character

Plate character structure.

This structure holds all information related to the single recognized character - bounding box position, recognized value, confidence, and row index.

class Character_property

Flags of character properties - these properties form character property.

Members:

prop_normal : No properties for this character set (default).

prop_stacked : Bit 8 is used to indicate if this is a stacked character.

prop_region : Bit 7 indicates if character represents a region, e.g. for UAE bits 1-6 are not used at the moment.

property name
property color_background

Background color.

property color_character

Character color.

property confidence

Character confidence [0..100].

property position

Character position within the image.

property prop

Aggregation of character properties.

property row

Row in which this character is found.

property value

Character value.

property value_unicode

character value in unicode format .

Equivalent of the svcapture namespace in the C++ API

class alpr.svcapture.Image

This class contains and handles all information related to one 2D image.

Object of this class contains image data (which is intern an OpenCV cv::Mat object, so full functionality of OpenCV can be used in case if OpenCV library is available), a timestamp and optionally an arbitrary description text.

Image can be either of 1 channel (greyscale), or 3 channels (BGR format is used).

channels(self: alpr.svcapture.Image) int

Get number of image channels.

Can be eigher 1 for greyscale images or 3 for bgr images.

clone(self: alpr.svcapture.Image) alpr.svcapture.Image

Get full copy of this image.

cols(self: alpr.svcapture.Image) int

Get number of image columns.

empty(self: alpr.svcapture.Image) bool

Check if image is empty.

load(*args, **kwargs)

Overloaded function.

  1. load(self: alpr.svcapture.Image, arg0: str) -> None

Load image from file (file name contains ascii characters only).

  1. load(self: alpr.svcapture.Image, arg0: str) -> None

Load image from file (file name contains unicode characters).

mat(self: alpr.svcapture.Image) numpy.ndarray

Get intern cv::Mat representation of the Image object.

property name

Optional image name.

release(self: alpr.svcapture.Image) None

Release all image data - image becomes empty.

rows(self: alpr.svcapture.Image) int

Get number of image rows.

save(*args, **kwargs)

Overloaded function.

  1. save(self: alpr.svcapture.Image, arg0: str) -> None

Save image to file (file name contains ascii characters only).

  1. save(self: alpr.svcapture.Image, arg0: str) -> None

Save image to file (file name contains unicode characters).

set(self: alpr.svcapture.Image, mat: numpy.ndarray) None

Set image data from OpenCV Mat object.

property timestamp

Image timestamp.

Indices and tables