代码如下:
procedure TForm1.postface2;
var
bmp: tbitmap;
i1,j1,i2,j2,h: integer;
ss,url,face_fields: string;
mem: TMemoryStream;
str1: tstringlist;
memstr: TStringStream;
//ssl: tIdSSLIOHandlerSocketOpenSSL;
w: WideString;
MyClass: TComponent;
begin
url:='https://www.aip.baidubce.com/rest/2.0/face/v2/detect?access_token=24.411d031966fac2b752bb48e6d69f432a.2592000.1543939048.282335-14634734';
face_fields:='age,beauty,expression,faceshape,gender,glasses,landmark,race,qualities';
str1:= tstringlist.Create;
str1.Add('image='+ URLEncode(ss));
str1.Add('max_face_num=1');
str1.Add('image='+ URLEncode(face_fields));
memstr:= TStringStream.Create;
idhttp1.ReadTimeout:= 65000;
idhttp1.ConnectTimeout := 65000;
idhttp1.Request.ContentType:= 'application/x-www-form-urlencoded';
try
idhttp1.Post( url,str1,memstr);
memstr.Position:= 0;
ss:= memstr.Encoding.UTF8.GetString(memstr.Bytes);
finally
str1.Free;
memstr.Free;
end;
end;
错误提示:错误代码 10060 connection time out;
肯请高手指点
用v3版本接口试试:http://ai.baidu.com/docs#/Face-Detect-V3/top