Find text in a image (picturebox) with Tesseract

I have some sample code of using Tesseract-OCR.
Right now the code just opens up a image file and extracts what text it can

I have a picturebox.
I have a textbox and a button
 The OCR Button Load the image from the opendialog in the picturebox and extracts what text it can.

I want to type text  in the text box AND if Tesseract can find it in the image then highlight the text it finds on the image in the picture box .
The ocr button does a pretty good job on extracting what text it can .
I will include a sample image i been working with.
Some sample code would be great .
Thanks for all comments and help.
123.tif
Tesseract-OCR.rar
Grant FullenNONEAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joe Winograd, Fellow&MVEDeveloperCommented:
Hi Grant,
As you know, I'm not a C# programmer, but here's a solution in another language, AutoHotkey, that may be helpful. The AutoHotkey language is pretty easy to understand, so I'm sure you can convert it to C#.

I haven't yet figured out how to highlight the text in the picture box, so instead of that, I call Tesseract to create a searchable PDF file, and then call Adobe Reader with the search term, so that when Adobe Reader runs, all the search term hits are highlighted.

The first prompt in the program is a standard Windows Browse-for-File dialog, allowing you to select the image file. The next dialog looks like this:

TesseractSearch dialog
After you enter the search term and click OK, the program calls Tesseract to create the searchable PDF and then calls Adobe Reader to highlight the search term.

Here's the AutoHotkey program:

AdobeReaderEXE:="c:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
TesseractEXE:="c:\Program Files (x86)\Tesseract-OCR\tesseract.exe"

FileSelectFile,InputFile,1,,Select image file,All files (*.*)
SplitPath,InputFile,OutFileName,OutDir,OutExt,OutNameNoExt
OutputPath:=OutDir . "\"
OutputFileNoExt:=OutputPath . OutNameNoExt
OutputFile:=OutputFileNoExt . ".pdf"

Gui,Font,s10 w600 c000000,Arial
Gui,Add,Picture,,%InputFile%
Gui,Add,Text,,`nEnter search term (whole words only`, case insensitive) and press OK
Gui,Add,Edit,w300 vSearchTerm
Gui,Add,Button,Default,OK
Gui,Show
Return

ButtonOK:
Gui,Submit,NoHide
RunWait,%TesseractEXE% "%InputFile%" "%OutputFileNoExt%" pdf,,Hide
If (ErrorLevel!=0)
{
  MsgBox,4112,Tesseract Error,Error Level=%ErrorLevel%
  ExitApp
}
Run,"%AdobeReaderEXE%" /A "search=%SearchTerm%" "%OutputFile%"
GuiClose:
GuiEscape:
ExitApp

Open in new window

If you're not familiar with AutoHotkey, my Experts Exchange article will get you going on it:
AutoHotkey - Getting Started

And here are some other articles with sample code:
How to copy the short link of an ID at Experts Exchange to the clipboard with a single keystroke

How to solve the problem of incorrect System Uptime being reported when a system has been up for a long time (approximately 50 days or more)

How to create an on/off toggle to mute the system audio/sound with a single mouse click or single keystroke

Btw, because Tesseract OCR does not do very well on the sample image, many searches don't work, but C3025 does. Regards, Joe
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grant FullenNONEAuthor Commented:
Hey Joe THANKS for the effort with the code.
I am hoping to get some help with a c# solution .
0
Joe Winograd, Fellow&MVEDeveloperCommented:
You're welcome, Grant. I'm sure some C# experts will be along soon. Regards, Joe
0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Grant FullenNONEAuthor Commented:
SIDE NOTE TO JOE.
HEy i just found about the free community edition of delphi.
https://www.youtube.com/watch?v=XMj8RlJO-zQ
0
Joe Winograd, Fellow&MVEDeveloperCommented:
Thanks for the heads-up, Grant. I was unaware of that edition. I'll give it a spin. Regards, Joe
0
Grant FullenNONEAuthor Commented:
Any C# experts who may have an ideal ?
0
Grant FullenNONEAuthor Commented:
Thanks for your help
0
Joe Winograd, Fellow&MVEDeveloperCommented:
You're welcome, Grant, happy to help. Regards, Joe
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.