gpt4 book ai didi

windows - Tesseract + opencv 3.0 + windows,文本模块体积小,链接错误

转载 作者:可可西里 更新时间:2023-11-01 10:05:16 25 4
gpt4 key购买 nike

我两天前在 answers.opencv.org 上发布了这篇文章,现在我也将它发布在这里。 http://answers.opencv.org/question/68634/text-contrib-module-and-tesseract/

Good afternoon to everyone. First of all, sorry for my english hehe. I've been trying to build the opencv contrib module 'text', however I haven't got sucess. Note: Other modules like xfeatures2d have never given me a problem.

My platform is windows 7 x64 and I use VS2013 as compiler, I've followed this tutorial(http://vorba.ch/2014/tesseract-3.03-vs2013.html) in order to build Tesseract 3.04 as LIB, but after compiling it succesfully, I want to generate the vproj with cmake and the problem is the following:

In CMake GUI, having previously selected opencv source, EXTRAS directory, etc etc, I don't get the vars under 'Tesseract' group set correcly (INCLUDE AND LIBS). I know it because when I click on configure, The log says "Tesseract: NO".

I've inspected the FindTesseract cmake script and I think that it doesn't work....

Please, anyone could give me a little clue about what's happening? How can I build the opencv text module to use Tesseract functions?

Also I've tried to compile text module adding link paths to Tesseract but when I want to use in my program I get link errors about undefined symbols...

This situation is taking me serveral days bothering me. Are there someone who is using text module under windows?


没人能帮帮我吗?我取得了一些进展,现在 cmake GUI,我说 Tesseract:是的。问题是我没有找到链接 leptonica 库的条目,它不在同一个 Tesseract 组中,而是在“未分组的条目”中。

好的,现在问题仍然存在,由 cmake 创建的 VS 解决方案没有正确构建文本模块,因为我可以看到 Lept lib 大约为 9Mb,TesseractLib 为 128Mb(在/MT 和调试中),但是 opencv_text300d.lib只有12Mb。出了点问题....

我不确定我必须使用哪个 tesseract 版本。我试过两种组合:liblept168-static-mtdll-debug.lib + libtesseract302-static-debug.lib和liblept171-static-mtdll-debug.lib + libtesseract304-static-debug.lib

当然,当我将文本模块链接到我的程序时,它会给我链接错误。


链接错误类似于:opencv_text300d.lib(ocr_tesseract.obj) : error LNK2019: unresolved external symbol "public: bool __cdecl tesseract::PageIterator::BoundingBox(enum tesseract::PageIteratorLevel,int *,int *,int *,int *)const "(?................................


...
#include "opencv2/text.hpp"
...
string output;
cv::Mat aux;
Ptr<OCRTesseract> ocr = OCRTesseract::create();
ocr->run(aux, output);
...

显然,我已经使用额外的包含目录、链接器额外的库目录和向文本模块输入额外的依赖项来设置我的项目。

真的,非常感谢你。

最佳答案

我遇到了同样的问题。我想到的解决方案是在文本模块中编辑 CMakeLists.txt 文件。

替换

if(${Tesseract_FOUND})
include_directories(${Tesseract_INCLUDE_DIR})
endif()

add_definitions( -DWINDOWS)
add_definitions( -DNOMINMAX)
SET(Tesseract_DIR "C:\\tesseract-build\\tesseract-ocr")
SET(Lept_DIR "C:\\tesseract-build\\lib")
include_directories(
${Tesseract_DIR}/api
${Tesseract_DIR}/ccutil/
${Tesseract_DIR}/ccstruct/
${Tesseract_DIR}/ccmain/
)
link_directories( ${Tesseract_DIR}/vs2013/bin/Win32/DLL_Release/
${Lept_DIR}/
${Lept_DIR}/Win32/
)

当你运行 Cmake 时,Tesseract 仍然是 no,Tessaract/Lept 库应该是空的。

关于windows - Tesseract + opencv 3.0 + windows,文本模块体积小,链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32038445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com