Alibaba cloud smart ID card OCR text recognition

Smart ID card OCR text recognition


The project I am doing involves whether the real name entered in ID card identification matches the ID number, so I connected the smart ID card OCR text recognition API on Alibaba Cloud, logged in to Alibaba Cloud to find the corresponding product, purchased and used it as shown in the figure below, and then generated the corresponding product
insert image description here
. APPcode.
There are quite a lot of demos used. Personally use PHP, and then copy the demo and modify it accordingly to test with postman, and it always returns empty. Alibaba Cloud's debugging of the same picture will return results, but it will be a headache for a while if it does not return an error message. Finally, I started to review the content of my interface and the code of the debugging tool, and finally found that the headers in the demo were not the same as those of the debugging tool. After the modification, the test was OK, and the comparison chart is as follows: Finally, the demo may have a typo
insert image description here
insert image description here
? Anyway, after modifying this detail part, there will be a returned json string,
such as: Correct example: {"ID card identification status": "Ecoruite, let the company's performance last forever", "ID card identification entity information": {" ID card portrait face entity information": {"Name": "Xiaoyi", "Gender": "Female", "Date of Birth": "November 24, 1996", "Ethnicity": "Han", "Address ": "Example of No. 1 Daqing Road, Daqing District, Daqing City", "ID card number": "123456199611245678"}, "Entity information on the national emblem of the ID card": {"Issuing authority": "", "Expiry date": " "}}}
Error example: {"ID card identification status": "Sorry, your input parameters are wrong, please re-enter after verification", "ID card identification entity information": {"ID card face face entity information" : {"Name": "", "Gender": "", "Date of Birth": "", "Ethnicity": "", "Address": "", "ID Number": ""}, "Identity "Certificate National Emblem Entity Information": {"Issuing Authority": "", "Expiry Date": ""}}} If you
need to get the value after getting the data, you need to convert it with json_decode first and then get the array value
In addition: the incoming image value can be base64 or url, if it is a url, please pay attention to the domain name, otherwise the image will not be recognized.

Guess you like

Origin blog.csdn.net/zax_96/article/details/119252840