-4

Let me explain the task by an example,

There is an image named demo1.jpeg and it has a whole article written on it. It's not handwritten. It's digital.

What I want is to find the location of a specific word on that image. Like x,y coordinates of a text on it.

For example, If I were to find each and every occurrence of the word "awesome" on it, I should get an array of all occurrence of that word.

Any suggestion with a demo would be dearly appreciated.

Thanks.

2
  • This looks like a duplicate of stackoverflow.com/questions/10947399/…
    – Kai
    Nov 16, 2019 at 5:27
  • @Kai There is no requirement on that question to find a location of the occurrence. I'm not asking for a simple OCR processing on an image.
    – ChiragMS
    Nov 16, 2019 at 5:33

1 Answer 1

2

I'm using Tesseract for solving this. It can be very helpful. Here is an example

 PageIteratorLevel myLevel = PageIteratorLevel.Word;
        TesseractEngine engine = new TesseractEngine("./tessdata", "eng");
        var page = engine.Process(bitmap, PageSegMode.Auto);
        using (var iter = page.GetIterator())
        {
            iter.Begin();
            do
            {
                if (iter.TryGetBoundingBox(myLevel, out var rect))
                {
                    var curText = iter.GetText(myLevel);
                    if (curText == "awesome") //Here is your text
                    {
                        //Get rect.X1, rect.Y1, 
                    }
                }
            } while (iter.Next(myLevel));
        }

I hope this help you

2
  • This might work. Im gonna create a demo from this. I'll mark it as an answer afterwards. Thanks. Really appreciate it.
    – ChiragMS
    Nov 16, 2019 at 9:55
  • @Dllshod This worked fine but looks like its tesseract is not returning an accurate result. For example if I take a screenshot of this screen (stackoverflow), Tesseract wont return accurate result of the text that is visible on my screen right now. Can you help me how to improve the accuracy for this?
    – ChiragMS
    Nov 18, 2019 at 8:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.