2017-06-20 261 views
0

我运行opencv 3.2.0,ubuntu 14.04和最新的opencv_contrib。OpenCV错误:ERClassifierNM1中的错误参数

我运行检查: https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/textdetection.py

但它具有显示错误:

$ python textdetection.py scenetext_word01.jpg 

textdetection.py 
    A demo script of the Extremal Region Filter algorithm described in: 
    Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012 
Extracting Class Specific Extremal Regions from 9 channels ... 
(...) this may take a while (...) 
OpenCV Error: Bad argument (Default classifier file not found!) in ERClassifierNM1, file /home/vietnam/opencv_and_contri/opencv_contrib/modules/text/src/erfilter.cpp, line 1022 
Traceback (most recent call last): 
    File "textdetection.py", line 38, in <module> 
    erc1 = cv2.text.loadClassifierNM1(pathname+'/trained_classifierNM1.xml') 
cv2.error: /home/vietnam/opencv_and_contri/opencv_contrib/modules/text/src/erfilter.cpp:1022: error: (-5) Default classifier file not found! in function ERClassifierNM1 

如何解决这个问题?在cv2.text.loadClassifierNM1()和cv2.text.loadClassifierNM2() 参数使用相对路径所以,现在的那部分代码

回答

0

尝试看起来是这样的:

erc1 = cv2.text.loadClassifierNM1('./trained_classifierNM1.xml') 
er1 = cv2.text.createERFilterNM1(erc1,16,0.00015,0.13,0.2,True,0.1) 

erc2 = cv2.text.loadClassifierNM2('./trained_classifierNM2.xml') 
er2 = cv2.text.createERFilterNM2(erc2,0.5) 

我不是肯定为什么这个工程(它对我来说),但我看过在VS2015发布类似问题的解决方案后,尝试了这里:https://github.com/cesardelgadof/OpenCVBinaries/issues/1

希望这会有所帮助。

0

试着用绝对路径例如“/usr/lib/opencv-3.2.0/opencv_contrib-3.2.0/modules/text/samples/trained_classifierNM1.xml”曾在我来说,我的Ubuntu 16.04,C++

+0

正方体的什么版本和leptonica没有你安装? – SarahData

+1

@SarahM tesseract 3.05.00 leptonica-1.74 libjpeg 8d(libjpeg-turbo 1.4.2):libpng 1.2.54:libtiff 4.0.6:zlib 1.2.8 – Aka

+0

谢谢。项目是以调试模式还是以发布模式工作?因为我安装了它们并在发布时测试了该项目(它工作正常),但不知道如何进入调试模式,特别是它需要使用cmake再次构建它们。 – SarahData