OCR procedure

Official Content
This documentation is valid for:

Extracts text from an image. The acronym OCR means 'Optical Character Recognition'.

Parameters

Configuration

The following table resumes the configuration properties that you must set before calling this AI task.

Property Google Cloud AI IBM Watson Microsoft Azure SAP Leonardo
Key For Cloud Vision API For Visual Recognition For Computer Vision For Sandbox Environment

Sample

Taking the following image input, the table below shows the text are identified for each provider (as a JSON structure) and the time it takes for processing it.

GeneXusAI - Image module - Sample

Provider Output Benchmark
Google Cloud AI
[{
    "label": "Levi'S",
    "confidence": 1,
    "top": 821,
    "left": 535,
    "width": 139,
    "height": 40,
    "Info": [{
            "property": "Language",
            "value": "en"
        }
    ]
}]
GeneXusAI - Google - OCR
8305ms
IBM Watson
[{
    "label": "vrs",
    "confidence": 0.697,
    "top": 241,
    "left": 153,
    "width": 8,
    "height": 25,
    "Info": [{
        "property": "line_number",
        "value": "0.00000"
    }]
}, {
    "label": "le",
    "confidence": 0.668,
    "top": 247,
    "left": 162,
    "width": 35,
    "height": 14,
    "Info": [{
        "property": "line_number",
        "value": "0.00000"
    }]
}]
GeneXusAI - IBM - OCR
9251ms
Microsoft Azure
[{
    "label": "Levrs",
    "confidence": 0.0,
    "top": 823,
    "left": 538,
    "width": 147,
    "height": 36,
    "Info": [{
        "property": "Angle",
        "value": "0.00000"
    }, {
        "property": "Language",
        "value": "tr"
    }, {
        "property": "Orientation",
        "value": "Up"
    }]
}]
GeneXusAI - Microsofot - OCR
8496ms
SAP Leonardo
[{
    "label": "Levis",
    "confidence": 0.955528974533081,
    "top": 820,
    "left": 534,
    "width": 156,
    "height": 39
}]
GeneXusAI - SAP - OCR
8595ms

Another example, when the input image has clean text (reduced noise).

image_201887102737_1_png

Provider Output Benchmark
Google Cloud AI
[{
    "label": "LEGACY",
    "confidence": 1,
    "top": 110,
    "left": 551,
    "width": 155,
    "height": 34,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "MODERNIZATION",
    "confidence": 1,
    "top": 162,
    "left": 553,
    "width": 347,
    "height": 35,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "WITH",
    "confidence": 1,
    "top": 216,
    "left": 553,
    "width": 77,
    "height": 29,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "GENEXUS",
    "confidence": 1,
    "top": 216,
    "left": 641,
    "width": 150,
    "height": 29,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "15",
    "confidence": 1,
    "top": 216,
    "left": 823,
    "width": 31,
    "height": 29,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "Mlusion",
    "confidence": 1,
    "top": 99,
    "left": 274,
    "width": 24,
    "height": 7,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "GeneXus",
    "confidence": 1,
    "top": 96,
    "left": 34,
    "width": 85,
    "height": 3,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "it",
    "confidence": 1,
    "top": 136,
    "left": 279,
    "width": 4,
    "height": 5,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "is!",
    "confidence": 1,
    "top": 136,
    "left": 287,
    "width": 8,
    "height": 7,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "(0S",
    "confidence": 1,
    "top": 262,
    "left": 291,
    "width": 9,
    "height": 7,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "430",
    "confidence": 1,
    "top": 263,
    "left": 304,
    "width": 9,
    "height": 7,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "ees",
    "confidence": 1,
    "top": 263,
    "left": 318,
    "width": 16,
    "height": 8,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "ATES",
    "confidence": 1,
    "top": 295,
    "left": 369,
    "width": 31,
    "height": 18,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "RLD",
    "confidence": 1,
    "top": 313,
    "left": 367,
    "width": 20,
    "height": 13,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "DOWNLOAD",
    "confidence": 1,
    "top": 356,
    "left": 586,
    "width": 106,
    "height": 15,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "THE",
    "confidence": 1,
    "top": 356,
    "left": 698,
    "width": 36,
    "height": 15,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}, {
    "label": "EBOOK!",
    "confidence": 1,
    "top": 356,
    "left": 741,
    "width": 69,
    "height": 15,
    "Info": [{
            "property": "Language",
            "value": ""
        }
    ]
}]
GeneXusAI - Google - OCR - Clean
2716ms
IBM Watson
[{
    "label": "gene",
    "confidence": 0.7228,
    "top": 92,
    "left": 35,
    "width": 62,
    "height": 27,
    "Info": [{
        "property": "line_number",
        "value": "0.00000"
    }]
}, {
    "label": "nexus",
    "confidence": 0.8237,
    "top": 80,
    "left": 62,
    "width": 68,
    "height": 32,
    "Info": [{
        "property": "line_number",
        "value": "0.00000"
    }]
}, {
    "label": "legacy",
    "confidence": 0.9684,
    "top": 111,
    "left": 553,
    "width": 158,
    "height": 37,
    "Info": [{
        "property": "line_number",
        "value": "1.00000"
    }]
}, {
    "label": "modernization",
    "confidence": 0.9898,
    "top": 163,
    "left": 553,
    "width": 351,
    "height": 37,
    "Info": [{
        "property": "line_number",
        "value": "2.00000"
    }]
}, 
...
}]
GeneXusAI - IBM - OCR - Clean
12898ms
Microsoft Azure
[{
    "label": "GeneXus",
    "confidence": 0,
    "top": 94,
    "left": 0,
    "width": 126,
    "height": 76,
    "Info": [{
            "property": "Angle",
            "value": "0.00000"
        }, {
            "property": "Language",
            "value": "en"
        }, {
            "property": "Orientation",
            "value": "up"
        }
    ]
}, {
    "label": "WITH GENEXUSTM 15",
    "confidence": 0,
    "top": 216,
    "left": 0,
    "width": 862,
    "height": 215,
    "Info": [{
            "property": "Angle",
            "value": "0.00000"
        }, {
            "property": "Language",
            "value": "en"
        }, {
            "property": "Orientation",
            "value": "up"
        }
    ]
}, {
    "label": "DOWNLOAD THE EBOOK!",
    "confidence": 0,
    "top": 353,
    "left": 0,
    "width": 813,
    "height": 352,
    "Info": [{
            "property": "Angle",
            "value": "0.00000"
        }, {
            "property": "Language",
            "value": ""
        }, {
            "property": "Orientation",
            "value": ""
        }
    ]
},
...
]
GeneXusAI - MCS - OCR - Clean
8496ms
SAP Leonardo
[{
	"label": "MODERNIZATION",
	"confidence": 0.995006024837494,
	"top": 159,
	"left": 562,
	"width": 322,
	"height": 41
}, {
	"label": "LEGACY",
	"confidence": 0.953990995883942,
	"top": 109,
	"left": 551,
	"width": 161,
	"height": 37
}, {
	"label": "Genexus",
	"confidence": 0.974162995815277,
	"top": 79,
	"left": 30,
	"width": 99,
	"height": 40
}, {
	"label": "DOWNLOAD",
	"confidence": 0.931997001171112,
	"top": 355,
	"left": 586,
	"width": 106,
	"height": 18
}, {
	"label": "GENEXUS",
	"confidence": 0.976303994655609,
	"top": 216,
	"left": 641,
	"width": 155,
	"height": 30
}, {
	"label": "WITH",
	"confidence": 0.947585999965668,
	"top": 217,
	"left": 550,
	"width": 83,
	"height": 27
}, {
	"label": "RATES",
	"confidence": 0.932789027690888,
	"top": 294,
	"left": 364,
	"width": 39,
	"height": 19
}, {
	"label": "EBOOK!",
	"confidence": 0.912930011749268,
	"top": 354,
	"left": 742,
	"width": 71,
	"height": 19
}, {
	"label": "RLD",
	"confidence": 0.899074018001556,
	"top": 310,
	"left": 362,
	"width": 28,
	"height": 18
}, {
	"label": "THE",
	"confidence": 0.899158000946045,
	"top": 356,
	"left": 698,
	"width": 39,
	"height": 16
}, {
	"label": "15",
	"confidence": 0.925707995891571,
	"top": 217,
	"left": 826,
	"width": 36,
	"height": 29
}]
GeneXusAI - SAP - OCR - Clean
3780ms

Notes

  • The label assigned for an object depends on the provider used (i.e. string detection accuracy). Additional information can be found on the OutputRegion.Info field if it is given by the provider.
  • Some providers are more accurate with noisy images than others (e.g. stamps on shirts). All of them work fine with clean text on the image (e.g. a scanned text).
  • Maximum image file size is 10MB.
  • GeneXusAI does not provide support for drawing a rectangle over an image. This action is the responsibility of the developer.
    TIP: For Web applications, a good alternative can be combining HTML5 Canvas control with JavaScript with User Control object. On the other hand, for Smart Devices you could use Image Map control on which you can set the processed image as background and 'draw' square regions (i.e. set a border color on the table item of the grid).

Scope

Platforms Web(.NET,.NETCore,Java), SmartDevices(Android,iOS)
Connectivity Online

Availability

This procedure is available as of GeneXus 16.

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.