curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/image-quality \
--header 'Content-Type: multipart/form-data' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--form files='@example-file' \
--form material_id=8ffe03ce-4714-4b50-8daf-afee06002cc3import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/image-quality"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = { "material_id": "8ffe03ce-4714-4b50-8daf-afee06002cc3" }
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '@门诊收费票据01.png');
form.append('material_id', '8ffe03ce-4714-4b50-8daf-afee06002cc3');
const options = {
method: 'POST',
headers: {'x-ti-app-id': '<x-ti-app-id>', 'x-ti-secret-code': '<x-ti-secret-code>'}
};
options.body = form;
fetch('https://agents.textin.com/doc-agent/api/v1/capability/image-quality', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/image-quality",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/image-quality"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/image-quality")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/image-quality")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"materials": [
{
"material_id": "8ffe03ce-4714-4b50-8daf-afee06002cc3",
"pages": [
{
"page": 1,
"risk_details": {
"blurry": {
"reason": [],
"score": 0.4,
"valid": false
},
"light_spot": {
"reason": [],
"score": 0,
"valid": false
},
"photocopy": {
"reason": [],
"score": 0,
"valid": false
},
"scan": {
"reason": [],
"score": 0,
"valid": false
},
"screen_remark": {
"reason": [],
"score": 0,
"valid": false
},
"un_integrity": {
"reason": [
"数字遮挡"
],
"score": 1,
"valid": true
}
},
"risk_type": [
"un_integrity"
]
}
]
},
{
"material_id": "27734e23-3482-42a3-98d7-1bdb369118bc",
"pages": [
{
"page": 1,
"risk_details": {
"blurry": {
"reason": [],
"score": 0.4,
"valid": false
},
"light_spot": {
"reason": [],
"score": 0,
"valid": false
},
"photocopy": {
"reason": [],
"score": 0,
"valid": false
},
"scan": {
"reason": [],
"score": 0,
"valid": false
},
"screen_remark": {
"reason": [],
"score": 0,
"valid": false
},
"un_integrity": {
"reason": [
"拍摄"
],
"score": 1,
"valid": true
}
},
"risk_type": [
"un_integrity"
]
}
]
}
]
},
"message": "OK"
}图像质量检测
图像质量检测。检测项: 模糊(blurry)、不完整(un_integrity)、复印件(photocopy)、翻拍(screen_remark)、光斑(light_spot)、扫描件(scan)。
支持两种输入方式(互斥):
-
方式一:传 material_id 或 batch_id 指定已上传的材料
-
方式二:直接上传文件(multipart/form-data 或 file_urls)
同时传文件和 material_id/batch_id 会返回 400 错误。
质检模型参数通过 query string 传递,如 ?blurry_threshold=0.3&un_integrity_threshold=0.7,参数与上次质检不一致时会重新调用质检模型。
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/image-quality \
--header 'Content-Type: multipart/form-data' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--form files='@example-file' \
--form material_id=8ffe03ce-4714-4b50-8daf-afee06002cc3import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/image-quality"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = { "material_id": "8ffe03ce-4714-4b50-8daf-afee06002cc3" }
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '@门诊收费票据01.png');
form.append('material_id', '8ffe03ce-4714-4b50-8daf-afee06002cc3');
const options = {
method: 'POST',
headers: {'x-ti-app-id': '<x-ti-app-id>', 'x-ti-secret-code': '<x-ti-secret-code>'}
};
options.body = form;
fetch('https://agents.textin.com/doc-agent/api/v1/capability/image-quality', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/image-quality",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/image-quality"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/image-quality")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/image-quality")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n@门诊收费票据01.png\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"material_id\"\r\n\r\n8ffe03ce-4714-4b50-8daf-afee06002cc3\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"materials": [
{
"material_id": "8ffe03ce-4714-4b50-8daf-afee06002cc3",
"pages": [
{
"page": 1,
"risk_details": {
"blurry": {
"reason": [],
"score": 0.4,
"valid": false
},
"light_spot": {
"reason": [],
"score": 0,
"valid": false
},
"photocopy": {
"reason": [],
"score": 0,
"valid": false
},
"scan": {
"reason": [],
"score": 0,
"valid": false
},
"screen_remark": {
"reason": [],
"score": 0,
"valid": false
},
"un_integrity": {
"reason": [
"数字遮挡"
],
"score": 1,
"valid": true
}
},
"risk_type": [
"un_integrity"
]
}
]
},
{
"material_id": "27734e23-3482-42a3-98d7-1bdb369118bc",
"pages": [
{
"page": 1,
"risk_details": {
"blurry": {
"reason": [],
"score": 0.4,
"valid": false
},
"light_spot": {
"reason": [],
"score": 0,
"valid": false
},
"photocopy": {
"reason": [],
"score": 0,
"valid": false
},
"scan": {
"reason": [],
"score": 0,
"valid": false
},
"screen_remark": {
"reason": [],
"score": 0,
"valid": false
},
"un_integrity": {
"reason": [
"拍摄"
],
"score": 1,
"valid": true
}
},
"risk_type": [
"un_integrity"
]
}
]
}
]
},
"message": "OK"
}Body
批次 ID(处理批次下所有材料)
"661be601-65c7-4025-af0f-20d357dfb090"
模糊风险判定阈值。开启模糊检测后,若模型输出的模糊风险分数大于该阈值,则判定图像存在模糊风险(0~1,保留2位小数,默认 0.5)
0.5
检测范围控制参数。0 表示检测图片中的所有主体,只要任一主体存在质量风险,则整体判定为存在风险;1 表示仅检测第一个主体的质量风险情况。建议采用 0(默认 0)
0
URL 上传(与 material_id/batch_id 互斥),JSON 数组格式
"[\"https://example.com/file1.pdf\"]"
文件二进制上传(支持多文件)
光斑检测的检测级别控制参数。0 表示优先检测主体边缘与背景区域是否存在光斑;1 表示优先检测主体内容区域是否存在光斑,例如文字、印章、人像等区域是否受光斑影响(默认 0)
0
光斑风险判定阈值。开启光斑检测后,若模型输出的光斑风险分数大于该阈值,则判定图像存在光斑风险(0~1,保留2位小数,默认 0.5)
0.5
已上传材料的 ID(处理单个材料,与 files/file_urls 互斥)
"8ffe03ce-4714-4b50-8daf-afee06002cc3"
复印件风险判定阈值。开启复印件检测后,若模型输出的复印件风险分数大于该阈值,则判定图像为复印件风险(0~1,保留2位小数,默认 0.5)
0.5
扫描件风险判定阈值。开启扫描件检测后,若模型输出的扫描件风险分数大于该阈值,则判定图像存在扫描件风险(0~1,保留2位小数,默认 0.5)
0.5
翻拍风险判定阈值。开启翻拍检测后,若模型输出的翻拍风险分数大于该阈值,则判定图像存在翻拍风险(0~1,保留2位小数,默认 0.5)
0.5
完整性检测的检测级别控制参数。0 表示优先检测主体边缘与背景是否完整;1 表示优先检测主体内容是否完整,例如文字、印章、人像等区域是否缺失(默认 0)
0
完整性风险判定阈值。开启完整性检测后,若模型输出的完整性风险分数大于该阈值,则判定图像存在不完整风险。完整性风险检测包括:1.拍摄(因未拍全导致的完整性风险) 2.物理遮挡 3.数字遮挡(如马赛克) 4.物理水印(含水印文件的打印件) 5.数字水印(常规水印,如水印相机) 6.弯折 7.破损(0~1,保留2位小数,默认 0.5)
0.5