OCRDetectionOptions
10/22/22Less than 1 minute
OCRDetectionOptions
ocr.OCRDetectionOptions
Options for a single detect call.
Table of contents
Properties
Properties
max
• Optional max: number
Maximum number of text regions to return. Default 1000. Recognition stops once this many results are collected.
detectRotation
• Optional detectRotation: boolean
Whether to estimate text rotation per line. Default false. When true, results include rotation angle and confidence, at the cost of extra processing time.
Note
Enabling rotation detection increases runtime.
region
• Optional region: Region
Restrict recognition to a rectangle in image coordinates. If omitted, the full image is used.
Example
"nodejs";
const { createOCR } = require("ocr");
const cv = require("@autojs/opencv");
async function main() {
const ocr = await createOCR();
const img = await readImage("./image.png");
// Only the top-left 500×500 region
const results = await ocr.detect(img, {
region: new cv.Rect(0, 0, 500, 500),
});
ocr.release();
}
main();