Baidu intelligent text recognition, ID card recognition , Yes API The way and SDK The way
API The way
Baidu intelligence ( Text recognition ), Baidu API The map didn't provide OC An example of , Here you can find
- (void)OCTest:(NSString*)token { //***********post request ********************//
NSString *testURL =[NSString stringWithFormat:@"https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=%@",token];
testURL = [testURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL *url = [NSURL URLWithString:testURL];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
// Set the request method
request.HTTPMethod = @"POST";
// Set request body
UIImage *testImage = [UIImage imageNamed:@"test.jpg"];
NSData *imageData = UIImagePNGRepresentation(testImage);
NSString *baseStr = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
NSString *urlEncode= (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(
NULL,
(__bridge CFStringRef)baseStr,
NULL,
(CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",
CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))); NSLog(@"urlEncode is %@",urlEncode); NSString *str =[NSString stringWithFormat:@"image=%@&id_card_side=%@",urlEncode,@"front"];
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding]; request.HTTPBody = data;
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//
if (error) {
NSLog(@"error is %@",error);
}else
{
NSLog(@"data is %@",data);
NSDictionary *dic= [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
NSLog(@" From the analysis dic is %@",dic);
}
}];
[dataTask resume]; }
If UI No design to take pictures UI, Here we suggest you use SDK, Good stability , Efficient .
SDK The way
If the real machine runs with an error report , hold lib All the simulators in are removed .
Real machine running error 、Archive/IPA/Upload AppStore Times wrong "Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]..."
For the convenience of developers debugging ,AipBase.framework A combination of simulator and real machine architecture , Before going online , Use lipo Tool to remove the relevant architecture , Reference resources :
cd lib
# Use lipo -info You can see the included architectures
lipo -info AipBase.framework/AipBase # Architectures in the fat file: AipBase are: i386 x86_64 armv7 armv7s arm64
# remove x86_64, i386
lipo -remove x86_64 AipBase.framework/AipBase -o AipBase.framework/AipBase
lipo -remove i386 AipBase.framework/AipBase -o AipBase.framework/AipBase
lipo -remove x86_64 AipOcrSdk.framework/AipOcrSdk -o AipOcrSdk.framework/AipOcrSdk
lipo -remove i386 AipOcrSdk.framework/AipOcrSdk -o AipOcrSdk.framework/AipOcrSdk
# Look again
lipo -info AipBase.framework/AipBase # Architectures in the fat file: AipBase are: armv7 armv7s arm64
If you want to modify SDK Of UI, have access to AipOrcSdk The source code , Programming on the shoulders of giants , It's also very fragrant !
Baidu intelligence ( Text recognition ),API Picture transmission OC Code and the SDK Use more related articles
- Baidu OCR Character recognition API Use experience ===com.baidu.ocr.sdk.exception.SDKError[283604]
abnormal com.baidu.ocr.sdk.exception.SDKError[283604]App identifier unmatch. FALSE packname or bundleId.logId::303 ...
- Baidu AI Text review API Instructions
although , although , although , today : Baidu released 2019 Unaudited financial statements for the first quarter of . Baidu's revenue in this quarter 241 RMB 100 million ( About us 35.9 Billion dollars ), Year-on-year growth 15%, Remove business split revenue impact , Year-on-year growth 21%. Below market expectations 242 ...
- Baidu cloud face recognition API Face comparison
from urllib import request import base64 import requests import re import json import urllib import ...
- Baidu cloud face recognition API Face database management
from urllib import request import base64 import requests import re import json import urllib impor ...
- wordpress Baidu bear paw “ Search result mapping ” Modified code
<?php if(is_single()||is_page()){ echo '<script type="application/ld+json">{ &quo ...
- turn 《trackingjs+websocket+ Baidu face recognition API, Realize face sign in 》 technological process
First use websocket Establish communication with the background : use trackingjs Call the computer camera on the page , Monitor face , I found a face on the screen , Just turn the picture into base64 character string , adopt websocket Send to back end : Get the picture from the back end , Call 100 ...
- trackingjs+websocket+ Baidu face recognition API, Realize face sign in
I signed in for an annual meeting in the company . The lottery system . use java web It's done , Use the office space of the company app Scan the QR code to sign in , After scanning the code, the picture of this person will be displayed on the large screen . After that, the leader asked me to be a little taller , Check in with face recognition , Change the steps of scanning QR code to ...
- Free face recognition APi
Today corresponding to some free face recognition api A simple comparison is made , I think the face recognition interface developed by Baidu is the most in line with my requirements , Simple and easy to use , Easy to use . It is said that some of Baidu's access control also uses the function of face recognition , It's very powerful , And it's recognizable ...
- Baidu intelligent cloud platform calls food identification api Java Realization
Record my primary school years 2 It's smallpox 20 Recognition of dishes written in hours java Program . 1.2. Introduction to Baidu Intelligent Cloud 1.2.1 Baidu image recognition service Baidu image recognition service , Based on deep learning and large scale image training , Accurately identify the object category in the picture . Location . confidence ...
- Java Docking Baidu Intelligent Cloud face recognition
-------------------------> This article is to make a note by yourself <------------------------- Log in first or Register your own Baidu Intelligent Cloud Management Center :https:// ...
Random recommendation
- 6_Win7 Next Chrome The home page was hacked by a rogue website hao123.com Solutions after hijacking .
One was installed today PDF reader , Free of charge , You'll see , As a result, I did not cancel the default option when I installed , I was hao123 Rogue website hijacked . To be honest, it's free PDF The reader is pretty good , There is an item for you to choose from . I don't want to choose some software by default ...
- jquery Of add() Usage Summary
<!DOCTYPE html> <html> <head lang="en"> <meta charset="utf-8&quo ...
- Mysql:Forcing close of thread xxx user: 'root' Solutions for
MySQL server He died suddenly at noon . restart mysql It's all failures , It can only be solved by restarting the computer , And then it's reloaded MySQL No way , I'll hang up at night , Go and see mysql Of errorlog, Only the following information can be seen : F ...
- Get it right android The equipment IP Address
Online access android equipment IP There are many articles about address , One of them is more general , But there's a problem : Some devices default to IPv6 The address of , What that code gets is IPv6 The address of . But it's obviously not what we want , What we need IPv4 ...
- GeoHash
Searching is a problem we often encounter , I've done an algorithm like this before , In an ordered sequence (80 About ten thousand ), This batch of data is sorted by dimension from small to large , Finding the location of known data , And the corresponding operation , Because this algorithm needs to be implemented in embedded system , If it's in at one time ...
- poj 3648 2-SAT problem
Ideas : Think of each couple as antagonistic , Every abnormal relationship is a contradiction , Press 2-SAT The way to build the border . Finally, build a bride to the bridegroom's side . See the notes for details #include<iostream> #include<cs ...
- orm Frame learning mybatis
1. Each table in the database , The corresponding code In a pojo class . 2.or The mapping is in the mapper.xml In file , Appoint resultType. You can specify a defined pojo class . 3. You can use paramaterType Appoint sq ...
- mysql Of SQL_CALC_FOUND_ROWS Use
mysql Of SQL_CALC_FOUND_ROWS Use label : sqlmysqltable 2007-02-27 11:40 5073 Human reading Comment on (0) Collection report classification : Mysql Database technology ( ...
- sqlserver Database type correspondence Java Data types in
SQL Server type JDBC type (java.sql.Types) Java Language type bigint BIGINT long timestamp binary BINARY byte[] b ...
- CUP、 Memory 、 How do disks work together
IT Technology has developed to this day , What computers can do is much more complicated . So how does a computer make such a complex operation ? Not exactly , Computers do two main things , Data computing and data storage . First, let's talk about how computers calculate . All the plans we usually see ...