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

    接口 RecognizeData

    直接图片识别(无 UI)请求参数

    不拉起相机采集页,由业务方自行获取图片后传入 SDK 完成识别, 适用于自定义相机、批量识别、服务端图片下发等场景。

    interface RecognizeData {
        imagePath?: string;
        params?: Record<string, string | number | boolean>;
        type: string;
        uri?: string;
    }
    索引

    属性

    imagePath?: string

    沙箱本地图片文件路径,与 uri 二选一,同时传入时优先使用 imagePath

    params?: Record<string, string | number | boolean>

    动态识别参数(key 为云端 API 参数名)

    • 身份证类型支持 detect_direction / detect_risk / detect_photo / detect_quality / detect_card / detect_ps / detect_screenshot / image_quality
    • 通用文字类型支持 language_type / detect_direction / detect_language / vertexes_location / recognize_granularity
    • 其余参数原样透传给服务端
    // 身份证
    { detect_direction: true, detect_risk: true }
    // 通用文字
    { language_type: 'CHN_ENG', detect_direction: true }
    // 其他类型
    { exitentrypermit_type: 'hk_mc_passport_front' }
    type: string

    识别类型(见 ScanRequestData.type 说明)

    uri?: string

    fileUri 图片路径,与 imagePath 二选一