• 大小: 0.26M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-28
  • 语言: C#
  • 标签: 检测  百度  

资源简介

使用百度智能进行人体检测

资源截图

代码片段和文件信息

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;

namespace WindowsFormsApplication3
{
    public static class AccessToken
    {
        // 调用getAccessToken()获取的 access_token建议根据expires_in 时间 设置缓存
        // 返回token示例
        public static String TOKEN = string.Empty;


        /// 
        /// 
        /// 

        /// 百度云中开通对应服务应用的 API Key 建议开通应用的时候多选服务
        /// 百度云中开通对应服务应用的 Secret Key
        /// 
        public static String getAccessToken(String clientId String clientSecret)
        {
            try
            {
                String authHost = “https://aip.baidubce.com/oauth/2.0/token“;
                HttpClient client = new HttpClient();
                List> paraList = new List>();
                paraList.Add(new KeyValuePair(“grant_type“ “client_credentials“));
                paraList.Add(new KeyValuePair(“client_id“ clientId));
                paraList.Add(new KeyValuePair(“client_secret“ clientSecret));

                HttpResponseMessage response = client.PostAsync(authHost new FormUrlEncodedContent(paraList)).Result;
                String result = response.Content.ReadAsStringAsync().Result;
                //Console.WriteLine(result);
                AccessTokenInfo info = JsonConvert.Deserializeobject(result);
                TOKEN = info.access_token;

            }
            catch
            {

            }

            return TOKEN;
        }

    }
    public class AccessTokenInfo
    {
        public string refresh_token { get; set; }
        public int expires_in { get; set; }
        public string scope { get; set; }
        public string session_key { get; set; }
        public string access_token { get; set; }
        public string session_secret { get; set; }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-10-30 08:09  人体识别\
     目录           0  2020-10-30 08:08  人体识别\WindowsFormsApplication3\
     文件        2192  2020-10-29 16:14  人体识别\WindowsFormsApplication3\AccessToken.cs
     文件         187  2020-10-23 10:53  人体识别\WindowsFormsApplication3\App.config
     文件        1557  2020-10-29 16:29  人体识别\WindowsFormsApplication3\BodyAttr.cs
     文件        9738  2020-10-29 16:50  人体识别\WindowsFormsApplication3\Form1.Designer.cs
     文件       12878  2020-10-30 08:08  人体识别\WindowsFormsApplication3\Form1.cs
     文件        5817  2020-10-29 16:50  人体识别\WindowsFormsApplication3\Form1.resx
     文件         536  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Program.cs
     目录           0  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\
     文件        1372  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\AssemblyInfo.cs
     文件        2900  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\Resources.Designer.cs
     文件        5612  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\Resources.resx
     文件        1111  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\Settings.Designer.cs
     文件         249  2020-10-23 10:53  人体识别\WindowsFormsApplication3\Properties\Settings.settings
     文件        4284  2020-10-29 14:41  人体识别\WindowsFormsApplication3\WindowsFormsApplication3.csproj
     目录           0  2020-10-23 10:53  人体识别\WindowsFormsApplication3\bin\
     目录           0  2020-10-29 13:38  人体识别\WindowsFormsApplication3\bin\Debug\
     文件      407776  2013-10-02 12:10  人体识别\WindowsFormsApplication3\bin\Debug\Newtonsoft.Json.dll
     文件       19968  2020-10-30 08:08  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.exe
     文件         187  2020-10-23 10:53  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.exe.config
     文件       40448  2020-10-30 08:08  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.pdb
     文件       23168  2020-10-30 10:10  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.vshost.exe
     文件         187  2020-10-23 10:53  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.vshost.exe.config
     文件         490  2019-03-19 12:46  人体识别\WindowsFormsApplication3\bin\Debug\WindowsFormsApplication3.vshost.exe.manifest
     目录           0  2020-10-23 10:53  人体识别\WindowsFormsApplication3\obj\
     目录           0  2020-10-30 08:08  人体识别\WindowsFormsApplication3\obj\Debug\
     文件        8196  2020-10-23 11:37  人体识别\WindowsFormsApplication3\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        7346  2020-10-30 10:10  人体识别\WindowsFormsApplication3\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2020-10-30 10:12  人体识别\WindowsFormsApplication3\obj\Debug\TempPE\
     文件           0  2020-10-23 10:53  人体识别\WindowsFormsApplication3\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
............此处省略12个文件信息

评论

共有 条评论