资讯 社区 文档
技术能力
语音技术
文字识别
人脸与人体
图像技术
语言与知识
视频技术

接口说明

图像无损放大

输入一张图片,可以在尽量保持图像质量的条件下,将图像在长宽方向各放大两倍。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.imageQualityEnhance(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.imageQualityEnhance(file, options);
    System.out.println(res.toString(2));
}

图像无损放大 请求参数详情

参数名称 是否必选 类型 说明
image mixed 本地图片路径或者图片二进制数据,大小不超过4M,长宽乘积不超过1600p x 1600px。

图像无损放大 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

图像无损放大 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

图像去雾

对浓雾天气下拍摄,导致细节无法辨认的图像进行去雾处理,还原更清晰真实的图像。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.dehaze(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.dehaze(file, options);
    System.out.println(res.toString(2));
}

图像去雾 请求参数详情

参数名称 是否必选 类型 说明
image mixed 本地图片路径或者图片二进制数据

图像去雾 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

图像去雾 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

图像对比度增强

调整过暗或者过亮图像的对比度,使图像更加鲜明。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.contrastEnhance(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.contrastEnhance(file, options);
    System.out.println(res.toString(2));
}

图像对比度增强 请求参数详情

参数名称 是否必选 类型 说明
image mixed 本地图片路径或者图片二进制数据

图像对比度增强 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

图像对比度增强 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

黑白图像上色

智能识别黑白图像内容并填充色彩,使黑白图像变得鲜活。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.colourize(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.colourize(file, options);
    System.out.println(res.toString(2));
}

黑白图像上色 请求参数详情

参数名称 是否必选 类型 说明
image mixed 本地图片路径或者图片二进制数据,大小不超过4M,最短边至少64px,最长边最大800px,长宽比3:1以内。

黑白图像上色 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

黑白图像上色 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

拉伸图像恢复

自动识别过度拉伸的图像,将图像内容恢复成正常比例。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.stretchRestore(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.stretchRestore(file, options);
    System.out.println(res.toString(2));
}

拉伸图像恢复 请求参数详情

参数名称 是否必选 类型 说明
image mixed 本地图片路径或者图片二进制数据

拉伸图像恢复 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

拉伸图像恢复 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

图像风格转换

可将图像转化成卡通画、铅笔画、彩色铅笔画,或者哥特油画、彩色糖块油画、呐喊油画、神奈川冲浪里油画、奇异油画、薰衣草油画等共计9种风格,可用于开展趣味活动,或集成到美图应用中对图像进行风格转换。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    """ 如果有可选参数 """
    options.put("option", "cartoon");

    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.styleTrans(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.styleTrans(file, options);
    System.out.println(res.toString(2));
}

图像风格转换 请求参数详情

参数 是否必选 类型 可选值范围 说明
image true string - base64编码后大小不超过4M,像素乘积不超过2000*2000,最短边至少50px,最长边最大4096px,长宽比3:1以内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)
option true string cartoon
pencil
color_pencil
warm
wave
lavender
mononoke
scream
gothic
cartoon:卡通画风格
pencil:铅笔风格
color_pencil:彩色铅笔画风格
warm:彩色糖块油画风格
wave:神奈川冲浪里油画风格
lavender:薰衣草油画风格
mononoke:奇异油画风格
scream:呐喊油画风格
gothic:哥特油画风格

图像风格转换 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

图像风格转换 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

人物动漫化

运用世界领先的对抗生成网络,结合人脸检测、头发分割、人像分割等技术,为用户量身定制千人千面的二次元动漫形象,并且可通过参数设置,生成戴口罩的二次元动漫人像。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    """ 如果有可选参数 """
    options.put("type", "anime");
    options.put("mask_id", 3);

    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.selfieAnime(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.selfieAnime(file, options);
    System.out.println(res.toString(2));
}

人物动漫化 请求参数详情

参数 是否必选 类型 可选值范围 说明
image true string - 需要处理的图片base64编码后大小不超过4M,最短边至少64px,最长边最大4096px,长宽比3:1以内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)
type false string - anime或者anime_mask。前者生成二次元动漫图,后者生成戴口罩的二次元动漫人像
mask_id false int 1-8 在type参数填入anime_mask时生效,1~8之间的整数,用于指定所使用的口罩的编码。type参数没有填入anime_mask,或mask_id 为空时,生成不戴口罩的二次元动漫图。

人物动漫化 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string 处理后图片的Base64编码

人物动漫化 返回示例

{
     "log_id":739539874,
     "image":base64str
}

天空分割

可智能分割出天空边界位置,输出天空和其余背景的灰度图和二值图,可用于图像二次处理,进行天空替换、抠图等图片编辑场景。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.skySeg(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.skySeg(file, options);
    System.out.println(res.toString(2));
}

天空分割 请求参数详情

参数 是否必选 类型 可选值范围 说明
image true string - 图像数据,base64编码后进行urlencode,要求base64编码和urlencode后大小不超过4M,最短边至少64px,最长边最大2049 px,像素乘积不超过2049*2049,长宽比3:1以内,支持jpg/png/bmp格式 。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)去掉编码头后再进行urlencode。

天空分割 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
scoremap string 分割结果的灰度图,base64编码字符串。每个像素的取值范围是0-255的整数,可以近似于概率,值越大表示越可能是天空。
labelmap string 分割结果的二值图,base64编码字符串。每个像素值是0或1,0表示背景,1表示天空。

天空分割 返回示例

{
    "labelmap": "处理后图片的二值图base64编码字符串",
    "log_id": "1262724512684703744",
    "scoremap": "处理后图片的灰度图base64编码字符串",
    "type": "sky"
}

图像清晰度增强

对压缩后的模糊图像实现智能快速去噪,优化图像纹理细节,使画面更加自然清晰。

public void sample(AipImageProcess client) {
    // 传入可选参数调用接口
    HashMap<String, String> options = new HashMap<String, String>();
    
    // 参数为本地路径
    String image = "test.jpg";
    JSONObject res = client.imageDefinitionEnhance(image, options);
    System.out.println(res.toString(2));

    // 参数为二进制数组
    byte[] file = readFile("test.jpg");
    res = client.imageDefinitionEnhance(file, options);
    System.out.println(res.toString(2));
}

图像清晰度增强 请求参数详情

参数名称 是否必选 类型 说明
image string 需要处理的图片base64编码后大小不超过4M,最短边至少64px,最长边最大4096px,长宽比3:1以内,像素乘积不超过 1280*720。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)

图像清晰度增强 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string base64编码图片

图像清晰度增强 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}

图像修复

去除图片中不需要的遮挡物,并用背景内容填充,提高图像质量。

 public void sample(AipImageProcess client) {
        // 传入可选参数调用接口
        HashMap<String, String> options = new HashMap<String, String>();
        // [{'width': 92, 'top': 25, 'height': 36, 'left': 543}]
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("width",1);
        jsonObject.put("top",1);
        jsonObject.put("height",1);
        jsonObject.put("left",1);
        List<JSONObject> rectangle = new ArrayList<JSONObject>();
        rectangle.add(jsonObject);
        // 参数为本地路径
        String image = "test.jpg";
        JSONObject res = client.inpaintingByMask(image, rectangle, options);
        System.out.println(res.toString(2));

        // 参数为二进制数组
        byte[] file = readFile("test.jpg");
        res = client.inpaintingByMask(file, rectangle, options);
        System.out.println(res.toString(2));
}

图像修复 请求参数详情

参数 是否必选 类型 可选值范围 说明
rectangle true array[] [{'width': 92, 'top': 25, 'height': 36, 'left': 543}] 要去除的位置为规则矩形时,给出坐标信息,每个元素包含left, top, width, height,int 类型。
image true string - 被修复的图片base64编码后大小不超过4M,最短边至少100px,最长边最大2000px,长宽比3:1内。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)

图像修复 返回数据参数详情

字段 是否必选 类型 说明
log_id uint64 唯一的log id,用于问题定位
image string 修复后的base64编码图片

图像修复 返回示例

{
    "log_id":739539874,
    "image":"base64str"
}