You need to enable JavaScript to run this app.
最新活动
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们
导航

PS 检测

最近更新时间2022.11.10 17:24:44

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

阅读本文,您可以快速了解 PS 检测 Java SDK 的使用方法。

初始化

调用接口前请先完成初始化,具体操作请参考初始化

使用PS检测获取结果值

以下内容支持通过指定服务 ID 以及原图 URI,检测图片是否被人为的 PS 修改,获取图片检测分值以及是否为正常图片。

说明

当前仅适用于营业执照类图像检测场景,其他图像检测类型还在持续开发中,敬请期待。

具体参数详情和返回字段请参考 GetImagePSDetection。具体示例如下所示:

package com.volcengine.example.imagex;

import com.volcengine.model.request.GetImagePSDetectionRequest;
import com.volcengine.model.response.GetImagePSDetectionResponse;
import com.volcengine.service.imagex.IImageXService;
import com.volcengine.service.imagex.impl.ImageXServiceImpl;

/**
 * 检测图像是否经过处理
 */
public class ExtensionGetImagePSDetection {
    public static void main(String[] args) {
        // 默认 ImageX 实例为 `cn-north-1`,如果您想使用其他区域的实例,请使用 `ImageXServiceImpl.GetInstance(区域名)` 显式指定区域
        IImageXService service = ImageXServiceImpl.getInstance();
        service.setAccessKey("ak");
        service.setSecretKey("sk");

        GetImagePSDetectionRequest req = new GetImagePSDetectionRequest();
        req.setServiceId("service id"); // 服务 ID
        req.setImageUri("store uri");   // 文件的 Store URI
        req.setMethod("he");            // 检查方法。all 表示调用所有方法,默认为 all;ela 表示误差水平分析方法;na 表示噪声分析方法;he 表示基于颜色分布直方图均化的图像增强分析方法

        try {
            GetImagePSDetectionResponse resp = service.getImagePSDetection(req);
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}