ymx-baidu-ocr
    正在准备搜索索引...

    接口 IdCardScanData

    身份证识别参数

    身份证正面/反面通过 idCardFront / idCardBack 系列方法区分,无需额外指定。

    interface IdCardScanData {
        autoTimeoutMs?: number;
        captureMode?: CaptureMode;
        detectCard?: boolean;
        detectDirection?: boolean;
        detectPhoto?: boolean;
        detectPs?: boolean;
        detectQuality?: boolean;
        detectRisk?: boolean;
        detectScreenshot?: boolean;
        hideAlbum?: boolean;
        imageQuality?: number;
        returnImage?: boolean;
    }

    层级 (查看层级一览)

    索引

    属性

    autoTimeoutMs?: number

    自动采集超时时间(毫秒),仅自动采集模式生效; 超过该时间未检测到合格画面时 SDK 触发 AUTO_CAPTURE_TIMEOUT 错误

    5000
    
    captureMode?: CaptureMode

    采集模式,身份证正面/反面自动识别请使用 idCardFrontAuto / idCardBackAuto, 或设置 captureMode: 'auto'

    manual
    
    detectCard?: boolean

    是否裁剪身份证并返回切图 Base64 及位置,对应云端 API 参数 detect_card

    false
    
    detectDirection?: boolean

    是否检测图像朝向,对应云端 API 参数 detect_direction

    false
    
    detectPhoto?: boolean

    是否检测头像照片并返回头像 Base64 及位置,对应云端 API 参数 detect_photo

    false
    
    detectPs?: boolean

    是否检测身份证是否被 PS 篡改,仅 v3 版接口支持,对应云端 API 参数 detect_ps

    false
    
    detectQuality?: boolean

    是否返回图片质量信息(清晰度、遮挡等),对应云端 API 参数 detect_quality

    false
    
    detectRisk?: boolean

    是否检测身份证风险类型(复印件、翻拍等),对应云端 API 参数 detect_risk

    false
    
    detectScreenshot?: boolean

    是否细分输出截屏风险,需 detectRisk=true 才生效,对应云端 API 参数 detect_screenshot

    false
    
    hideAlbum?: boolean

    是否隐藏从相册选图的按钮,默认显示相册选图按钮,设为 true 时隐藏

    false
    
    imageQuality?: number

    JPEG 压缩质量(0-100),用于请求图片编码,不作为 API 请求字段

    90
    
    returnImage?: boolean

    是否在返回结果中附带采集图片(JPEG 格式的 Base64 编码), 开启后会增加一次图片编码耗时,仅在业务需要展示/回传识别图片时开启

    false