OCR

Perform OCR on objects in an ROI, or on a ROI in the frame.

Overview

The OCR node allows for performing OCR (Optical Character Recognition) on objects within a Region of Interest (ROI), or on a ROI within the frame. This functionality is crucial for applications requiring text recognition and extraction from video feeds.

Inputs & Outputs

  • Input media: Raw Video.
  • Output media: Raw Video.
  • Output metadata: nodes.node_id, +-- recognized_objs, +-- recognized_obj_ids, +-- recognized_obj_count, +-- recognized_obj_delta, +-- value_changed_delta, +-- unrecognized_obj_count, +-- unrecognized_obj_delta.

Properties

PropertyDescriptionTypeDefaultRequired
roi_labelsRegions of interest labelsstringNo
roisRegions of interest. Conditional on roi_labels. Format: comma-separated normalized x,y coordinate pairs; separate multiple polygons with semicolons (for example, 0.1,0.1,0.9,0.1,0.9,0.9).stringnullNo
processing_modeProcessing mode. Options: ROIs, at an Interval (rois_interval); ROIs, upon a Trigger (rois_trigger); Objects in an ROI (objects).enumrois_intervalYes
triggerQueue ROI for OCR when this condition evaluates to true. Conditional on processing_mode being rois_trigger.trigger-conditionnullYes
objects_to_processex. car,person,car.red. Conditional on processing_mode being objects.model-labelsnullNo
tracking_modeTracking mode. Options: Centroid (centroid); Top center (top-center); Bottom center (bottom-center); Left center (left-center); Right center (right-center). Conditional on processing_mode being objects.enumcentroidNo
min_obj_size_pixelsMin. width and height of an object. Conditional on processing_mode being objects.number64No
obj_lookup_size_change_thresholdObject size ratio change threshold. Conditional on processing_mode being objects. Range: minimum 0.1, maximum 2.0. Step: 0.2.float0.1No
max_lookups_per_objMax. OCR attempts per object. Conditional on processing_mode being objects.number5No
group_ocr_resultsIf enabled, the match pattern is applied to the group of texts instead of individual words.boolfalseNo
ocr_match_patternOnly retain OCR results that match this Regular Expression pattern. Leave blank to keep unfiltered results.stringnullNo
min_confidenceIgnores OCR results if they are below this threshold. Range: minimum 0, maximum 1. Step: 0.05.float0.7No
additional_orientationsAdditional orientations to consider for OCR. This is useful for recognizing text that is rotated at 90, 180, or 270 degrees. Options: 90 degrees (90); 180 degrees (180); 270 degrees (270). Format: array of selected option values.string[]nullNo
ocr_intervalOCR lookups interval. Unit: seconds.number1No
display_roiDisplay ROI on video?booltrueNo
display_objinfoDisplay OCR info on video? Options: Disabled (disabled); Bottom left (bottom_left); Bottom right (bottom_right); Top left (top_left); Top right (top_right).enumbottom_leftNo
debugLog debugging information?boolfalseNo

Output Metadata

The fields below are declared by this node's metadata schema; the JSON values are representative examples.

PathTypeDescription
nodes.<node_id>.rois.<roi_label>.label_changed_deltabooleanWhen the OCR caption of an ROI changes
nodes.<node_id>.rois.<roi_label>.label_availablebooleanWhen an OCR caption becomes available
nodes.<node_id>.rois.<roi_label>.labelstringCurrent model-generated result for this ROI.
nodes.<node_id>.recognized_obj_countintegerNumber of objects successfully processed in the current frame.
nodes.<node_id>.recognized_obj_deltaintegerWhen one or more new objects have an OCR caption assigned
nodes.<node_id>.label_changed_obj_deltaintegerWhen the OCR caption of one or more objects changes
nodes.<node_id>.unrecognized_obj_countintegerNumber of objects that could not be processed in the current frame.
nodes.<node_id>.unrecognized_obj_deltaintegerWhen one or more objects fail to be assigned an OCR caption
nodes.<node_id>.recognized_obj_idsarrayArray of tracking IDs of objects successfully processed by the node.
nodes.<node_id>.objects_of_interest_keysarrayArray of metadata keys that contain object IDs relevant to downstream integrations.
nodes.<node_id>.typestringIdentifies the node type that produced this metadata.

JSON example

{
  "nodes": {
    "ocr1": {
      "label_changed_obj_delta": 0,
      "objects_of_interest_keys": ["recognized_obj_ids"],
      "recognized_obj_count": 0,
      "recognized_obj_delta": 0,
      "recognized_obj_ids": [],
      "rois": {
        "roi1": {
          "label": "example",
          "label_available": false,
          "label_changed_delta": false
        }
      },
      "type": "ocr",
      "unrecognized_obj_count": 0,
      "unrecognized_obj_delta": 0
    }
  }
}

Additional details

Object labels and attributes

  • Object labels/classes added: In ROI mode, the configured ROI label is added as an object with class 10500.
  • Object attribute labels/classes added: ROI objects receive ocr_roi (10500); recognized text uses class 10502; successful results add ocr_results (10501).

Did this page help you?