Documentation ¶
Index ¶
- Constants
- type OCRClient
- func (oc *OCRClient) AccurateRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) AccurateRecognizeBasic(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) BankcardRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) BusinessLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) CarTypeRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) DriverLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) FormDataRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) GeneralRecognizeBasic(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) GeneralRecognizeEnhanced(image *vision.Image, params ...RequestParam) (*OCRResponse, error)deprecated
- func (oc *OCRClient) GeneralRecognizeWithLocation(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) HandWriting(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) IdCardRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) IocrRecognise(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) IocrRecogniseFinance(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) LicensePlateRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) NumberRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) VATInvoiceRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) VehicleLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) VinRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- func (oc *OCRClient) WebImageRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
- type OCRResponse
- type RequestParam
- func Accuracy(opt string) RequestParam
- func CarTypeBaikeNum(baikeNum int) RequestParam
- func CarTypeTopNum(topNum int) RequestParam
- func ClassifierId(classifierId int) RequestParam
- func DetectDirection() RequestParam
- func DetectLanguage() RequestParam
- func DetectRisk() RequestParam
- func IDCardSide(side string) RequestParam
- func LanguageType(lang string) RequestParam
- func MultiDetect() RequestParam
- func NumberSingleWordPos(opt string) RequestParam
- func RecognizeGranularity() RequestParam
- func TemplateSign(templateSign string) RequestParam
- func UnifiedValidPeriod() RequestParam
- func WithParagraph() RequestParam
- func WithProbability() RequestParam
- func WithVertexesLocation() RequestParam
Constants ¶
const ( OCR_GENERAL_BASIC_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" OCR_ACCURATE_BASIC_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic" OCR_GENERAL_ENHANCED_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_enhanced" OCR_GENERAL_WITH_LOCATION_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/general" OCR_ACCURATE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate" OCR_HANDWRITING_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting" OCR_WEBIMAGE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/webimage" OCR_IDCARD_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/idcard" OCR_BANKCARD_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard" OCR_DRIVERLICENSE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/driving_license" OCR_VEHICLELICENSE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license" OCR_LICENSEPLATE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/license_plate" OCR_FORM_URL = "https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/request" OCR_VAT_INVOICE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice" OCR_IOCR_RECOGNISE_URL = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise" OCR_IOCR_RECOGNISE_FINANCE_URL = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance" OCR_VIN_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/vin_code" OCR_CAR_TYPE_URL = "https://aip.baidubce.com/rest/2.0/image-classify/v1/car" OCR_NUMBER_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/numbers" OCR_BUSINESS_LICENSE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/business_license" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OCRClient ¶
type OCRClient struct {
*gosdk.Client
}
func NewOCRClient ¶
func (*OCRClient) AccurateRecognize ¶ added in v0.2.6
func (oc *OCRClient) AccurateRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
AccurateRecognizeBasic 通用文字识别(高精度带位置版) 识别图片中的文字信息
func (*OCRClient) AccurateRecognizeBasic ¶ added in v0.2.2
func (oc *OCRClient) AccurateRecognizeBasic(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
AccurateRecognizeBasic 通用文字识别(高精度版) 识别图片中的文字信息
func (*OCRClient) BankcardRecognize ¶
func (oc *OCRClient) BankcardRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
BankcardRecognize 银行卡识别 识别银行卡的卡号并返回发卡行和卡片性质信息
func (*OCRClient) BusinessLicenseRecognize ¶ added in v0.2.7
func (oc *OCRClient) BusinessLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
营业执照识别
func (*OCRClient) CarTypeRecognize ¶ added in v0.2.7
func (oc *OCRClient) CarTypeRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
车型识别识别
func (*OCRClient) DriverLicenseRecognize ¶
func (oc *OCRClient) DriverLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
DriverLicenseRecognize 驾驶证识别 识别机动车驾驶证所有关键字段
func (*OCRClient) FormDataRecognize ¶
func (oc *OCRClient) FormDataRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
FormDataRecognize 表格文字识别 自动识别表格线及表格内容,结构化输出表头、表尾及每个单元格的文字内容
func (*OCRClient) GeneralRecognizeBasic ¶
func (oc *OCRClient) GeneralRecognizeBasic(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
GeneralRecognizeBasic 通用文字识别 识别图片中的文字信息
func (*OCRClient) GeneralRecognizeEnhanced
deprecated
func (oc *OCRClient) GeneralRecognizeEnhanced(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
GeneralRecognizeEnhanced 通用文字识别(含生僻字) 识别图片中的文字信息(包含对常见字和生僻字的识别)
Deprecated: 此API已失效,请使用AccurateRecognizeBasic代替
func (*OCRClient) GeneralRecognizeWithLocation ¶
func (oc *OCRClient) GeneralRecognizeWithLocation(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
GeneralRecognizeWithLocation 通用文字识别(含位置信息) 识别图片中的文字信息(包含文字区域的坐标信息)
func (*OCRClient) HandWriting ¶ added in v0.2.8
func (oc *OCRClient) HandWriting(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
HandWriting 手写体文字识别 识别图片中的手写文字信息 ref: https://ai.baidu.com/ai-doc/OCR/hk3h7y2qq
func (*OCRClient) IdCardRecognize ¶
func (oc *OCRClient) IdCardRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
IdCardRecognize 身份证识别 识别身份证正反面的文字信息
func (*OCRClient) IocrRecognise ¶ added in v0.2.2
func (oc *OCRClient) IocrRecognise(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
IocrRecognise 自定义模板文字识别
func (*OCRClient) IocrRecogniseFinance ¶ added in v0.2.2
func (oc *OCRClient) IocrRecogniseFinance(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
IocrRecogniseFinance 自定义模板文字识别 财会版
func (*OCRClient) LicensePlateRecognize ¶
func (oc *OCRClient) LicensePlateRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
LicensePlateRecognize 车牌识别 对小客车的车牌进行识别
func (*OCRClient) NumberRecognize ¶ added in v0.2.7
func (oc *OCRClient) NumberRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
数字识别
func (*OCRClient) VATInvoiceRecognize ¶ added in v0.2.2
func (oc *OCRClient) VATInvoiceRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
VATInvoiceRecognize 增值税发票识别
func (*OCRClient) VehicleLicenseRecognize ¶
func (oc *OCRClient) VehicleLicenseRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
VehicleLicenseRecognize 行驶证识别 识别机动车行驶证所有关键字段 默认使用高精度服务,可选快速服务ocr.Accuracy("normal")
func (*OCRClient) VinRecognize ¶ added in v0.2.7
func (oc *OCRClient) VinRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
Vin码识别
func (*OCRClient) WebImageRecognize ¶
func (oc *OCRClient) WebImageRecognize(image *vision.Image, params ...RequestParam) (*OCRResponse, error)
WebImageRecognize 网络图片识别 识别一些网络上背景复杂,特殊字体的文字
type OCRResponse ¶
type RequestParam ¶
type RequestParam func(map[string]interface{})
func Accuracy ¶
func Accuracy(opt string) RequestParam
normal 使用快速服务,1200ms左右时延;high使用高精度服务,1600ms左右时延 默认使用快速服务,有精度损失
func CarTypeTopNum ¶ added in v0.2.7
func CarTypeTopNum(topNum int) RequestParam
车型识别返回值数量,默认返回可能性top 5的车型
func ClassifierId ¶ added in v0.2.2
func ClassifierId(classifierId int) RequestParam
自定义模板文字识别 分类器Id
func DetectDirection ¶
func DetectDirection() RequestParam
是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括: - true:检测朝向; - false:不检测朝向。
func DetectRisk ¶
func DetectRisk() RequestParam
是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。 可选值:true-开启;false-不开启
func NumberSingleWordPos ¶ added in v0.2.7
func NumberSingleWordPos(opt string) RequestParam
数字识别,是否定位单字符位置
func RecognizeGranularity ¶
func RecognizeGranularity() RequestParam
是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
func TemplateSign ¶ added in v0.2.2
func TemplateSign(templateSign string) RequestParam
自定义模板文字识别 模板号
func WithVertexesLocation ¶
func WithVertexesLocation() RequestParam
是否返回文字外接多边形顶点位置,不支持单字位置。默认为false