This message was posted using Email2Forum by Babar Raza.
This message was posted using Email2Forum by Babar Raza.
Hi Hunaid,
Thank you for considering Aspose products.
We would request you to please go through the below linked detailed article on this subject.
For a brief introduction, Aspose.OCR for .NET requires a resource file as well as reference of Aspose.OCR.dll in the project. Once the environment is set, you can use the below provided code snippet to extract text from a given image. Please note, you have to change the file path locations according to your file system.
C#
// Resource file
const string resourceFileName = “C:/Users/Babar Raza/Downloads/Aspose.OCR.Resources.zip”;
// Source file: the file on which OCR will be performed
string imageFile = “D:/temp/sample.jpg”;
Console.WriteLine("Performing OCR on " + imageFile + “…”);
// Initialize OcrEngine
OcrEngine ocr = new OcrEngine();
// Set the image
ocr.Image = ImageStream.FromFile(imageFile);
// Add language
ocr.Languages.AddLanguage(Language.Load(“english”));
// Load the resource file
using (ocr.Resource = new FileStream(resourceFileName, FileMode.Open))
{
try
{
// Process the whole image
if (ocr.Process())
{
// Get the complete recognized text found from the image
Console.WriteLine(“Text recognized./n” + ocr.Text);
}
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex.Message);
}
}
In case you face any difficulty, please feel free to write back anytime.
Hi,
Please find the rar file along with this as attachment the rar file has image inside it.
For checking purpose,i have given an image file,it does not read the text from it
it gave unexpected results
Does this reads any font?
Thanks & Regards,
S.N.Prasad
Hi Prasad,