小程序ocr通过二进制上传识别出错openapi.ocr.vehicleLicense:fail media data missing

微信扫一扫,分享到朋友圈

小程序ocr通过二进制上传识别出错openapi.ocr.vehicleLicense:fail media data missing

 

 

//item 为 chooseImage 返回的图片 path
let buffer =wx.getFileSystemManager().readFileSync(item)
wx.cloud.callFunction({
name:‘printedTextOCR‘,
data: { buffer }
}).then(
r=>{
console.log(r)
}
)//云函数
const cloud = require(‘wx-server-sdk‘)
cloud.init()
exports.main= async (event, context) =>{returnawait cloud.openapi.ocr.printedText({
type:‘photo‘,
img: {
contentType:‘image/jpg‘,
value: event.buffer
}
}).then(r=> r).catch(e =>e)
}

报如下错误:

errCode: 41005,
errMsg:"openapi.ocr.printedText:fail media data missing hint: [Jo03914741]"

更新:云函数图片的二进制数据如下:

value: Buffer.from(event.buffer)

 

 

 

转 : https://developers.weixin.qq.com/community/develop/doc/000e0a8ba305f067ac397176b56800

 

小程序ocr通过二进制上传识别出错openapi.ocr.vehicleLicense:fail media data missing

原文地址:https://www.cnblogs.com/fps2tao/p/13377704.html

Ubuntu批量操作文件

上一篇

vuePress操作指南

下一篇

你也可能喜欢

小程序ocr通过二进制上传识别出错openapi.ocr.vehicleLicense:fail media data missing

长按储存图像,分享给朋友