using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace AutoTurnOver.Utility
{
    public class ImagerHelper
    {
        public static void BodySegDemo()
        {
            var APP_ID = "19939161";
            var API_KEY = "HneGLpXGAT1mFcw1VG4SwG9D";
            var SECRET_KEY = "IXfbEm2XqSgoXXf0t6dxUZbPunnQ5SyG";

            var client = new Baidu.Aip.BodyAnalysis.Body(API_KEY, SECRET_KEY);
            client.Timeout = 60000;  // 修改超时时间
            var image = File.ReadAllBytes(@"C:\Users\lizefeng\Desktop\GLUS~)30MWMOK0{M8}8C[{R.jpg");
            // 调用人像分割，可能会抛出网络等异常，请使用try/catch捕获
            var result = client.BodySeg(image);
            Console.WriteLine(result);
            // 如果有可选参数
            var options = new Dictionary<string, object>{
            {"type", "foreground"}
        };
            // 带参数调用人像分割
            result = client.BodySeg(image, options);
            Console.WriteLine(result);
        }
    }
}
