Offline optical mark recognition with explicit review
moon add clbbbb/marksheetmoon build --target js --deny-warn
node web/serve.mjsnode _build/js/debug/build/cmd/main/main.js --help
node _build/js/debug/build/cmd/main/main.js print examples/template.json > form.svg
python -B examples/demo.py demo-output| 命令 | 用途 |
|---|---|
| template TITLE QUESTIONS OPTIONS MAX_MARKS | 生成均匀题型的模板 JSON |
| print-numbered TEMPLATE SERIAL | 生成带印刷编号的 A4 SVG |
| scan TEMPLATE IMAGE ID | 输出各题判定、裁剪坐标和待复核列表 |
| scan-corners TEMPLATE IMAGE ID CORNERS | 手工给出模板顺序的四个方块中心,仍校验印刷模板码 |
| start TEMPLATE IMAGE ID | 输出空复核记录 |
| review TEMPLATE IMAGE JOURNAL REVISION QUESTION ACTION NOTE | 应用一条人工决定,输出新记录 |
| inspect TEMPLATE IMAGE JOURNAL | 重放已保存的记录并输出最终状态 |
| export TEMPLATE MANIFEST | 导出整批 CSV,有待复核时返回退出码 3 |
| audit TEMPLATE MANIFEST csv\|json | 查看每题机器判定与最终结果分布 |
| grade TEMPLATE MANIFEST KEY csv\|json | 使用答案键评分,多选要求选项集合完全一致 |
| calibrate TEMPLATE MANIFEST POLICIES | 用已标注的样张比较判定阈值 |
moon test --deny-warn
moon test --target js --deny-warn
moon build --target js --deny-warn
node examples/browser-api.mjs
python -B examples/demo.py demo-outputpub(all) suberror MarkError {
Invalid(String)
Unreadable(String)
RegistrationFailed(String)
ReviewRequired(String)
} derive(Debug)pub struct DetectionPolicy {
possible : Double
filled : Double
minimum_paper : Double
minimum_ring : Double
}fn DetectionPolicy::new(possible : Double, filled : Double, minimum_paper : Double, minimum_ring : Double) -> DetectionPolicy raise MarkErrorpub struct GrayImage {
width : Int
height : Int
pixels : Bytes
}pub(all) struct ItemGrade {
question : Int
kind : ResultKind
awarded : Int
possible : Int
} derive(Eq, Debug)pub struct QuestionReading {
index : Int
finding : Finding
selected : ArrayView[Int]
bubbles : ArrayView[BubbleReading]
}pub struct Scan {
template : Template
policy : DetectionPolicy
registration : Registration
readings : ArrayView[QuestionReading]
image_width : Int
image_height : Int
image_fingerprint : UInt64
printed_serial : Int?
// private fields
}fn Sheet::review(self : Sheet, index : Int, action : ReviewAction, note : String, expected_revision : Int) -> Unit raise MarkErrorfn calibrate(cases : Array[CalibrationCase], policies : Array[DetectionPolicy]) -> Array[CalibrationPoint] raise MarkError