Vehicle documents

1. Extract information of vehicle documents with image URL or pdf URL input

API:

MethodURL
GEThttps://cloud.computervision.com.vn/api/v2/ocr/vehicle

Params:

KeyValueDescription
imghttps://example.com/image.pngURL of photo or pdf
format_typeurlType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_url = 'https://example.com/image.png'
response = requests.get(
"https://cloud.computervision.com.vn/api/v2/ocr/vehicle?img=%s&format_type=url&get_thumb=false"
% image_url,
auth=(api_key, api_secret))
print(response.json())

2. Extract information of vehicle documents with image file or pdf file input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ocr/vehiclemultipart/form-data

Params:

KeyValueDescription
format_typefileType of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

KeyTypeValueDescription
imgfileexample.jpgImage file or pdf file

Demo Python:

import requests
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
image_path = '/path/to/your/image.jpg'
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ocr/vehicle?format_type=file&get_thumb=false",
auth=(api_key, api_secret),
files={'img': open(image_path, 'rb')})
print(response.json())

3. Extract information of vehicle documents with JSON input

API:

MethodURLcontent-type
POSThttps://cloud.computervision.com.vn/api/v2/ocr/vehicleapplication/json

Params:

KeyValueDescription
format_typebase64Type of data to pass in, receive value: url, file, base64
get_thumbtrue/falseReturns a aligned image

Body:

{
"img": "iVBORw0KGgoAAAANSU..." // string base64 of the image or pdf to extract
}

Demo Python:

import base64
import io
import requests
from PIL import Image
def get_byte_img(img):
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
encoded_img = base64.encodebytes(img_byte_arr.getvalue()).decode('ascii')
return encoded_img
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
img_name = "path_img"
encode_cmt = get_byte_img(Image.open(img_name))
response = requests.post(
"https://cloud.computervision.com.vn/api/v2/ocr/vehicle?format_type=base64&get_thumb=false",
auth=(api_key, api_secret),
json={'img' : encode_cmt})
print(response.json())

4. Response

The response will be a JSON with the following format:

{
"data": array,
"errorCode": string,
"errorMessage": string
}

The data field is an array, each element in the array corresponds to the information a page in a pdf file or an extracted document image.

Each element in the array will be a JSON with the following format:

{
"type": string,
"info": object
}

type: Type of document in the Vehicle documents to which information is extracted.

  • vehicle_registration_front
  • vehicle_registration_back
  • picertificate
  • driving_license

info : Including extracted information, for each type of document, there will be different information returned.

Vehicle registration front - vehicle_registration_front

  • name
  • name_confidence
  • address
  • address_confidence
  • id
  • id_confidence
  • plate
  • plate_confidence
  • issued_at
  • issued_at_confidence
  • image

Vehicle registration back - vehicle_registration_back

  • name
  • name_confidence
  • address
  • address_confidence
  • address_town_code
  • address_district_code
  • address_ward_code
  • address_town
  • address_district
  • address_ward
  • engine
  • engine_confidence
  • chassis
  • chassis_confidence
  • brand
  • brand_confidence
  • model
  • model_confidence
  • color
  • color_confidence
  • capacity
  • capacity_confidence
  • issued_at
  • issued_at_confidence
  • issued_at_code
  • last_issue_date
  • last_issue_date_confidence
  • first_issue_date
  • first_issue_date_confidence
  • plate
  • plate_confidence
  • pay_load
  • pay_load_confidence
  • year_of_manufacture
  • year_of_manufacture_confidence
  • lie
  • lie_confidence
  • sit
  • sit_confidence
  • stand
  • stand_confidence
  • image

Vehicle registry - picertificate

  • chassis_number
  • chassis_number_confidence
  • commercial_use
  • commercial_use_confidence
  • design_pay_load
  • design_pay_load_confidence
  • design_towed_mass
  • design_towed_mass_confidence
  • engine_number
  • engine_number_confidence
  • inside_cargo_container_dimension
  • inside_cargo_container_dimension_confidence
  • issued_on
  • issued_on_confidence
  • issued_on_code
  • life_time_limit
  • life_time_limit_confidence
  • manufactured_country
  • manufactured_country_confidence
  • manufactured_year
  • manufactured_year_confidence
  • mark
  • mark_confidence
  • model_code
  • model_code_confidence
  • modification
  • modification_confidence
  • permissible_no
  • permissible_no_confidence
  • regis_date
  • regis_date_confidence
  • registration_number
  • registration_number_confidence
  • seri
  • seri_confidence
  • tire_size
  • tire_size_confidence
  • type
  • type_confidence
  • valid_until
  • valid_until_confidence
  • wheel_form
  • wheel_form_confidence
  • capacity
  • capacity_confidence
  • report_number
  • report_number_confidence
  • authorized_pay_load
  • authorized_pay_load_confidence
  • lying_place
  • lying_place_confidence
  • seat_place
  • seat_place_confidence
  • stand_place
  • stand_place_confidence
  • image

Driving license - driving_license

  • id
  • name
  • dob
  • class
  • nationality
  • issue_date
  • due_date
  • address
  • address_town
  • address_district
  • address_ward
  • address_town_code
  • address_district_code
  • address_ward_code
  • id_confidence
  • name_confidence
  • dob_confidence
  • class_confidence
  • nationality_confidence
  • issue_date_confidence
  • due_date_confidence
  • address_confidence
  • id_box
  • name_box
  • dob_box
  • class_box
  • nationality_box
  • issue_date_box
  • due_date_box
  • address_box
  • image

Error code table:

CodeMessage
0Success
1The photo does not contain content
2Url is unavailable
3Incorrect image format
4Out of requests
5Incorrect api_key or api_secret
6Incorrect format type