- Home /
Tesseract for Unity
Here i like to know about how to implement Tesseract for Unity.
I found a link
But not a sample , they have given a dll, After importing the Dll i have followed the below code but getting some errors,
public string GetText(Bitmap imgsource)
{
var ocrtext = string.Empty;
using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default))
{
using (var img = PixConverter.ToPix(imgsource))
{
using (var page = engine.Process(img))
{
ocrtext = page.GetText();
}
}
}
return ocrtext;
}
Error is
Assets\Scripts\TesseractOCR.cs(20,27): error CS0246: The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)
But there is no error in Visual Studio, it shows only in Editior.
I have placed the tesseract plugin and System.drawing plugin inside Assets\Plugins
How to solve this.
Thanks & Regards,
Nandha
Yes i have added both dlls in plugins folder inside the Assets. Now there is an only error with Bitmap
i mean the usings in the top, even if you include the dlls those dlls are inside namespaces
using System.Drawing;
Note that "System.Drawing.Bitmap" is just a managed C# wrapper for Windows GDI+ bitmap. So you most likely are restricted to windows builds and will introduce tons of other dependencies you're missing. As you can see on the docs page, the Bitmap class itself already requires two assemblies: System.Drawing.dll and System.Drawing.Common.dll. However those could have several other dependencies on the actual .NET framework. So it also matters which assemblies you copied into your project, the .NET versions or the $$anonymous$$ono versions (if they exists). Are you sure that the Tesseract engine doesn't have a different way how you can provide it with the image data? I would highly recommend to get rid of the System.Drawing dependency if possible.
Your answer
Follow this Question
Related Questions
Unity3d and monodevelop c# scripting on ubuntu 16.04 IntelliSense problems 0 Answers
Vuforia Target Image scene not appearing in game 0 Answers
Making Everything Public 0 Answers
Making the player change his movement when it hit an object with collider 0 Answers
How can I Update c# version? 2 Answers