Text Extraction from Image

Mugilan Deiva
Mugilan Deiva used Ask the Experts™
I have tried a simple OCR program from youtube. Here, i am getting 'type expected' ERROR near Graphics. please help in this regards. I am using Visual Studio 2012.

Imports Emgu.CV
Imports Emgu.Util
Imports Emgu.CV.OCR
Imports Emgu.CV.Structure
Public Class Form1
    Dim OCRz As Tesseract = New Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_DEFAULT)
    Dim pic As Bitmap = New Bitmap(270, 100)
    Dim gfx As Graphics = Graphics.FromImage(pic)

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        gfx.CopyFromScreen(New Point(Me.Location.X + PictureBox1.Location.X + 4, PictureBox1.Location.Y + 30), New Point(0, 0), pic.Size)
        PictureBox1.Image = pic
        PictureBox1.Image = Nothing
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        OCRz.Recognize(New Image(Of Bgr, Byte)(pic))
        RichTextBox1.Text = OCRz.GetText
    End Sub
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fellow 2017
Most Valuable Expert 2018
Hi Mugilan,

I use Capture2Text:

Works extremely well! I also like that it is written in AutoHotkey, my favorite programming/scripting language these days, so it is possible for me to make changes to the core software, if needed. However, for most folks, the pre-compiled Windows binary (Capture2Text.exe) is sufficient. If you're not familiar with AutoHotkey and want to learn about it, this article will help:

AutoHotkey - Getting Started

But, as I said earlier, knowledge of AutoHotkey is not required to run the stand-alone, compiled app, which works great. There's no installation — simply running the EXE places an icon in the system tray from which you may control the app via its right-click context menu, which looks like this:

Capture2Text system tray context menu
Regards, Joe
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

I can confirm that the proposed solution works extremely well. I have been using it for quite a while with excellent results.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial