首先,在百度智能云点击如下选项
之后点击立即使用,然后在应用列表创建应用,记录API Key以及Secret Key即可。
Unity中的操作:
Unity版本:2019.4.16
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using UnityEngine;
using LitJson;
using UnityEngine.UI;
using System.Text.RegularExpressions;
public class OpenCamera : MonoBehaviour
{
public Image img; //显示处理完的图片的Image组件
public string imageName; //需要处理的图片的名字例:1.png
private void Start()
{
Base64ToImg(img, body_seg());
img.preserveAspect = true;
}
// 人像分割 POST
public static String TOKEN = "";
// 百度云中开通对应服务应用的 API Key 建议开通应用的时候多选服务
private static String clientId = "注意替换";
// 百度云中开通对应服务应用的 Secret Key