OCR调用出错,怎么从本地图片识别证件号码?
发布于 5 年前 作者 yang94 4140 次浏览 来自 官方Issues


服务接口(API Name)

OcrAllInOne

根据官方OCR调用文档,调用出错(https://developers.weixin.qq.com/community/servicemarket/detail/000ce4cec24ca026d37900ed551415

				wx.serviceMarket.invokeService({
					service: 'wx79ac3de8be320b71', // 'wx_mp_appid',
					api: 'OcrAllInOne',
					data: {
						img_url: url,
						data_type: 3,
						ocr_type: 1,
					},
				}).then(res => {
					console.log('invokeService success', res)
					wx.showModal({
						title: 'cost',
						content: (Date.now() - d) + '',
					})
				}).catch(err => {
					console.log(base64);
					console.error('invokeService fail', err)
					wx.showModal({
						title: 'fail',
						content: err + '',
					})
				})

换成公网图片是可以请求的,但是如何识别本地证件文件

1 回复
data: {
    img_data: url,
    data_type: 2,
    ocr_type: 1,
}
data_type填2   img_data 通过wx.getFileManager.readFile获取
回到顶部