find text boundaries in image

Discussions about image processing and document imaging.
Post Reply
teusoft
Posts: 1
Joined: Fri Sep 18, 2015 9:43 am

find text boundaries in image

Post by teusoft » Fri Sep 18, 2015 9:49 am

Hi everyone

my input is tiff multipage document file and i want to find the text boundary of specific word or line in the file.

I don't know if Gdpicture supports this feature.

Thank you for your help.

Le

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: find text boundaries in image

Post by David » Tue Feb 09, 2016 7:02 pm

Hi,

This feature can be implemented by the mean of the character recognition engine embed in GdPicture.NET. Please have a look at the OCR sample: GdPicture.NET 11\Samples\WinForm\C#\OCR

This sample application draws small red rectangles around the characters:

Code: Select all

for (ncpt = 1; ncpt <= oGdPictureImaging.OCRTesseractGetCharCount(); ncpt++)
                    {
                        if (oGdPictureImaging.DrawRectangle(m_ImageID, oGdPictureImaging.OCRTesseractGetCharLeft(ncpt) + LeftArea, oGdPictureImaging.OCRTesseractGetCharTop(ncpt) + TopArea, oGdPictureImaging.OCRTesseractGetCharRight(ncpt) - oGdPictureImaging.OCRTesseractGetCharLeft(ncpt), oGdPictureImaging.OCRTesseractGetCharBottom(ncpt) - oGdPictureImaging.OCRTesseractGetCharTop(ncpt), 1, Color.Red, false) != GdPictureStatus.OK)
                            MessageBox.Show("Cannot Draw Rectangle.");
                    }
The implementation of the requested feature is quite easy:
- find the index of the first character of the word you are looking for in the text retrieved by the OCR (see variable sOCR in the sample)
- get the position of every character of the word by the mean of OCRTesseractGetCharTop, OCRTesseractGetCharLeft, OCRTesseractGetCharBottom and OCRTesseractGetCharRight, start with the index of the first character and loop for all of the characters of the word.

This can easily be adapted to a line.

Regards,

David

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests