qfedu-basic-level/day13/LPR/ocr.h

1552 lines
69 KiB
C
Raw Normal View History

/**
* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* @author baidu aip
*/
#ifndef __AIP_OCR_H__
#define __AIP_OCR_H__
#include "base/base.h"
namespace aip {
class Ocr: public AipBase
{
public:
std::string _medical_detail =
"https://aip.baidubce.com/rest/2.0/ocr/v1/medical_detail";
std::string _weight_note =
"https://aip.baidubce.com/rest/2.0/ocr/v1/weight_note";
std::string _online_taxi_itinerary =
"https://aip.baidubce.com/rest/2.0/ocr/v1/online_taxi_itinerary";
std::string _invoice =
"https://aip.baidubce.com/rest/2.0/ocr/v1/invoice";
std::string _passport =
"https://aip.baidubce.com/rest/2.0/ocr/v1/passport";
std::string _air_ticket =
"https://aip.baidubce.com/rest/2.0/ocr/v1/air_ticket";
std::string _household_register =
"https://aip.baidubce.com/rest/2.0/ocr/v1/household_register";
std::string _vehicle_certificate =
"https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_certificate";
std::string _vehicle_invoice =
"https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_invoice";
std::string _qrcode =
"https://aip.baidubce.com/rest/2.0/ocr/v1/qrcode";
std::string _doc_analysis_office =
"https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office";
std::string _handwriting =
"https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting";
std::string _doc_analysis =
"https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis";
std::string _meter =
"https://aip.baidubce.com/rest/2.0/ocr/v1/meter";
std::string _webimage_loc =
"https://aip.baidubce.com/rest/2.0/ocr/v1/webimage_loc";
std::string _seal =
"https://aip.baidubce.com/rest/2.0/ocr/v1/seal";
std::string _general_basic =
"https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic";
std::string _accurate_basic =
"https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic";
std::string _general =
"https://aip.baidubce.com/rest/2.0/ocr/v1/general";
std::string _accurate =
"https://aip.baidubce.com/rest/2.0/ocr/v1/accurate";
std::string _general_enhanced =
"https://aip.baidubce.com/rest/2.0/ocr/v1/general_enhanced";
std::string _webimage =
"https://aip.baidubce.com/rest/2.0/ocr/v1/webimage";
std::string _idcard =
"https://aip.baidubce.com/rest/2.0/ocr/v1/idcard";
std::string _bankcard =
"https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard";
std::string _driving_license =
"https://aip.baidubce.com/rest/2.0/ocr/v1/driving_license";
std::string _vehicle_license =
"https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license";
std::string _license_plate =
"https://aip.baidubce.com/rest/2.0/ocr/v1/license_plate";
std::string _business_license =
"https://aip.baidubce.com/rest/2.0/ocr/v1/business_license";
std::string _receipt =
"https://aip.baidubce.com/rest/2.0/ocr/v1/receipt";
std::string _table_recognize =
"https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/request";
std::string _table_result_get =
"https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/get_request_result";
std::string _vat_invoice =
"https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice";
std::string _taxi_receipt =
"https://aip.baidubce.com/rest/2.0/ocr/v1/taxi_receipt";
std::string _vin_code =
"https://aip.baidubce.com/rest/2.0/ocr/v1/vin_code";
std::string _numbers =
"https://aip.baidubce.com/rest/2.0/ocr/v1/numbers";
std::string _train_ticket =
"https://aip.baidubce.com/rest/2.0/ocr/v1/train_ticket";
Ocr(const std::string & app_id, const std::string & ak, const std::string & sk): AipBase(app_id, ak, sk)
{
}
/**
* general_basic
*
* @param image 使aip::get_file_content函数获取
* options :
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* probability
*/
Json::Value general_basic(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general_basic, null, data, null);
return result;
}
/**
* general_basic_url
*
* @param url URLURL长度不超过1024字节URL对应的图片base64编码后大小不超过4M15px4096px,jpg/png/bmp格式image字段存在时url字段失效
* options :
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* probability
*/
Json::Value general_basic_url(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general_basic, null, data, null);
return result;
}
/**
* accurate_basic
* 使QQ群631977213
* @param image 使aip::get_file_content函数获取
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
* probability
*/
Json::Value accurate_basic(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_accurate_basic, null, data, null);
return result;
}
/**
* general
*
* @param image 使aip::get_file_content函数获取
* options :
* recognize_granularity bigsmall
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* vertexes_location false
* probability
*/
Json::Value general(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general, null, data, null);
return result;
}
/**
* general_url
*
* @param url URLURL长度不超过1024字节URL对应的图片base64编码后大小不超过4M15px4096px,jpg/png/bmp格式image字段存在时url字段失效
* options :
* recognize_granularity bigsmall
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* vertexes_location false
* probability
*/
Json::Value general_url(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general, null, data, null);
return result;
}
/**
* accurate
* 使QQ群631977213
* @param image 使aip::get_file_content函数获取
* options :
* recognize_granularity bigsmall
* detect_direction false90/180/270:<br/>- true<br/>- false
* vertexes_location false
* probability
*/
Json::Value accurate(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_accurate, null, data, null);
return result;
}
/**
* general_enhanced
* 使
* @param image 使aip::get_file_content函数获取
* options :
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* probability
*/
Json::Value general_enhanced(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general_enhanced, null, data, null);
return result;
}
/**
* general_enhanced_url
* 使
* @param url URLURL长度不超过1024字节URL对应的图片base64编码后大小不超过4M15px4096px,jpg/png/bmp格式image字段存在时url字段失效
* options :
* language_type CHN_ENG<br/>- CHN_ENG<br/>- ENG<br/>- POR<br/>- FRE<br/>- GER<br/>- ITA<br/>- SPA西<br/>- RUS<br/>- JAP<br/>- KOR
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
* probability
*/
Json::Value general_enhanced_url(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_general_enhanced, null, data, null);
return result;
}
/**
* webimage
*
* @param image 使aip::get_file_content函数获取
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
*/
Json::Value webimage(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_webimage, null, data, null);
return result;
}
/**
* webimage_url
*
* @param url URLURL长度不超过1024字节URL对应的图片base64编码后大小不超过4M15px4096px,jpg/png/bmp格式image字段存在时url字段失效
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_language
*/
Json::Value webimage_url(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_webimage, null, data, null);
return result;
}
/**
* idcard
*
* @param image 使aip::get_file_content函数获取
* @param id_card_side frontback
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
* detect_risk ()false:true-false-
*/
Json::Value idcard(
std::string const & image,
std::string const & id_card_side,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
data["id_card_side"] = id_card_side;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_idcard, null, data, null);
return result;
}
/**
* bankcard
*
* @param image 使aip::get_file_content函数获取
* options :
*/
Json::Value bankcard(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_bankcard, null, data, null);
return result;
}
/**
* driving_license
*
* @param image 使aip::get_file_content函数获取
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
*/
Json::Value driving_license(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_driving_license, null, data, null);
return result;
}
/**
* vehicle_license
*
* @param image 使aip::get_file_content函数获取
* options :
* detect_direction false90/180/270:<br/>- true<br/>- false
* accuracy normal 使1200ms左右时延使1600ms左右时延
*/
Json::Value vehicle_license(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vehicle_license, null, data, null);
return result;
}
/**
* license_plate
*
* @param image 使aip::get_file_content函数获取
* options :
*/
Json::Value license_plate(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_license_plate, null, data, null);
return result;
}
/**
* business_license
*
* @param image 使aip::get_file_content函数获取
* options :
*/
Json::Value business_license(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_business_license, null, data, null);
return result;
}
/**
* receipt
*
* @param image 使aip::get_file_content函数获取
* options :
* recognize_granularity bigsmall
* probability
* accuracy normal 使1200ms左右时延使1600ms左右时延
*/
Json::Value receipt(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_receipt, null, data, null);
return result;
}
/**
* table_recognize
* 线API
* @param image 使aip::get_file_content函数获取
* options :
*/
Json::Value table_recognize(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_table_recognize, null, data, null);
return result;
}
/**
* table_result_get
*
* @param request_id request id
* options :
* result_type excelxls文件的地址jsonjson格式的字符串,excel
*/
Json::Value table_result_get(
std::string const & request_id,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["request_id"] = request_id;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_table_result_get, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value vatInvoice(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vat_invoice, null, data, null);
return result;
}
/**
*
*
* @param image URL地址
* options :
*/
Json::Value vatInvoiceUrl(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = image;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vat_invoice, null, data, null);
return result;
}
/**
*
*
* @param image pdf文件二进制数据
* options :
*/
Json::Value vatInvoicePdf(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["pdf_file"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vat_invoice, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value taxiReceipt(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_taxi_receipt, null, data, null);
return result;
}
/**
*
*
* @param image URL地址
* options :
*/
Json::Value taxiReceiptUrl(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = image;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_taxi_receipt, null, data, null);
return result;
}
/**
*
* vin码识别
* @param image
* options :
*/
Json::Value vinCode(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vin_code, null, data, null);
return result;
}
/**
*
* vin
* @param image URL地址
* options :
*/
Json::Value vinCodeUrl(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = image;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vin_code, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value trainTicket(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_train_ticket, null, data, null);
return result;
}
/**
*
*
* @param image URL地址
* options :
*/
Json::Value trainTicketUrl(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = image;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_train_ticket, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value numbers(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_numbers, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value seal(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_seal, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
* detect_direction false90/180/270
* probability false
* poly_location 4false
* recognize_granularity bigsmall
*/
Json::Value webimageloc(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_webimage_loc, null, data, null);
return result;
}
/**
*
*
* @param url URL
* options :
* detect_direction false90/180/270
* probability false
* poly_location 4false
* recognize_granularity bigsmall
*/
Json::Value webimagelocurl(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_webimage_loc, null, data, null);
return result;
}
/**
*
* 广
* @param image
* options :
* probability false
* poly_location false
*/
Json::Value meter(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_meter, null, data, null);
return result;
}
/**
*
* OCR识别结果
* @param url url
* options :
* language_type CHN_ENG CHN_ENG ENG
* result_type big
* detect_direction false90/180/270
* line_probability false
* words_type
* layout_analysis
*/
Json::Value docanalysisurl(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_doc_analysis, null, data, null);
return result;
}
/**
*
* 90%
* @param image
* options :
* recognize_granularity bigsmall
* probability false
* detect_direction false90/180/270
*/
Json::Value handwriting(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_handwriting, null, data, null);
return result;
}
/**
*
* OCR识别结果
* @param image
* options :
* language_type CHN_ENG CHN_ENG ENG
* result_type big
* detect_direction false90/180/270
* line_probability false
* words_type
* layout_analysis
* erase_seal
*/
Json::Value docanalysisoffice(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_doc_analysis_office, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
* recognize_granularity bigsmall&probability
*/
Json::Value qrcode(
std::string const & image,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_qrcode, null, data, null);
return result;
}
/**
*
* 广
* @param url url地址
* options :
* probability false
* poly_location false
*/
Json::Value meterurl(
std::string const & url,
const std::map<std::string, std::string> & options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_meter, null, data, null);
return result;
}
/**
*
*
* @param url URL
* options :
*/
Json::Value qrcodeUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_qrcode, null, data, null);
return result;
}
/**
*
* 23
* @param image
* options :
* multi_detect ,false
*/
Json::Value docAnalysis(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_doc_analysis, null, data, null);
return result;
}
/**
*
* 23
* @param url URL
* options :
* multi_detect ,false
*/
Json::Value docAnalysisUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_doc_analysis, null, data, null);
return result;
}
/**
*
* 26
* @param image
* options :
*/
Json::Value vehicleInvoice(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vehicle_invoice, null, data, null);
return result;
}
/**
*
* 26
* @param url URL
* options :
*/
Json::Value vehicleInvoiceUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vehicle_invoice, null, data, null);
return result;
}
/**
*
* 23
* @param image
* options :
* language_type CHN_ENG * result_type big
* detect_direction false * line_probability false
* words_type
*/
Json::Value vehicleCertificate(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vehicle_certificate, null, data, null);
return result;
}
/**
*
* 23
* @param url URL
* options :
* language_type CHN_ENG * result_type big
* detect_direction false * line_probability false
* words_type
*/
Json::Value vehicleCertificateUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_vehicle_certificate, null, data, null);
return result;
}
/**
*
* 22
* @param image
* options :
*/
Json::Value householdRegister(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_household_register, null, data, null);
return result;
}
/**
*
* 22
* @param url URL
* options :
*/
Json::Value householdRegisterUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_household_register, null, data, null);
return result;
}
/**
*
*
* @param url URL
* options :
* recognize_granularity * probability false
* detect_direction false
*/
Json::Value handwritingUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_handwriting, null, data, null);
return result;
}
/**
*
* 24
* @param image
* options :
* multi_detect ,false
*/
Json::Value airTicket(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_air_ticket, null, data, null);
return result;
}
/**
*
* 24
* @param url URL
* options :
* multi_detect ,false
*/
Json::Value airTicketUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_air_ticket, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
* location truefalsefalse
*/
Json::Value invoice(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_invoice, null, data, null);
return result;
}
/**
*
*
* @param url URL
* options :
* location truefalsefalse
*/
Json::Value invoiceUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_invoice, null, data, null);
return result;
}
/**
*
*
* @param image
* options :
*/
Json::Value passport(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_passport, null, data, null);
return result;
}
/**
*
*
* @param url URL
* options :
*/
Json::Value passportUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_passport, null, data, null);
return result;
}
/**
*
*
16
* @param image
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1
*/
Json::Value onlineTaxiItinerary(
std::string image)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
Json::Value result =
this->request(_online_taxi_itinerary, null, data, null);
return result;
}
/**
*
*
16
* @param url URL路径
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1
*/
Json::Value onlineTaxiItineraryUrl(
std::string url)
{
std::map<std::string, std::string> data;
data["url"] = url;
Json::Value result =
this->request(_online_taxi_itinerary, null, data, null);
return result;
}
/**
*
*
16
* @param pdf_file pdf文件二进制数据
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1
*/
Json::Value onlineTaxiItineraryPdf(
std::string pdf_file,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["pdf_file"] = base64_encode(pdf_file.c_str(), (int) pdf_file.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_online_taxi_itinerary, null, data, null);
return result;
}
/**
*
* 8
* @param image
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1 * probability false
- false
- trueaveragemin
*/
Json::Value weightNote(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_weight_note, null, data, null);
return result;
}
/**
*
* 8
* @param url URL路径
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1 * probability false
- false
- trueaveragemin
*/
Json::Value weightNoteUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_weight_note, null, data, null);
return result;
}
/**
*
* 8
* @param pdf_file URL路径
* options :
* pdf_file_num PDF文件的对应页码 pdf_file 1 * probability false
- false
- trueaveragemin
*/
Json::Value weightNotePdf(
std::string pdf_file,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["pdf_file"] = base64_encode(pdf_file.c_str(), (int) pdf_file.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_weight_note, null, data, null);
return result;
}
/**
*
* ID
* @param image
* options :
* location false
- false
- truetopleftwidthheight
* probability false
- false
- trueaveragemin
*/
Json::Value medicalDetail(
std::string image,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["image"] = base64_encode(image.c_str(), (int) image.size());
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_medical_detail, null, data, null);
return result;
}
/**
*
* ID
* @param url URL路径
* options :
* location false
- false
- truetopleftwidthheight
* probability false
- false
- trueaveragemin
*/
Json::Value medicalDetailUrl(
std::string url,
std::map<std::string, std::string> options)
{
std::map<std::string, std::string> data;
data["url"] = url;
std::copy(options.begin(), options.end(), std::inserter(data, data.end()));
Json::Value result =
this->request(_medical_detail, null, data, null);
return result;
}
};
}
#endif