Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program OCR vehicleLicense


May 20, 2021 WeChat Mini Program Development Document


Table of contents


ocr.vehicleLicense

This interface should be called on the server side, as detailed in the Service Side API.
This interface supports cloud calls. Developer tool version required . . . 1.02.1904090 (latest stable download)
wx-server-sdk >= 0.4.0

This interface provides OCR identification based on a small program

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

POST https://api.weixin.qq.com/cv/ocr/driving?type=MODE&img_url=ENCODE_URL&access_token=ACCESS_TOCKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
type string Is Picture recognition mode, photo (photo mode) or scan (scan mode)
img_url string Is To detect the picture url, pass this without passing the img parameter.
Img FormData Is Form-data media file identification, there is fileame, filelength, content-type and other information, pass this without passing img_url.

Returns a value

Object

The returned JSON packet

Property Type Description
errcode string Error code
errmsg string The error message
vehicle_type string The type of vehicle
owner string All of them
addr string Address
use_character string The nature of the use
model string Brand model
Vin string Vehicle identification generation
engine_num string Engine number
register_date string The date of registration
issue_date string The date of issue of the certificate
plate_num_b string License plate number
record string Plate
passengers_num string Approved capacity
total_quality string Total quality
totalprepare_quality_quality string The quality of the preparation

Instructions for use

Interface limits the certified subscription number, service number, enterprise number, and applet during the internal test, and the number of times is limited to 500 times / day.

Using Tips this interface for the background interface, can be based on its own business hosting situation, with small programs of photography, photo selection, etc. together, you can complete the ID photo collection, upload, identification, information return and other processes, for the need to be based on identity cards, bank cards and other physical cards or certificates, collection of photos or text information and other business scenarios.

Image caption File size limit: less than 2M

Images support the use of img parameters for real-time upload, but also img_url parameters to transmit picture addresses, by WeChat background download pictures to identify. There are two types of type

Take a picture sample

WeChat small program OCR vehicleLicense

An example of requesting data

Example 1:

curl https://api.weixin.qq.com/cv/ocr/driving?type=photo&img_url= ENCODE_URL&access_token=ACCESS_TOCKEN

Example 2:

curl -F ‘[email protected]’“https://api.weixin.qq.com/cv/ocr/driving?type=photo&access_token=ACCESS_TOCKEN”

Return an example of the data

{
"vhicle_type": "小型普通客⻋",
"owner": "东莞市xxxxx机械厂",
"addr": "广东省东莞市xxxxx号",
"use_character": "非营运",
"model": "江淮牌HFCxxxxxxx",
"vin": "LJ166xxxxxxxx51",
"engine_num": "J3xxxxx3",
"register_date": "2018-07-06",
"issue_date": "2018-07-01",
"plate_num_b": "粤xxxxx",
"record": "441xxxxxx3",
"passengers_num": "7人",
"total_quality": "2700kg",
"prepare_quality": "1995kg"
}

Cloud calls

Cloud call is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.

The interface method

openapi.ocr.vehicleLicense
Permissions for the ocr.vehicleLicense API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
type string Is Picture recognition mode, photo (photo mode) or scan (scan mode)
imgUrl string Is To detect the picture url, pass this without passing the img parameter.
Img FormData Is Form-data media file identification, there is fileame, filelength, content-type and other information, pass this without passing img_url.

The structure of img

Property Type The default Required Description
contentType string Is Data type, incoming MIME Type
value Buffer Is File Buffer

Returns a value

Object

The returned JSON packet

Property Type Description
errCode string Error code
errMsg string The error message
vehicleType string The type of vehicle
owner string All of them
addr string Address
useCharacter string The nature of the use
model string Brand model
Vin string Vehicle identification generation
engineNum string Engine number
registerDate string The date of registration
issueDate string The date of issue of the certificate
plateNumB string License plate number
record string Plate
passengersNum string Approved capacity
totalQuality string Total quality
totalprepareQualityQuality string The quality of the preparation

Abnormal

Object

The exception thrown

Property Type Description
errCode string Error code
errMsg string The error message

The legal value of errCode

Value Description The lowest version

Instructions for use

Interface Limits Subscription numbers, service numbers, enterprise numbers, and small programs that have been certified during the internal test can be called directly, with a limit of 500 times per day.

Using Tips this interface for the background interface, can be based on its own business hosting situation, with small programs of photography, photo selection, etc. together, you can complete the ID photo collection, upload, identification, information return and other processes, for the need to be based on identity cards, bank cards and other physical cards or certificates, collection of photos or text information and other business scenarios.

Image caption File size limit: less than 2M

Images support the use of img parameters for real-time upload, but also img_url parameters to transmit picture addresses, by WeChat background download pictures to identify. There are two types of type

Take a picture sample

WeChat small program OCR vehicleLicense

An example of requesting data

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.ocr.vehicleLicense({
        type: 'photo',
        imgUrl: 'ENCODE_URL'
      })
    return result
  } catch (err) {
    return err
  }
}

Or

// cloud = require('wx-server-sdk')
// ...
// 方法返回 Promise
cloud.openapi.ocr.vehicleLicense({
  type: 'photo',
  img: {
    contentType: 'image/png',
    value: Buffer
  }
})

Return an example of the data

{
"vhicle_type": "小型普通客⻋",
"owner": "东莞市xxxxx机械厂",
"addr": "广东省东莞市xxxxx号",
"use_character": "非营运",
"model": "江淮牌HFCxxxxxxx",
"vin": "LJ166xxxxxxxx51",
"engine_num": "J3xxxxx3",
"register_date": "2018-07-06",
"issue_date": "2018-07-01",
"plate_num_b": "粤xxxxx",
"record": "441xxxxxx3",
"passengers_num": "7人",
"total_quality": "2700kg",
"prepare_quality": "1995kg"
}