Is there way to get word location and box from image?

Hi,
This code does everything what I need except word location. It returns x=0 and y =0 for every word.

var _lic = new License();
_lic.SetLicense("Aspose.Total.lic");
//Initialize an instance of OcrEngine
OcrEngine ocrEngine = new OcrEngine();

//Set the Image property by loading the image from file path location or an instance of MemoryStream
ocrEngine.Image = ImageStream.FromFile("5543668_1.png");
//Remove non-textual blocks
ocrEngine.Config.RemoveNonText = true;

////Get an instance of INotifier
INotifier processorWord = NotifierFactory.WordNotifier();

//Write a delegate to handle the Elapsed event
processorWord.Elapsed += delegate
{
//Display the recognized text on screen
Console.WriteLine(string.Format("{0} [{1},{2}]", processorWord.Text, processorWord.Text.PartsInfo[0].Box.X, processorWord.Text.PartsInfo[0].Box.Y));
};

// Add the word processor to the OcrEngine
ocrEngine.AddNotifier(processorWord);
ocrEngine.Process();
Console.ReadKey();

Hi Samsen,


Thank you for contacting Aspose support.

We have evaluated your presented scenario while using the latest version of Aspose.OCR for .NET 2.5.0, and we are able to notice the said problem, The IRecognizedTextPartInfo.Box property returns 0,0 for location when used with INotifier. We have logged this incident in our bug tracking system under the ticket OCR-34038 for further investigation into this matter. As soon as we have completed the analysis, we will share our results here for your reference.

Please note, if you use the same property without using the INotifier, you will be able to get the desired locations for the recognized text parts. Please check the following piece of code.

C#

//Initialize an instance of OcrEngine
OcrEngine ocrEngine = new OcrEngine();

//Set Image property by loading an image from file path
ocrEngine.Image = ImageStream.FromFile(“D:/5543668_1.png”);

//Process the image
ocrEngine.Process();

//Retrieve an array of recognized text by parts
IRecognizedPartInfo[] text = ocrEngine.Text.PartsInfo;
//Iterate over the text parts
foreach (IRecognizedTextPartInfo symbol in text)
{
//Display the part information
Console.WriteLine(“Symbol:” + symbol.Text);
//Get the rectangle surrounding the symbol
System.Drawing.Rectangle box = symbol.Box;
//Display the rectangle location on the image canvas
Console.WriteLine(“Box Location:” + box.Location);
//Display the rectangle dimensions
Console.WriteLine(“Box Size:” + box.Size);
}

The issues you have found earlier (filed as OCR-34038) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Great thanks!

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.