Program to Extract Text from Image using Tesseract in

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 1539
Imports Tesseract

Namespace ConsoleApplication1
Class Program
Private Shared Sub Main(args As String())
Dim testImagePath = "C\test.png"
Dim dataPath = "C\teserractdata"

Using tEngine = New TesseractEngine(dataPath, "eng", EngineMode.[Default])
'creating the tesseract OCR engine with English as the language
Using img = Pix.LoadFromFile(testImagePath)
' Load of the image file from the Pix object which is a wrapper for Leptonica PIX structure
Using page = tEngine.Process(img)
'process the specified image
Dim text = page.GetText()
'Gets the image's content as plain text.
'display the text
'Get's the mean confidence that as a percentage of the recognized text.
End Using
End Using
End Using
Catch e As Exception
Console.WriteLine("Unexpected Error: " + e.Message)
End Try
End Sub
End Class
End Namespace

Comments or Responses

Login to post response