Detect Text from an Image - Integrating Google Cloud Vision API via MuleSoft
Learn how to detect text from an image by integrating Google Cloud Vision API via MuleSoft.
Join the DZone community and get the full member experience.Join For Free
Here's another fun learning Article on how to detect text from an image.
For this purpose, we would be using Google Cloud Vision API and we will be Integrating it via MuleSoft.
Very Easy, Before getting Started, Follow the process:
Note: The Google API is chargeable after a few requests.
Watch the video at the end to do the process
Step 1: Create a Google Developers Account account
Step 2: Create a Project. Name it.
Step 3 : Enable the "Cloud Vision API"
Step 4: Create an API key with help of the "Create credentials" Option.
Step 5: Enable Billing for your API. You can see the link when you hit your API for the first time. It will error out saying Billing should be enabled for the API and they provide a link in the error. Just copy the URL and paste in browser to enable billing
Now all Set.
The Details to call Google Cloud Vision API is:
So am creating a Mule Project where I will be sending files as form-data from postman as a file.
I will be converting the content of the image to base 64 content so that I can pass it as input for Google Cloud Vision API.
Here's the code to convert the content of image:
Final Transformation to create a request to call Cloud Vision API:
Input Image for the API :
Clone the code :
Watch the video and Practice!
Happy Learning !!
Don't forget to disable Billing.!!!!
Opinions expressed by DZone contributors are their own.