OCR Node

The OCR node looks for image files in the msg.payload. If an image is found, it performs optical character recognition (OCR) on that image to greedily extract any words present. Extracted words are added to msg.payload.

Configuration

Name optional
Optional name for this node
Display Preview flag
Whether to show rendered image preview with bounding boxes underneath the status text of the node.
Enable Filter flag
Whether to enable threshold-based filtering. The filter only applies if actual OCR was performed, otherwise the message will just be passed through.
Confidence Threshold float [0.0-1.0]
Specify the minimum required confidence value with 1 being very confident.

Input

payload string
URL of the image to be analyzed

Note, if the twitter sensor node was used in the flow this node will automatically perform analyses on all shared images.

Output

Extracted words are added to the msg.payload. Furthermore, the message will be enriched by the ocr property.

payload string
Extracted text, e.g. DOGE . Crypto\nDogecoin\nS0.064354\n+S0.00387 (6.4%) Today
confidence float [0.0-1.0]
Average confidence of all extracted bounding boxes, e.g. 0.7954844350801857
ocr list of objects
List of objects
ocr[index].url string
URL of the image, e.g. https://pbs.twimg.com/media/FePUcQ6VUAAur32?format=jpg&name=small
ocr[index].text string
Extracted text, e.g. DOGE . Crypto\nDogecoin\nS0.064354\n+S0.00387 (6.4%) Today
ocr[index].bounds list
Bouding boxes with coordinates; extracted text; confidence
ocr[index].rendered_img string
Base64 encoded preview with baked in bounding boxes (useful in editor)

Example message

{
  "payload": "DOGE . Crypto\nDogecoin\nS0.064354\n+S0.00387 (6.4%) Today",
  "confidence": 0.7954844350801857,
  "ocr": [
    {
      "url": "https://pbs.twimg.com/media/FePUcQ6VUAAur32?format=jpg&name=small",
      "text": "DOGE . Crypto\nDogecoin\nS0.064354\n+S0.00387 (6.4%) Today",
      "bounds": [
        [
          [
            [88, 12],
            [260, 12],
            [260, 44],
            [88, 44]
          ],
          "DOGE . Crypto",
          0.9091783424046121
        ],
        [
          [
            [26, 68],
            [210, 68],
            [210, 120],
            [26, 120]
          ],
          "Dogecoin",
          0.8252040240556264
        ],
        [
          [
            [26, 120],
            [246, 120],
            [246, 168],
            [26, 168]
          ],
          "S0.064354",
          0.5889591676256629
        ],
        [
          [
            [26, 170],
            [220, 170],
            [220, 196],
            [26, 196]
          ],
          "+S0.00387 (6.4%) Today",
          0.8585962062348412
        ]
      ],
      "rendered_img": "data:image/JPEG;charset=utf-8;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAIAAYkDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDw2iiiukYUVLa2txfXcVrawvNcTMEjjQZZmPQAVt+K/DcPhe4tbB9RjudT8vdfQxDKWz9k3fxHHX0NK4HP0UUUwCiiigAorpdCsBq2u6JoyC3iF8URpngDlSSeffpW2nh3StU..."
    }
  ]
}
Last updated on Oct 8, 2022

Newsletter

Subscribe to our newsletter to stay updated and to get notified once the platform officially launches:

By subscribing, you agree with Foretale’s Privacy Policy

© foretale - 2022