Read text on an Image using Azure cognitive services
This article help you to understand how to read text on an image using C#.net . We can read the text on images in, two ways. The first one is Computer Vision and the second one is Natural Language Processing (NLP). Computer vision helps us to read the text and then Natural Language Processing is used to make sense of that identified text. In this article, we will discuss on Computer vision.First you need to understand what is the OCR in Azure Cognitive Services?
"OCR (Optical character recognition) is extracts text from images like printed text, hand writting text etc which is in readable format and also OCR helps to read content on documents like pdf, word etc" , to know about more information on OCR click here.
Prerequisites :
Before we start, we should have the following things in our hand.
1. A valid Azure Subscription
2. A good Code editor, I prefer VSCode or Visual Studio
Read Text on images using c#.net:
- First you need to create an Computer Vision resource in Azure cogntive service.
- Note down the Ocp-Apim-Subscription-Key and Computer Vision URL.
- Below method explains converting image into byte array.
public byte[] GetImageAsByteArray(string imageFilePath)
{
using var fileStream=new FileStream(imageFilePath,FileMode.Open,FileAccess.Read);
using var binaryReader= new BinaryReader(fileStream);
return binaryReader.ReadBytes((int)fileStream.Length);
}
- Below method explains read OCR data on image
Comments
Post a Comment