API Reference

get_deviceid

def get_deviceid() -> str:

Name

get_device_id

Description

Retrieves the Hardware ID from a library.

Input

None

Output

The Hardware ID is returned as a standard Python string.

set_activation

def set_activation(license_key: str) -> str:

Name

set_activation

Description

Activates the OCR engine using the provided license key.

Input

  • license_key (str): License key string, this should be encoded as UTF-8.

Output

A JSON-formatted string containing the result of the activation

Typically includes an "errorCode" field indicating the status of the activation.

  • 0: Success

  • Non-zero: Activation failed

init_sdk

def init_sdk(dict_path: str) -> int:

Name

init_sdk

Description

Initializes the OCR engine with the required dictionary files.

Input

  • dict_path (str): Path to the engine binary files directory, This path must be provided as a UTF-8 encoded string.

Output

A JSON-formatted string containing the result of the initialization. Typically includes an "errorCode" field indicating the status of the initialization.

  • 0: Success

  • Non-zero: Initialization failed

ocr_id_card

def ocr_id_card(file_path1: str, file_path2: str) -> str

Name

ocr_id_card

Description

Extracts data from ID card

Input

  • file_path1 (str): The path to the front image file.

  • file_path2 (str): The path to the back image file.

Output

A JSON-formatted string containing the OCR results.

Example of ID OCR results

{
	"mrz":	{
		"givenNames":"JOHN",
		"name":"DOE JOHN",
		"dateOfExpiry":"2028-12-07",
		"documentClassCode":"ID",
		"nationality":"Ukraine",
		"surname":"DOE",
		"sex":"M",
		"dateOfBirth":"1964-09-02",
		"mrzCode":"IDUKR00235423491964090245614<<^6409029M2812070UKR<<<<<<<<<<<5^DOE<<JOHN<<<<<<<<<<<<<<<<<<<<<",
		"documentNumber":"002354234",
		"issuingStateCode":"UKR",
		"validState":1
	},
	"ocr":{
		"givenNames":"IOHN",
		"name":"DOE IOHN",
		"dateOfExpiry":"2028-12-27",
		"nationality":"Ukraine",
		"surname":"DOE",
		"sex":"M",
		"dateOfBirth":"1964-09-02",
		"documentNumber":"002354234",
		"personalNumber":"1964090245614",
		"dateOfIssue":"2018-12-27",
		"authority":"7110",
		"regCertRegNumber":"3449913065",
		"placeOfBirth":"Y HRYA",
		"validState":1
	},
	"nation":{
		"name":"\xd0\x94\xd0\x9e\xd0\xa3 \xd0\x94\xd0\x96\xd0\x9e\xd0\x9d \xd0\x99\xd0\x9e\xd0\x92\xd0\x90\xd0\x9d\xd0\x9e\xd0\x92\xd0\x98\xd0\xa7",
		"surname":"\xd0\x94\xd0\x9e\xd0\xa3",
		"givenNames":"\xd0\x94\xd0\x96\xd0\x9e\xd0\x9d",
		"fathersName":"\xd0\x99\xd0\x9e\xd0\x92\xd0\x90\xd0\x9d\xd0\x9e\xd0\x92\xd0\x98\xd0\xa7",
		"nationality":"\xd0\xa3\xd0\x9a\xd0\xa0\xd0\x90\xd0\x87\xd0\x9d\xd0\x90",
		"sex":"\xd0\xa7",
		"placeOfBirth":"\xd0\xa1.\xd0\x9f\xd0\x98\xd0\x90\xd0\x93 \xd0\x92\xd0\x90\xd0\x9b"
	},
	"score":0.934643983840942,
	"position":{
		"left":0,
		"top":0,
		"right":601,
		"bottom":384
	},
	"portrait_rect":{
		"bottom":398,
		"left":21,
		"right":255,
		"top":90
	},
	"errorCode":0,
	"documentName":"Id Card",
	"countryName":"Ukraine",
	"image":{
		"ghostPortrait":"/9j/4AAQSkZJRgABAQEAxw...T680Af/9k=",
		"portrait":"/9j/4AAQSkZJRgABAQEAxwDHA...de9P70f8A8RRRTQj/2Q==",
		"signature":"/9j/4AAQSkZJRgABAQEAxwDH...AAD/2wBDAKKEJH/2Q==",
		"documentFrontSide":"/9j/4AAQSkZJRgAB...D/2wKKKKACiiigD/2Q=="
	}
}

ocr_credit_card

def ocr_credit_card(file_path: str) -> str:

Name

ocr_credit_card

Description

Etracts data from credit card

Input

  • file_path (str): The path to the credit card image file.

Output

A JSON-formatted string containing the OCR results.

ocr_barcode

def ocr_barcode(file_path: str) -> str:

Name

ocr_barcode

Description

Etracts data from barcode

Input

  • file_path (str): The path to the barcode image file.

Output

A JSON-formatted string containing the OCR results.

Last updated