如何包含baseapi.h。

时间:2022-08-30 09:01:08

I followed the instructions I found in form of tessesract on how to includ baseapi.h.

我遵循了我在《如何包括baseapi.h》中发现的指导原则。

i am using:

我用:

vs2010
Version tesseract 3.01

超正方体vs2010版本3.01

i try to understand how to use baseapi.h.

我试着理解如何使用baseapi.h。

test program:

测试程序:

#define __MSW32__

 #include "baseapi.h"

using namespace  tesseract;

int _tmain(int argc, _TCHAR* argv[])

{

   TessBaseAPI *myTestApi;

   myTestApi=new TessBaseAPI();

   //myTestApi->Init("d:/temp.jpg","eng");

   return 0;

}

form gide:

身边的形式:

add the following folders to Additional Include Directories (properties) - to resolve file not found issues after including "baseapi.h"

将以下文件夹添加到其他包含目录(属性)的文件夹中,以解决在包括“baseapi.h”之后没有发现的问题。

tesseract-3.01/api

超正方体- 3.01 / api

tesseract-3.01/ccmain

超正方体- 3.01 / ccmain

tesseract-3.01/ccutil

超正方体- 3.01 / ccutil

tesseract-3.01/ccstruct 如何包含baseapi.h。

超正方体- 3.01 / ccstruct

added the following libs to "Properties/Linker/Input/Additional Dependancies" in order to use the Tesseract and Leptonica libs libtesseract.lib;liblept.lib

为了使用Tesseract和Leptonica libs libtesseract.lib,将以下libs添加到“属性/链接/输入/附加依赖项”中。

如何包含baseapi.h。 // added the following paths to "Properties/Linker/General/Additional Library Directories" in order to find the Tesseract and Leptonica libs tesseract-3.01/vs2010/Release tesseract-3.01/vs2008/lib

//为了找到Tesseract和Leptonica libs Tesseract -3.01/vs2008/ vs2008/lib,以下路径添加到“Properties/Linker/General/ add Library目录”中。

如何包含baseapi.h。

And I try to run now

现在我试着跑。

如何包含baseapi.h。

So I try to find libs libtesseract.lib and replaced with libtesseract_tessopt.lib and then run 如何包含baseapi.h。

所以我试图找到libs libtesseract。lib并替换为libtesseract_tessopt。*,然后运行

1>------ Build started: Project: test4, Configuration: Debug Win32 ------
1>  test4.cpp
1>test4.obj : error LNK2019: unresolved external symbol "public: __thiscall tesseract::TessBaseAPI::TessBaseAPI(void)" (??0TessBaseAPI@tesseract@@QAE@XZ) referenced in function _wmain
1>c:\users\eran0708\documents\visual studio 2010\Projects\test4\Debug\test4.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Is anything known solution to the problem?

有什么方法能解决这个问题吗?

thanks,

谢谢,

eran

伊兰

![enter image description here][6]

![在这里输入图像描述][6]

![enter image description here][7]

![在这里输入图像描述][7]

2 个解决方案

#1


3  

This is what I did to compile it:

这就是我所做的编译:

1.) Copy all header files into one includedirectory, so later only §(TESS_DIR)\include has to be added to the include directories.

1)。所有头文件复制到一个includedirectory,所以后来只有§(TESS_DIR)\包括必须添加到目录。

copy the leptonica headers into $(TESS_DIR)\include\leptonica.

将leptonica标题复制到$(TESS_DIR)\包括\leptonica。

2.) Open vs2010\tesseract.sln and compile all configurations. Then copy all lib files into $(TESS_DIR)\lib\debug and $(TESS_DIR)\lib\release. Then add those directories to the build settings.

2)。打开vs2010 \超正方体。sln并编译所有配置。然后将所有lib文件复制到$(TESS_DIR)\lib\debug和$(TESS_DIR)\lib\release。然后将这些目录添加到构建设置中。

3.) Copy the compiled libtesseract.dll and liblept168.dll as well as the folder tessdata, containg eng.traineddata, to the Release folder of your project.

3)。复制libtesseract编译。dll和liblept168。dll和文件夹tessdata, containg eng。培训数据,到项目的发布文件夹。

4.) Add these libraries as additional dependencies:

4)。添加这些库作为附加的依赖项:

libtesseract.lib
liblept168.lib

5.) #include <baseapi.h>

5)# include < baseapi.h >

#2


0  

I figured it out, if you are using visual studios 2010 and are using windows forms / designer you can add it easily this way with no issues

我想出来了,如果你使用的是visual studio 2010,并且使用windows窗体/设计器,你可以很容易地以这种方式添加它,没有问题。

1) add the following projects to your project ( i am warning you once, do not add the tesseract solution, or change any setting in the projects you add, unless you love to hate yourself ) ccmain ccstruct ccutil classify cube cutil dict image libtesseract nutral_networks textord viewer wordrec

1)将以下项目添加到您的项目中(我警告过您一次,不要添加tesseract解决方案,或者更改您添加的项目中的任何设置,除非您喜欢自己讨厌自己)ccstruct ccutil将cube cutil定义为libtesseract nutral_networks textord viewer wordrec。

you can add the others but you don’t really want all that built into your project do you? naaa, build those separately

你可以添加其他的,但是你并不是真的想把所有的东西都建在你的项目中,对吧?naaa,分别构建这些

2) go to your project properties and add libtesseract as a reference, you can now that it is visible as a project, this will make it so that your project builds fast without examining the millions of warnings within tesseract. [common properties]->[add reference]

2)进入你的项目属性并添加libtesseract作为参考,你现在可以看到它是一个项目,这将使它使你的项目快速构建,而不需要检查tesseract中数以百万计的警告。[公共属性]- >[添加参考)

3) right click your project in the solution explorer and click project dependencies, make sure it is dependant on libtesseract or even all of them, it just means they build before your project.

3)右键单击解决方案资源管理器中的项目,单击项目依赖项,确保它依赖于libtesseract,甚至是所有的项目依赖项,这只是意味着它们在您的项目之前构建。

4) the tesseract 2010 visual studio projects contain a number of configuration settings aka release, release.dll, debug, debug.dll, it seems that the release.dll settings produce the right files. First, set the solution output to release.dll. Click your project properties. Then click configuration manager. If that is not available, do this, click the SOLUTION's properties in the solution tree and click configuration tab, you will see a list of projects and the associated configuration settings. You will notice your project is not set to release.dll even though the output is. If you took the second route you still need to click configuration manager. Then you can edit the settings, click new on your projects settings and call it release.dll...exactly the same as the rest of them and copy the settings from release. Do the same thing for Debug, so that you have a debug.dll name copied from debug settings. wheew...almost done

4)tesseract 2010 visual studio项目包含许多配置设置,即发布、发布。dll、调试调试。dll,似乎是释放。dll设置生成正确的文件。首先,将解决方案输出设置为release.dll。点击你的项目属性。然后单击配置管理器。如果这是不可用的,那么在解决方案树中单击解决方案的属性并单击configuration选项卡,您将看到一个项目列表和相关的配置设置。您将注意到您的项目不会被释放。即使输出是。如果您选择了第二条路,您仍然需要单击configuration manager。然后你可以编辑设置,在你的项目设置上点击new,然后调用它。与其余部分完全相同,并从发行版复制设置。对调试执行相同的操作,以便进行调试。从调试设置中复制的dll名称。wheew……差不多做完了

5) Don’t try to change tesseracts settings to match yours....that wont work ....and when the new release comes out you wont be able to just "throw it in" and go. Accept the fact that in this state your new modes are Release.dll and Debug.dll. don’t stress out...you can go back when its is finished and remove the projects from your solution.

5)不要试图改变超正方体的设置来匹配你的....不会工作....当新发布出来的时候,你就不可能把它扔进去。接受这样的事实:在这种状态下,您的新模式将被释放。dll和Debug.dll。不要紧张…当它完成并从您的解决方案中移除项目时,您可以返回。

6) Guess where the libraries and dll’s come out? in your project, you may or may not need to add the library directories. Some people say to dump all the headers into a single folder so they only need to add one folder to the includes but not me. I want to be able to delete the tesseract folder and reload it from the zips without extra work....and be fully ready to update in one move or restore it if I made a mess of the code. Its a bit of work and you can to it with code instead of the settings which is the way i do it, but you should include all the folders that contain header files within the 2010 tesseract project folder and leave them alone.

6)猜猜库和dll是在哪里出来的?在您的项目中,您可能需要或不需要添加库目录。有些人说把所有的头文件都放到一个文件夹里,这样他们只需要给其中一个文件夹添加一个文件夹,而不是我。我希望能够删除超正方体文件夹并重新加载它的拉链没有额外的工作....如果我把代码弄得一团糟,就可以随时更新或恢复它。它有一点工作,你可以用代码代替设置,这是我的方法,但是你应该包括所有包含了2010年tesseract项目文件夹中的头文件的文件夹,并让它们单独保存。

7) there is no need to add any files to your project. just these lines of code..... I have included some additional code that converts from one foreign data set to the tiff friendly version with no need to save / load file. aren’t I nice?

没有必要向您的项目添加任何文件。这些代码行……我已经添加了一些额外的代码,这些代码将一个外部数据集转换为tiff友好版本,不需要保存/加载文件。难道我还不够好心吗?

8) now you can fully debug in debug.dll and release.dll, once you have successfully built it into your project even once you can remove all the added projects and it will be peeerfect. no extra compiling or errors. fully debugable, all natural.

现在你可以在调试中完全调试了。dll和释放。dll,一旦你成功地将它构建到你的项目中,即使你可以移除所有添加的项目,它也会成为你的目标。没有额外的编译或错误。完全debugable,所有自然。

9) If I remember right, I could not get around the fact I had to copy the files in 2008/lib/ into my projects release folder….darn it.

9)如果我没记错的话,我无法回避我在2008/lib/到我的项目发布文件夹中不得不复制文件的事实真讨厌。

In my projects “functions.h” I put
#pragma comment (lib, "liblept.lib" ) 
#define _USE_TESSERACT_ 
#ifdef _USE_TESSERACT_ 
#pragma comment (lib, "libtesseract.lib" ) 
#include <baseapi.h> 
#endif 
#include <allheaders.h> 

in my main project I put this in a class as a member: tesseract::TessBaseAPI *readSomeNombers;

在我的主要项目中,我把它作为一个成员放在一个类中:tesseract::TessBaseAPI *readSomeNombers;

and of course I included “functions.h” somewhere

当然,我还包括了“函数”。h”的地方

then I put this in my classes constructor:

然后我把它放在类构造函数中:

readSomeNombers = new tesseract::TessBaseAPI(); 
readSomeNombers ->Init(NULL, "eng" ); 
readSomeNombers ->SetVariable( "tessedit_char_whitelist", "0123456789,." ); 

then I created this class member function: and a class member to serve as an output, don’t hate, I don’t like returning variables. Not my style. The memory for the pix does not need to be destroyed when used inside a member function this way I believe and my test suggest this is a safe way to call these functions. But by all means, you can do whatever.

然后我创建了这个类成员函数:一个类成员作为输出,不要讨厌,我不喜欢返回变量。不是我的风格。对于pix的内存不需要在成员函数中使用时销毁,我相信,我的测试表明这是调用这些函数的安全方法。但无论如何,你可以做任何事。

void Gaara::scanTheSpot() 
{ 
    Pix *someNewPix; 
    char* outText; 
    ostringstream tempStream; 
    RECT tempRect; 
    someNewPix = pixCreate( 200 , 40 , 32 ); 
    convertEasyBmpToPix( &scanImage, someNewPix, 87, 42 ); 

    readSomeNombers ->SetImage(someNewPix); 
    outText = readSomeNombers ->GetUTF8Text(); 
    tempStream.str(""); 
    tempStream << outText; 
    classMemeberVariable = tempStream.str(); 
//pixWrite( "test.bmp", someNewPix, IFF_BMP ); 
} 

The object that has the information that I want to scan is in memory and is pointed to by &scanImage. It is from the “EasyBMP” library but that is not important.

具有我想要扫描的信息的对象是在内存中,并被指向了&scanImage。它来自“EasyBMP”库,但这并不重要。

Which I deal with in a function in “functions.h”/ “functions.cpp” by the way, i am doing a little extra processing here while i am in the loop, namely thinning the characters and making it black and white and reversing black and white which is unnessesry. At this phase in my development I am still looking for ways to improve the recognition. Though for my proposes this has not yielded bad data yet. My view is to use the default Tess data for simplicity. I am acting heuristically to solve a very complex problem.

我在函数中处理函数。h“/”功能。顺便说一下,我在循环过程中做了一些额外的处理,就是让字符变薄,让它变黑变白,颠倒黑白,这是不需要的。在我发展的这个阶段,我仍然在寻找提高认识的方法。尽管对我的提议来说,这还没有产生糟糕的数据。我的观点是使用默认的Tess数据来简化。我的行为是为了解决一个非常复杂的问题。

void convertEasyBmpToPix( BMP *sourceImage, PIX *outputImage, unsigned startX, unsigned startY ) 
{ 
    int endX = startX + ( pixGetWidth( outputImage ) ); 
    int endY = startY + ( pixGetHeight( outputImage ) ); 
    unsigned destinationX; 
    unsigned destinationY = 0; 
    for( int yLoop = startY; yLoop < endY; yLoop++ ) 
    { 
        destinationX = 0; 
        for( int xLoop = startX; xLoop < endX; xLoop++ ) 
        { 
            if( isWhite( &( sourceImage->GetPixel( xLoop, yLoop ) ) ) ) 
            { 
                pixSetRGBPixel( outputImage, destinationX, destinationY, 0,0,0 ); 
            } 
            else 
            { 
                pixSetRGBPixel( outputImage, destinationX, destinationY, 255,255,255 ); 
            } 
            destinationX++; 
        } 
        destinationY++; 
    } 
} 
bool isWhite( RGBApixel *image ) 
{ 
    if( 
        //destination->SetPixel( x, y, source->GetPixel( xLoop, yLoop ) ); 
        ( image->Red   < 50 ) || 
        ( image->Blue  < 50 ) || 
        ( image->Green < 50 ) 
        ) 
    { 
        return false; 
    } 
    else 
    { 
        return true; 
    } 
} 

one thing i dont like is the way I declare the size of the pix outside the function. It seems if I try to do it within the function I have unexpected results....if the memory is alocated while inside it is destroed when I leave.

我不喜欢的一件事是,我声明函数外面的pix的大小。似乎如果我尝试做它在函数....意想不到的结果如果记忆在里面,当我离开的时候它被破坏了。

g m a i l Certainly not my most elegant work but I also gutted the hell out of it for simplicity. Why I bother to share this I don't know. I should have kept it to myself. What is my name? Kage.Sabaku.No.Gaara

我当然不是我最优雅的作品,但为了简单起见,我也把它弄得一团糟。为什么我要分享这个我不知道。我应该把它留给自己。我的名字是什么?Kage.Sabaku.No.Gaara

before i let you go i should mention the subtle differences between my windows form app and the default settings. namely i use "multi-byte" character set. project properties...and such..give a dog a bone, maybe a vote?

在我让你走之前,我应该提到我的windows窗体应用程序和默认设置之间的细微差别。即我使用“多字节”字符set. project属性…这样的. .给狗一根骨头,也许投票?

p.p.s. I hate to say it but I made one change to host.c if you use 64 bit you can do the same. Otherwise your on your own.....but my reason was a bit insane you dont have to, kinda silly actually

我不愿意说,但我做了一个改变。如果你用64位,你也可以这么做。否则你自己的事情……但我的理由有点疯狂你不必,有点傻。

typedef unsigned int uinT32; 
#if (_MSC_VER >= 1200)            //%%% vkr for VC 6.0 
typedef _int64 inT64; 
typedef unsigned _int64 uinT64; 
#else 
typedef long long int inT64; 
typedef unsigned long long int uinT64; 
#endif                           //%%% vkr for VC 6.0 
typedef float FLOAT32; 
typedef double FLOAT64; 
typedef unsigned char BOOL8; 

#1


3  

This is what I did to compile it:

这就是我所做的编译:

1.) Copy all header files into one includedirectory, so later only §(TESS_DIR)\include has to be added to the include directories.

1)。所有头文件复制到一个includedirectory,所以后来只有§(TESS_DIR)\包括必须添加到目录。

copy the leptonica headers into $(TESS_DIR)\include\leptonica.

将leptonica标题复制到$(TESS_DIR)\包括\leptonica。

2.) Open vs2010\tesseract.sln and compile all configurations. Then copy all lib files into $(TESS_DIR)\lib\debug and $(TESS_DIR)\lib\release. Then add those directories to the build settings.

2)。打开vs2010 \超正方体。sln并编译所有配置。然后将所有lib文件复制到$(TESS_DIR)\lib\debug和$(TESS_DIR)\lib\release。然后将这些目录添加到构建设置中。

3.) Copy the compiled libtesseract.dll and liblept168.dll as well as the folder tessdata, containg eng.traineddata, to the Release folder of your project.

3)。复制libtesseract编译。dll和liblept168。dll和文件夹tessdata, containg eng。培训数据,到项目的发布文件夹。

4.) Add these libraries as additional dependencies:

4)。添加这些库作为附加的依赖项:

libtesseract.lib
liblept168.lib

5.) #include <baseapi.h>

5)# include < baseapi.h >

#2


0  

I figured it out, if you are using visual studios 2010 and are using windows forms / designer you can add it easily this way with no issues

我想出来了,如果你使用的是visual studio 2010,并且使用windows窗体/设计器,你可以很容易地以这种方式添加它,没有问题。

1) add the following projects to your project ( i am warning you once, do not add the tesseract solution, or change any setting in the projects you add, unless you love to hate yourself ) ccmain ccstruct ccutil classify cube cutil dict image libtesseract nutral_networks textord viewer wordrec

1)将以下项目添加到您的项目中(我警告过您一次,不要添加tesseract解决方案,或者更改您添加的项目中的任何设置,除非您喜欢自己讨厌自己)ccstruct ccutil将cube cutil定义为libtesseract nutral_networks textord viewer wordrec。

you can add the others but you don’t really want all that built into your project do you? naaa, build those separately

你可以添加其他的,但是你并不是真的想把所有的东西都建在你的项目中,对吧?naaa,分别构建这些

2) go to your project properties and add libtesseract as a reference, you can now that it is visible as a project, this will make it so that your project builds fast without examining the millions of warnings within tesseract. [common properties]->[add reference]

2)进入你的项目属性并添加libtesseract作为参考,你现在可以看到它是一个项目,这将使它使你的项目快速构建,而不需要检查tesseract中数以百万计的警告。[公共属性]- >[添加参考)

3) right click your project in the solution explorer and click project dependencies, make sure it is dependant on libtesseract or even all of them, it just means they build before your project.

3)右键单击解决方案资源管理器中的项目,单击项目依赖项,确保它依赖于libtesseract,甚至是所有的项目依赖项,这只是意味着它们在您的项目之前构建。

4) the tesseract 2010 visual studio projects contain a number of configuration settings aka release, release.dll, debug, debug.dll, it seems that the release.dll settings produce the right files. First, set the solution output to release.dll. Click your project properties. Then click configuration manager. If that is not available, do this, click the SOLUTION's properties in the solution tree and click configuration tab, you will see a list of projects and the associated configuration settings. You will notice your project is not set to release.dll even though the output is. If you took the second route you still need to click configuration manager. Then you can edit the settings, click new on your projects settings and call it release.dll...exactly the same as the rest of them and copy the settings from release. Do the same thing for Debug, so that you have a debug.dll name copied from debug settings. wheew...almost done

4)tesseract 2010 visual studio项目包含许多配置设置,即发布、发布。dll、调试调试。dll,似乎是释放。dll设置生成正确的文件。首先,将解决方案输出设置为release.dll。点击你的项目属性。然后单击配置管理器。如果这是不可用的,那么在解决方案树中单击解决方案的属性并单击configuration选项卡,您将看到一个项目列表和相关的配置设置。您将注意到您的项目不会被释放。即使输出是。如果您选择了第二条路,您仍然需要单击configuration manager。然后你可以编辑设置,在你的项目设置上点击new,然后调用它。与其余部分完全相同,并从发行版复制设置。对调试执行相同的操作,以便进行调试。从调试设置中复制的dll名称。wheew……差不多做完了

5) Don’t try to change tesseracts settings to match yours....that wont work ....and when the new release comes out you wont be able to just "throw it in" and go. Accept the fact that in this state your new modes are Release.dll and Debug.dll. don’t stress out...you can go back when its is finished and remove the projects from your solution.

5)不要试图改变超正方体的设置来匹配你的....不会工作....当新发布出来的时候,你就不可能把它扔进去。接受这样的事实:在这种状态下,您的新模式将被释放。dll和Debug.dll。不要紧张…当它完成并从您的解决方案中移除项目时,您可以返回。

6) Guess where the libraries and dll’s come out? in your project, you may or may not need to add the library directories. Some people say to dump all the headers into a single folder so they only need to add one folder to the includes but not me. I want to be able to delete the tesseract folder and reload it from the zips without extra work....and be fully ready to update in one move or restore it if I made a mess of the code. Its a bit of work and you can to it with code instead of the settings which is the way i do it, but you should include all the folders that contain header files within the 2010 tesseract project folder and leave them alone.

6)猜猜库和dll是在哪里出来的?在您的项目中,您可能需要或不需要添加库目录。有些人说把所有的头文件都放到一个文件夹里,这样他们只需要给其中一个文件夹添加一个文件夹,而不是我。我希望能够删除超正方体文件夹并重新加载它的拉链没有额外的工作....如果我把代码弄得一团糟,就可以随时更新或恢复它。它有一点工作,你可以用代码代替设置,这是我的方法,但是你应该包括所有包含了2010年tesseract项目文件夹中的头文件的文件夹,并让它们单独保存。

7) there is no need to add any files to your project. just these lines of code..... I have included some additional code that converts from one foreign data set to the tiff friendly version with no need to save / load file. aren’t I nice?

没有必要向您的项目添加任何文件。这些代码行……我已经添加了一些额外的代码,这些代码将一个外部数据集转换为tiff友好版本,不需要保存/加载文件。难道我还不够好心吗?

8) now you can fully debug in debug.dll and release.dll, once you have successfully built it into your project even once you can remove all the added projects and it will be peeerfect. no extra compiling or errors. fully debugable, all natural.

现在你可以在调试中完全调试了。dll和释放。dll,一旦你成功地将它构建到你的项目中,即使你可以移除所有添加的项目,它也会成为你的目标。没有额外的编译或错误。完全debugable,所有自然。

9) If I remember right, I could not get around the fact I had to copy the files in 2008/lib/ into my projects release folder….darn it.

9)如果我没记错的话,我无法回避我在2008/lib/到我的项目发布文件夹中不得不复制文件的事实真讨厌。

In my projects “functions.h” I put
#pragma comment (lib, "liblept.lib" ) 
#define _USE_TESSERACT_ 
#ifdef _USE_TESSERACT_ 
#pragma comment (lib, "libtesseract.lib" ) 
#include <baseapi.h> 
#endif 
#include <allheaders.h> 

in my main project I put this in a class as a member: tesseract::TessBaseAPI *readSomeNombers;

在我的主要项目中,我把它作为一个成员放在一个类中:tesseract::TessBaseAPI *readSomeNombers;

and of course I included “functions.h” somewhere

当然,我还包括了“函数”。h”的地方

then I put this in my classes constructor:

然后我把它放在类构造函数中:

readSomeNombers = new tesseract::TessBaseAPI(); 
readSomeNombers ->Init(NULL, "eng" ); 
readSomeNombers ->SetVariable( "tessedit_char_whitelist", "0123456789,." ); 

then I created this class member function: and a class member to serve as an output, don’t hate, I don’t like returning variables. Not my style. The memory for the pix does not need to be destroyed when used inside a member function this way I believe and my test suggest this is a safe way to call these functions. But by all means, you can do whatever.

然后我创建了这个类成员函数:一个类成员作为输出,不要讨厌,我不喜欢返回变量。不是我的风格。对于pix的内存不需要在成员函数中使用时销毁,我相信,我的测试表明这是调用这些函数的安全方法。但无论如何,你可以做任何事。

void Gaara::scanTheSpot() 
{ 
    Pix *someNewPix; 
    char* outText; 
    ostringstream tempStream; 
    RECT tempRect; 
    someNewPix = pixCreate( 200 , 40 , 32 ); 
    convertEasyBmpToPix( &scanImage, someNewPix, 87, 42 ); 

    readSomeNombers ->SetImage(someNewPix); 
    outText = readSomeNombers ->GetUTF8Text(); 
    tempStream.str(""); 
    tempStream << outText; 
    classMemeberVariable = tempStream.str(); 
//pixWrite( "test.bmp", someNewPix, IFF_BMP ); 
} 

The object that has the information that I want to scan is in memory and is pointed to by &scanImage. It is from the “EasyBMP” library but that is not important.

具有我想要扫描的信息的对象是在内存中,并被指向了&scanImage。它来自“EasyBMP”库,但这并不重要。

Which I deal with in a function in “functions.h”/ “functions.cpp” by the way, i am doing a little extra processing here while i am in the loop, namely thinning the characters and making it black and white and reversing black and white which is unnessesry. At this phase in my development I am still looking for ways to improve the recognition. Though for my proposes this has not yielded bad data yet. My view is to use the default Tess data for simplicity. I am acting heuristically to solve a very complex problem.

我在函数中处理函数。h“/”功能。顺便说一下,我在循环过程中做了一些额外的处理,就是让字符变薄,让它变黑变白,颠倒黑白,这是不需要的。在我发展的这个阶段,我仍然在寻找提高认识的方法。尽管对我的提议来说,这还没有产生糟糕的数据。我的观点是使用默认的Tess数据来简化。我的行为是为了解决一个非常复杂的问题。

void convertEasyBmpToPix( BMP *sourceImage, PIX *outputImage, unsigned startX, unsigned startY ) 
{ 
    int endX = startX + ( pixGetWidth( outputImage ) ); 
    int endY = startY + ( pixGetHeight( outputImage ) ); 
    unsigned destinationX; 
    unsigned destinationY = 0; 
    for( int yLoop = startY; yLoop < endY; yLoop++ ) 
    { 
        destinationX = 0; 
        for( int xLoop = startX; xLoop < endX; xLoop++ ) 
        { 
            if( isWhite( &( sourceImage->GetPixel( xLoop, yLoop ) ) ) ) 
            { 
                pixSetRGBPixel( outputImage, destinationX, destinationY, 0,0,0 ); 
            } 
            else 
            { 
                pixSetRGBPixel( outputImage, destinationX, destinationY, 255,255,255 ); 
            } 
            destinationX++; 
        } 
        destinationY++; 
    } 
} 
bool isWhite( RGBApixel *image ) 
{ 
    if( 
        //destination->SetPixel( x, y, source->GetPixel( xLoop, yLoop ) ); 
        ( image->Red   < 50 ) || 
        ( image->Blue  < 50 ) || 
        ( image->Green < 50 ) 
        ) 
    { 
        return false; 
    } 
    else 
    { 
        return true; 
    } 
} 

one thing i dont like is the way I declare the size of the pix outside the function. It seems if I try to do it within the function I have unexpected results....if the memory is alocated while inside it is destroed when I leave.

我不喜欢的一件事是,我声明函数外面的pix的大小。似乎如果我尝试做它在函数....意想不到的结果如果记忆在里面,当我离开的时候它被破坏了。

g m a i l Certainly not my most elegant work but I also gutted the hell out of it for simplicity. Why I bother to share this I don't know. I should have kept it to myself. What is my name? Kage.Sabaku.No.Gaara

我当然不是我最优雅的作品,但为了简单起见,我也把它弄得一团糟。为什么我要分享这个我不知道。我应该把它留给自己。我的名字是什么?Kage.Sabaku.No.Gaara

before i let you go i should mention the subtle differences between my windows form app and the default settings. namely i use "multi-byte" character set. project properties...and such..give a dog a bone, maybe a vote?

在我让你走之前,我应该提到我的windows窗体应用程序和默认设置之间的细微差别。即我使用“多字节”字符set. project属性…这样的. .给狗一根骨头,也许投票?

p.p.s. I hate to say it but I made one change to host.c if you use 64 bit you can do the same. Otherwise your on your own.....but my reason was a bit insane you dont have to, kinda silly actually

我不愿意说,但我做了一个改变。如果你用64位,你也可以这么做。否则你自己的事情……但我的理由有点疯狂你不必,有点傻。

typedef unsigned int uinT32; 
#if (_MSC_VER >= 1200)            //%%% vkr for VC 6.0 
typedef _int64 inT64; 
typedef unsigned _int64 uinT64; 
#else 
typedef long long int inT64; 
typedef unsigned long long int uinT64; 
#endif                           //%%% vkr for VC 6.0 
typedef float FLOAT32; 
typedef double FLOAT64; 
typedef unsigned char BOOL8;