コード例 #1
0
ファイル: FaceApi.cs プロジェクト: Egoily/WeddingGreeting
        public static BaseResponse <FaceRegisterResult> FaceUpdate(byte[] imageByte, string groupId, string userId, FaceOption option = null)
        {
            if (imageByte.Length > 1024 * 1024 * 10)
            {
                throw new Exception("图片大小必须小于10Mb");
            }
            var imageBase64 = Convert.ToBase64String(imageByte);

            return(Execute <FaceRegisterResult>(client.UserUpdate(imageBase64, ImageType, groupId, userId, option?.Options)));
        }
コード例 #2
0
        /// <summary>
        /// 刷脸更新
        /// </summary>
        /// <param name="reqData"></param>
        /// <returns></returns>
        public XAIResFMod FMod(XAIReqFMod reqData)
        {
            LogModule.Info("XAI->BIDU:FMod--->入参:" + reqData.ToJson());
            string resJson;

            try
            {
                resJson = client.UserUpdate(reqData.Image.Split(new string[] { ";base64," }, StringSplitOptions.RemoveEmptyEntries)[1], "BASE64", reqData.GroupId, reqData.UserId).ToJson();
            }
            catch (Exception ex)
            {
                throw new XAIException(7100, "请求人脸识别服务异常,请重试!" + ex.Message);
            }
            LogModule.Info("XAI->BIDU:FMod--->出参:" + resJson);
            var res = resJson.ToEntity <BIDUResponse>();

            if (res.error_code != 0)
            {
                throw new XAIException(7100, typeof(BIDUErrorCodeEnum).GetEnumName(res.error_code.ToInt()));
            }
            return(new XAIResFMod()
            {
            });
        }