Iphone的Tesseract示例 [英] Tesseract Example for Iphone

查看:120
本文介绍了Iphone的Tesseract示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已编译tesseract在xcode中使用它: http://iphone.olipion .com / cross-compilation / tesseract-ocr

I have compiled tesseract for using it in xcode following: http://iphone.olipion.com/cross-compilation/tesseract-ocr

我获取.a文件,将其作为iphone项目中的框架导入,并更新标题搜索tesseract头文件的路径。

I obtain the .a file, import it as framework in the iphone project, and update the header search path for tesseract header files.

所以现在我需要一个简单的例子才能开始。
我无法在http:// code.google.com/p/tesseract-ocr/中找到任何内容,也无法通过Google搜索。

So now I need a simple example in order to get start. I can't find anything in http :// code.google.com/p/tesseract-ocr/ or by googling.

任何人都可以帮助我给我一个起点(代码片段)..?!
很多感谢!

Anyone can help me give me a starting point (a code snippet)..?! Many ThankS!

-
后来我发现这段代码:

-- Later i found this code:

#includebaseapi.h

TessBaseAPI :: InitWithLanguage(NULL,NULL,语言,NULL,false,0,NULL);
char * text = TessBaseAPI :: TesseractRect(imagedata,bytes_per_pixel,
bytes_per_line,0,0,
width,height);
TessBaseAPI :: End();

但是当我尝试编译时对于设备(仅插入包含上述代码的include语句)我得到以下内容:

but when I try to compile for device (only inserting include statement without the code above) i get the following:

错误:'PAGE_RES'之前的语法错误
警告:类型默认为' int'在'PAGE_RES'的声明中
警告:数据定义没有类型或存储类

error:syntax error before 'PAGE_RES' warning:type defaults to 'int' in declaration of 'PAGE_RES' warning:data definition has no type or storage class

等等BLOCK_LIST,IMAGE等。

and so on with BLOCK_LIST, IMAGE etc.

如果为模拟器编译我得到

if compile for simulator i get

错误:预期'=', 'PAGE_RES'
之前的',',','asm'或'属性'等等,BLOCK_LIST,IMAGE和TessBaseAPI

error: expected '=',',',','asm' or 'attribute' before 'PAGE_RES' and so on with BLOCK_LIST, IMAGE and TessBaseAPI

---其他更新:
我找到了包含问题的解决方案:
如果包含发生必须重命名.mm扩展名中的file.m,因为我们必须告诉xcode我们必须使用Objective -c和c ++一起。

--- Other Update: I found solution for include problem: Where the include occurs must be rename the file.m in .mm extension because we have to tell xcode that we have to use objective-c and c++ together.

推荐答案

http://github.com/nolanbrown/Tesseract-iPhone-Demo


OCRDemo是一个使用Tesseract库的演示应用程序( http://code.google .com / p / tesseract-ocr / )作为在Mac OS 10.6下使用在 http://robertcarlsen.net/2009/07/15/cross-compiling-for-iphone-dev-884

OCRDemo is a demo application that utilizes the Tesseract library (http://code.google.com/p/tesseract-ocr/) as a static library compiled under Mac OS 10.6 using the shell script found at http://robertcarlsen.net/2009/07/15/cross-compiling-for-iphone-dev-884.

该程序仅用于演示OCR库及其在iPhone上的功能,该程序未以任何方式进行优化...

The program is only meant to provide a demonstration of the OCR library and it’s abilities on the iPhone, the program is not optimized in any way...

这篇关于Iphone的Tesseract示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆