You need to enable JavaScript to run this app.
导航

PS 检测

最近更新时间2024.02.02 17:29:33

首次发布时间2022.11.10 17:24:44

阅读本文,您可以获取 Java SDK PS 检测的接口调用示例,实现快速开发。

调用说明

  • 本文提供的接口调用示例均通过 AK 和 SK 初始化实例。
  • 接口的参数说明和错误码等信息可通过接口文档查看。

前提条件

调用接口前,请先完成 Java SDK 的安装及初始化操作。

调用示例

本节为您介绍 PS 检测相关接口的功能和调用示例。

使用 PS 检测获取结果值

您可以调用 GetImagePSDetection 接口指定服务 ID 以及原图 URI,检测图片是否被人为的 PS 修改,获取图片检测分值以及是否为正常图片。详细的参数说明可参见 GetImagePSDetection 接口文档。

接口调用示例如下所示。

package com.volcengine.example.imagex.v2.api;


import com.volcengine.model.imagex.v2.*; 
import com.volcengine.service.imagex.v2.ImagexService;

public class GetImagePSDetectionExample {
    public static void main(String[] args) {
        ImagexService service = ImagexService.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        GetImagePSDetectionQuery query = new GetImagePSDetectionQuery();
        GetImagePSDetectionBody body = new GetImagePSDetectionBody();
        
        try {
            GetImagePSDetectionRes resp = service.getImagePSDetection(query, body);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}