Which library to use to extract text from images?

戏子无情 提交于 2019-12-03 14:55:30
Taylor Bird

Try this post regarding using the C++ Google Tessaract OCR lib in C#

OCR with the Tesseract interface

For extract words from image, I use the most accurate open source OCR engine: Tesseract. Available here or directly in your packages NuGet.

And this is my function in C#, which extract words from image passed in sourceFilePath. Set EngineMode to TesseractAndCube; it detect more word than the other options.

var path = "YourSolutionDirectoryPath";
using (var engine = new TesseractEngine(path + Path.DirectorySeparatorChar + "tessdata", "fra", EngineMode.TesseractAndCube))
{
    using (var img = Pix.LoadFromFile(sourceFilePath))
    {
        using (var page = engine.Process(img))
        {
            var text = page.GetText();
            // text variable contains a string with all words found
        }
    }
}

I hope that helps.

You need OCR. There is the free Tesseract library from Google, but it's C code. You could use in a C++/CLI project and access via .NET.

This article gives some information on recognizing numbers (for Sudoku, but your problem is similar)

http://sudokugrab.blogspot.com/2009/07/how-does-it-all-work.html

you can use Microsoft Office Document Imaging (Interop.MODI.dll) in visaul studio and extract text of pictures

Document modiDocument = new Document();
modiDocument.Create(filePath);
modiDocument.OCR(MiLANGUAGES.miLANG_ENGLISH);
MODI.Image modiImage = (modiDocument.Images[0] as MODI.Image);
string extractedText = modiImage.Layout.Text;
modiDocument.Close();
return extractedText;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!