dsh-image-read
Manifest validDeterministic screenshot reading that never calls a vision model: fits the curves in a framed chart into equations, R² and data points (plus a CSV table, a redrawn SVG and an overlay), locates a slide
dsh-image-read
DeepSeek Harness(DSH)插件:把规则场景的图片读取做成确定性工具,供 PTC 会话连续调用。
只做几何 / 像素层面的确定性计算:图表曲线拟合、滑块缺口定位、旋转角估计、曲线路径提取、链式图片算子。不做通用视觉理解,不接 VLM。
工具
| 工具 | 输入 | 返回 |
|---|---|---|
chart_read | 图表截图 + 可选标定 | 每条曲线的方程 / R² / 预览点,以及数据表 / SVG / overlay 工件 |
captcha_slide | 背景图 + 拼图块 | 缺口左上角 x/y、score、trusted、overlay |
captcha_rotate | 待测图 + 可选参考图 | 旋转角 angle(顺时针,(-180,180])、correction、trusted |
captcha_curve | 含主曲线的图 | 有序点列 points、endpoints、length_px、bbox、overlay |
img_ops | 图 + 算子数组 | 每步尺寸 + 最终 PNG 工件 |
完整参数 / 返回 / 错误码见 INTERFACE.md。
环境
- Node.js >= 22.13(DSH 宿主)
- Python 3,依赖见
requirements.txt:pip install -r requirements.txt chart_read用仓库自带的vendor/chart2data,不需要另装;读 PDF 图表时再加pdfplumber
安装
开发期用 link: 装进 profile:
dsh plugin --profile web add link:/path/to/dsh-image-read
重启一次 dsh web(或进入下一回合)后,五个工具进入 PTC 的 tools。
chart_read 不需要再配外部 chart2data:默认指向仓库内的 vendor/chart2data。
用法
// 图表:曲线 → 方程 / 数据点
const chart = await tools.chart_read({ image: '/abs/chart.png' })
// 滑块
const slide = await tools.captcha_slide({ bg: '/abs/bg.png', slider: '/abs/piece.png' })
// 旋转(有参考图时可信)
const rot = await tools.captcha_rotate({ image: '/abs/rotated.png', reference: '/abs/upright.png' })
// 曲线
const curve = await tools.captcha_curve({ image: '/abs/curve.png' })
// 链式图片处理
const ops = await tools.img_ops({
image: '/abs/in.png',
ops: [{ op: 'rotate', angle: 90 }, { op: 'gray' }, { op: 'resize', width: 640, height: 480 }],
})
返回均为单行 JSON 字符串;ok:false 时看 error.code(E_INPUT / E_DEP / E_SLIDE / E_ROTATE / E_CURVE / E_OP 等)。
配置
所有可调值在 img.config.json:python 解释器、chart2dataRoot(默认 vendor/chart2data;相对路径按 img.config.json 所在目录解析)、workDir、各工具阈值。
自检
node acceptance/selftest.mjs
# 换自己的图表图:
CHART_FIXTURE=/path/to/chart.png node acceptance/selftest.mjs
图表用仓库自带的 acceptance/fixtures/chart/sample_plot.png;滑块 / 旋转 / 曲线夹具是合成的,可用 python3 acceptance/make_fixtures.py 重新生成。
限制
- 只针对规律场景;照片 / 不规则图不适用。
captcha_rotate无参考图时有 90° 歧义,trusted恒为false。captcha_curve假设每列单值、无自交;多曲线需先切图。captcha_slide的trusted只是分数阈值,低分不要直接拖。
目录
index.js 宿主侧工具注册
lib/bridge.js Node → Python 桥
bridge/main.py 算法实现
img.config.json 可调值
INTERFACE.md 契约
acceptance/ selftest + 合成夹具生成器
vendor/chart2data/ 图表截图 → 曲线/数据点(随仓库分发,MIT)
License
MIT。vendor/chart2data 同为本仓库作者的 MIT 代码,随仓库一起分发。
Comments
Loading…
Similar plugins
by dingchenhui0618-arch
Pixel-level screenshot diff for visual regression. Two local PNGs in; a machine-readable first line (`PIXEL_CHANGED=true|false`, greppable as an assertion), then the difference ratio, per-region bound
★ 0
MIT
JavaScript
Oct 27, 2026
dsh plugin --profile web add dsh-vision-diffby AngelosZou
A content-aware PDF reading plugin for vision models: profiles each page for figures (vector and raster), tables, formula risk and double-column layout, then applies content-aware hybrid extraction, r
★ 4
↓ 312/wk
MIT
Python
Aug 26, 2026
dsh plugin --profile web add dsh-pdf-readerby thanderming
Reads images with a vision model on the same provider when the selected model cannot see them, and passes that description to the text model.
★ 0
MIT
JavaScript
Nov 3, 2026
dsh plugin --profile web add dsh-auto-sightby cbg33695
Let a text-only model see the screen: capture desktop/window/region, vision transcription, a few minutes of rolling screen memory, exact local pixel diff, and vision self-calibration. Windows only. Ex
★ 0
MIT
JavaScript
Sep 30, 2026
dsh plugin --profile web add dsh-screen-readerby zhiwuli0228
Digests the images in a prompt with a vision model before admission, so any model — a text-only one included — can read them without the session ever switching models, and adds a describe_image tool f
★ 0
MIT
JavaScript
Oct 30, 2026
dsh plugin --profile web add dsh-image-routerConfigurable image recognition for text-only DSH models: image messages are first transcribed by an OpenAI-compatible vision model (Base URL, model ID and API key set in a Settings section) and then p
★ 0
dsh plugin --profile web add @lp181818/dsh-vision-plugin