Configure image processing settings in K21
setProcessor
method configures how K21 processes captured images or video frames. It supports both OCR (Optical Character Recognition) and Vision-based processing, with customizable settings for each.
Parameter | Type | Default | Description |
---|---|---|---|
processingType | string | 'OCR' | Type of processing to apply (“OCR” or “Vision”) |
ocrConfig | OcrConfig | See below | Configuration for OCR-based processing |
visionConfig | VisionConfig | See below | Configuration for vision-based processing |
Parameter | Type | Default | Description |
---|---|---|---|
ocrModel | string | 'default' | OCR model to use (e.g., “tesseract”, “native”, “default”) |
boundingBoxes | boolean | true | Whether to include text bounding box coordinates in results |
dpi | number | - | Dots per inch for image processing. Higher values for smaller text |
psm | number | - | Page Segmentation Mode - controls how the page is analyzed |
oem | number | - | OCR Engine Mode - controls which engine(s) are used |
Parameter | Type | Default | Description |
---|---|---|---|
url | string | - | Base URL for the vision API endpoint |
apiKey | string | - | Authentication key for the vision API |
model | string | - | Model identifier to use for vision processing |
prompt | string | - | Optional prompt to guide the vision model’s analysis |
setProcessor()
without any configuration, these default values will be used:
processingType
determines which configuration will be used (ocrConfig
or visionConfig
)psm
and oem
are specific to certain OCR engines (like Tesseract)