Optical Character Recognition (OCR) Processing in webMethods.io using Microsoft Azure Cognitive Services

Introduction

This tutorial describes how to integrate webMethods.io with Microsoft Cognitive Services. Here the cognitive service I am using is “Computer Vision” and the functionality I am using is Optical Character Recognition (OCR).

Prerequisite

• Have access to webMethods.io cloud instance
• Access to Microsoft Azure with valid subscription – https://azure.microsoft.com

What is Azure Cognitive Service?

Cognitive Services brings AI within reach of every developer—without requiring machine-learning expertise. All it takes is an API call to embed the ability to see, hear, speak, search, understand and accelerate decision-making into your apps. Enable developers of all skill levels to easily add AI capabilities to their apps. Read More

Microsoft Azure’s Computer Vision is a cognitive service which gives you access to advanced algorithms that process images and return information based on the visual features you’re interested in. For example, Computer Vision can determine whether an image contains adult content, find specific brands or objects, or find human faces. Read More

Setup Microsoft Azure Cloud Vision Cognitive Service

  • Login to https://portal.azure.com/
  • Search for Computer Vision Cognitive Service in marketplace
    image
  • Enter all the required details and click Create to create the service for you. You can select the Free tier F0 for purpose of POC. You can select the paid tier for production applications.
  • To invoke the newly created service, you should have the access keys and end point details. You can get this by accessing Keys and Endpoint tab within the cognitive service
    image

APIs supported by Computer Vision Cognitive Service
image

API swagger URL - https://westus.dev.cognitive.microsoft.com/docs/services/5d98695995feb7853f67d6a6/export?DocumentFormat=Swagger&ApiName=Computer%20Vision%20API%20(v3.0-preview)

Testing the Cognitive Service OCR functionality from Postman

image

POST URL - https://<yourserviceregion>.api.cognitive.microsoft.com/vision/v3.0/ocr

Content-Type : application/json

Ocp-Apim-Subscription-Key : <your cognitive service key>

In the body, pass a Json value {“url”:”<image URL>”}
image

The response of this post call would be the text in the image passed

image

Developing webMethods.io workflow to invoke the Cognitive Service

In webMethods.io, you can use Http Connector to create a Http Request to the cognitive service and receive the response and process further as required.

Sample workflow is as below, where I read all the text output of the cognitive service and write to file within the loops and finally return the complete content to the user to be displayed on browser.

image

1 Like