Class OcrSettings
- Namespace
- VisioForge.Core.Types.X.AI
- Assembly
- VisioForge.Core.dll
Settings for the OCR block, which runs a multi-stage PaddleOCR (PP-OCR) pipeline on video frames: text detection (DBNet) → optional angle classification → text-line recognition (CRNN/SVTR + CTC).
public class OcrSettingsInheritance
Inherited Members
Remarks
Unlike a single-model detector, OCR needs three ONNX models plus a recognizer character dictionary. Provide them via VisioForge.Core.Types.X.AI.OcrSettings.DetectionModelPath, VisioForge.Core.Types.X.AI.OcrSettings.RecognitionModelPath, VisioForge.Core.Types.X.AI.OcrSettings.CharacterDictionaryPath, and optionally VisioForge.Core.Types.X.AI.OcrSettings.ClassificationModelPath. The Apache-2.0 licensed PP-OCRv5 mobile models are a good default; the dictionary must match the recognition model's language.
Constructors
OcrSettings()
Initializes a new instance of the VisioForge.Core.Types.X.AI.OcrSettings class.
public OcrSettings()OcrSettings(string, string, string, string)
Initializes a new instance of the VisioForge.Core.Types.X.AI.OcrSettings class with the specified model paths.
public OcrSettings(string detectionModelPath, string recognitionModelPath, string characterDictionaryPath, string classificationModelPath = null)Parameters
detectionModelPathstring-
The detection model path.
recognitionModelPathstring-
The recognition model path.
characterDictionaryPathstring-
The recognizer character dictionary path.
classificationModelPathstring-
The optional angle-classification model path.
Properties
BoxColor
Gets or sets the color used for the region boxes and text when VisioForge.Core.Types.X.AI.OcrSettings.DrawResults is enabled. Defaults to lime.
public SKColor BoxColor { get; set; }Property Value
BoxScoreThreshold
Gets or sets the minimum mean probability a detected region must reach to be kept. Defaults to 0.5.
public float BoxScoreThreshold { get; set; }Property Value
BoxThickness
Gets or sets the stroke thickness, in pixels, of the region boxes. Defaults to 2.
public float BoxThickness { get; set; }Property Value
BoxThreshold
Gets or sets the binarization threshold applied to the detector probability map. Defaults to 0.3.
public float BoxThreshold { get; set; }Property Value
CharacterDictionaryPath
Gets or sets the absolute path to the recognizer character dictionary (one symbol per line). Must match the language of VisioForge.Core.Types.X.AI.OcrSettings.RecognitionModelPath.
public string CharacterDictionaryPath { get; set; }Property Value
ClassificationModelPath
Gets or sets the absolute path to the angle-classification ONNX model. Optional; leave null or
empty (and set VisioForge.Core.Types.X.AI.OcrSettings.UseAngleClassifier to false) to skip 180° orientation handling.
public string ClassificationModelPath { get; set; }Property Value
DetectionModelPath
Gets or sets the absolute path to the text-detection (DBNet) ONNX model.
public string DetectionModelPath { get; set; }Property Value
DeviceId
Gets or sets the device identifier for hardware execution providers (the GPU index for CUDA/DirectML). Defaults to 0.
public int DeviceId { get; set; }Property Value
DrawResults
Gets or sets a value indicating whether the recognized text regions are drawn directly into the
video frame (boxes plus the recognized text). Defaults to true.
public bool DrawResults { get; set; }Property Value
FramesToSkip
Gets or sets the number of frames to skip between OCR runs. A value of 0 runs OCR on every frame. OCR is heavier than single-model detection, so a non-zero value is recommended for live video. Defaults to 0.
public int FramesToSkip { get; set; }Property Value
LabelFontSize
Gets or sets the label font size, in pixels. A value of 0 auto-scales the font to the frame height. Defaults to 0.
public float LabelFontSize { get; set; }Property Value
MaxSideLength
Gets or sets the side length, in pixels, the detector input's longer side is resized to (the longer side is scaled to this value, up or down). Defaults to 1024. Set to 0 (or a negative value) to use the adaptive PP-OCRv5 resize path instead (short side scaled to the model's tuned length, longer side bounded).
public int MaxSideLength { get; set; }Property Value
Provider
Gets or sets the execution provider used by the OCR sessions. Defaults to VisioForge.Core.Types.X.AI.OnnxExecutionProvider.Auto.
public OnnxExecutionProvider Provider { get; set; }Property Value
RecognitionModelPath
Gets or sets the absolute path to the text-recognition (CRNN/SVTR) ONNX model.
public string RecognitionModelPath { get; set; }Property Value
TextScoreThreshold
Gets or sets the minimum average per-character recognition score a text line must reach to be reported. Defaults to 0.5.
public float TextScoreThreshold { get; set; }Property Value
UnclipRatio
Gets or sets the unclip ratio used to expand detected text polygons. Defaults to 1.6.
public float UnclipRatio { get; set; }Property Value
UseAngleClassifier
Gets or sets a value indicating whether the angle classifier is used to correct 180°-rotated text.
Requires VisioForge.Core.Types.X.AI.OcrSettings.ClassificationModelPath. Defaults to true for the parameterless
constructor; the VisioForge.Core.Types.X.AI.OcrSettings.#ctor(System.String,System.String,System.String,System.String) constructor instead
derives it from whether a classification model path was supplied.
public bool UseAngleClassifier { get; set; }