Quickstart
เริ่มต้นอย่างเร็ว
ตัวอย่างนี้สร้างฟอร์ม OMR จากแม่แบบ, บันทึกภาพหน้ากระดาษและตัวบรรยาย .omr, จดจำสำเนาที่สแกนของฟอร์มนั้น, และส่งออกผลลัพธ์เป็น CSV.
ตัวอย่างเต็ม
from omr.api import OmrEngine, FormValidationLogic
engine = OmrEngine()
gen = engine.Generate("final-exam.txt") # or a code-first TemplateConfig
gen.Save("out", "final-exam") # -> out/final-exam.png + out/final-exam.omr
processor = engine.GetTemplateProcessor("out/final-exam.omr", FormValidationLogic.Ignore)
result = processor.Recognize("scan.png") # -100 = auto-calibrated threshold
print(result.GetCsv()) # also GetJson() / GetXml()OmrEngine.Generate() ยอมรับแหล่งที่มาของ DSL แบบข้อความมาร์กอัป (แสดงด้านบน) หรือโครงต้นไม้ TemplateConfig แบบโค้ดก่อน. GetTemplateProcessor() โหลดตัวบรรยาย .omr ที่เพิ่งเขียน, และ Recognize() อ่านภาพสแกนเทียบกับมัน. RecognitionResult ส่งออกเป็น CSV, JSON, หรือ XML.