【发布时间】:2015-12-31 07:22:47
【问题描述】:
我想使用 face.com 人脸检测 API(将图像发送到服务器并返回 xml 字符串结果)。
我使用urlread(),它无法上传图片文件。
代码:
fid = fopen('T000.jpg');
im = fread(fid,Inf,'*uint8');
fclose(fid);
urlread('http://api.face.com/faces/detect.xml','post',...
{'api_key' , MY_CODE,...
'api_secret' , MY_SECRET,...
'detector' , 'Normal',...
'attributes' , 'all',...
'file' , im})
但它返回错误,因为 MATLAB 尝试将图像编码为 url。
注意:当我在网络上使用图片时,它确实有效(因为没有上传文件)。
urlread('http://api.face.com/faces/detect.xml','post',...
{'api_key' , MY_CODE,...
'api_secret' , MY_SECRET,...
'detector' , 'Normal',...
'attributes' , 'all',...
'urls' , 'http://0.tqn.com/d/beauty/1/0/x/3/1/halle_berry_pixie.jpg'})
【问题讨论】:
-
我编辑了问题的第一个词,从“热”到“如何”。如果事实上这不是如何做某事的问题,而是表明您热衷于或承受压力做某事的声明,我深表歉意。
标签: url matlab post file-upload