tessnet 的 C# .net 包装器
我尝试为 tessnet OCR 库编写包装器。我收到一条错误消息“无法封送‘返回值’:无法封送通用类型。”对于此代码部分,
List<Word> k = OCRWrapper.DoOCR(new Bitmap(@"C:\Data\pdf2image\auto.png"), new Rectangle(0, 0, 55, 27));
我的包装类
class OCRWrapper
{
[DllImport("TrueMarble.dll")]
public static extern List<Word> DoOCR(Bitmap b, Rectangle rec);
}
请帮助我,任何人都可以指导我编写此代码
谢谢!
I try to write wrapper for tessnet OCR library. I am getting an error saying "Cannot marshal 'return value': Generic types cannot be marshaled." for this code section
List<Word> k = OCRWrapper.DoOCR(new Bitmap(@"C:\Data\pdf2image\auto.png"), new Rectangle(0, 0, 55, 27));
My wrapper class is
class OCRWrapper
{
[DllImport("TrueMarble.dll")]
public static extern List<Word> DoOCR(Bitmap b, Rectangle rec);
}
please help me, can any one guide me to write this code
Thanx!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你走错了路,Tessnet 已经是 Tesseract 的托管类包装器。您不使用 [DllImport],只需添加对程序集的引用并直接使用类。示例代码和程序集下载位于此处。
You are on the wrong track with this, Tessnet already is a managed class wrapper around Tesseract. You don't use [DllImport], just add a reference to the assembly and use the classes directly. Sample code and assembly download is available here.
泛型类型无法编组,因为它们是 .NET 原生的。使用单词数组代替
Generic types could not be marshalled as they are native to .NET. use array of word instead