在微信小程序中先调取,小程序的wx.chooseImage()去拿本地的地址,然后再调取通用印刷体识别接口返回data:{code:-1308,message:"ERROR_DOWNLOAD_IMAGE_FAILED"},下面是我的代码
这个是小程序去调取相册的接口,返回地址
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success:function(res){
var tempFilePaths = res.tempFilePaths[0];
that.getimg(tempFilePaths)
}
})
这个是我调用通用印刷体识别接口
wx.request({
method: "POST",
url: 'http://recognition.image.myqcloud.com/ocr/general',
data: {
appid: "这是我的id",
bucket: "detect",
url: tempFilePaths
},
header: {
'Authorization': '这是签名',
"Content-Type": "application/json"
},
success: function (res) {
console.log(res)
}
})
相似问题