You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我在Linux下编译EasyPR项目时遇到的问题: 使用Ubuntu系统进行初次编译,报错如下: (check one with "x")
CMake Error at CMakeLists.txt:13 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "3.1.0".
The following configuration files were considered but not accepted:
/usr/local/lib/cmake/opencv4/OpenCVConfig.cmake, version: 4.5.1
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found suitable version "4.5.1", minimum required is "4.5.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zww/Desktop/EasyPR/build
Scanning dependencies of target thirdparty
[ 3%] Building CXX object thirdparty/CMakeFiles/thirdparty.dir/textDetect/erfilter.cpp.o
[ 7%] Building CXX object thirdparty/CMakeFiles/thirdparty.dir/xmlParser/xmlParser.cpp.o
[ 11%] Building CXX object thirdparty/CMakeFiles/thirdparty.dir/LBP/helper.cpp.o
[ 14%] Building CXX object thirdparty/CMakeFiles/thirdparty.dir/mser/mser2.cpp.o
[ 18%] Building CXX object thirdparty/CMakeFiles/thirdparty.dir/LBP/lbp.cpp.o
Scanning dependencies of target easypr
[ 22%] Building CXX object CMakeFiles/easypr.dir/src/core/core_func.cpp.o
[ 25%] Building CXX object CMakeFiles/easypr.dir/src/core/chars_identify.cpp.o
[ 29%] Building CXX object CMakeFiles/easypr.dir/src/core/chars_recognise.cpp.o
[ 33%] Building CXX object CMakeFiles/easypr.dir/src/core/chars_segment.cpp.o
[ 37%] Building CXX object CMakeFiles/easypr.dir/src/core/feature.cpp.o
[ 40%] Building CXX object CMakeFiles/easypr.dir/src/core/plate_detect.cpp.o
In file included from /usr/local/include/opencv4/opencv2/core.hpp:54,
from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
from /home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:18:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘cv::Mat libfacerec::argsort(cv::InputArray, bool)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:92:18: error: ‘CV_StsBadArg’ was not declared in this scope
92 | CV_Error(CV_StsBadArg, "cv::argsort only sorts 1D matrices.");
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:94:17: error: ‘CV_SORT_EVERY_ROW’ was not declared in this scope
94 | int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
| ^~~~~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:94:48: error: ‘CV_SORT_ASCENDING’ was not declared in this scope
94 | int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
| ^~~~~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:94:68: error: ‘CV_SORT_DESCENDING’ was not declared in this scope
94 | int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
| ^~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/opencv4/opencv2/core.hpp:54,
from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
from /home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:18:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘cv::Mat libfacerec::histc(cv::InputArray, int, int, bool)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:145:18: error: ‘CV_StsUnmatchedFormats’ was not declared in this scope
145 | CV_Error(CV_StsUnmatchedFormats, "This type is not implemented yet."); break;
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘void libfacerec::sortMatrixColumnsByIndices(cv::InputArray, cv::InputArray, cv::OutputArray)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:157:15: error: ‘CV_StsBadArg’ was not declared in this scope
157 | CV_Error(CV_StsBadArg, error_message);
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘void libfacerec::sortMatrixRowsByIndices(cv::InputArray, cv::InputArray, cv::OutputArray)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:182:15: error: ‘CV_StsBadArg’ was not declared in this scope
182 | CV_Error(CV_StsBadArg, error_message);
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘cv::Mat libfacerec::asRowMatrix(cv::InputArrayOfArrays, int, double, double)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:207:18: error: ‘CV_StsBadArg’ was not declared in this scope
207 | CV_Error(CV_StsBadArg, "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< vector<...> >).");
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:222:81: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
222 | string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
| ~^ ~
| | |
| int size_t {aka long unsigned int}
| %ld
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:222:94: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
222 | string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
| ~^ ~
| | |
| int size_t {aka long unsigned int}
| %ld
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:222:101: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
222 | string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
| ~^ ~~~~~~~~~~~~~~~~~~~~~
| | |
| int size_t {aka long unsigned int}
| %ld
In file included from /usr/local/include/opencv4/opencv2/core.hpp:54,
from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
from /home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:18:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:223:22: error: ‘CV_StsBadArg’ was not declared in this scope
223 | CV_Error(CV_StsBadArg, error_message);
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp: In function ‘cv::Mat libfacerec::asColumnMatrix(cv::InputArrayOfArrays, int, double, double)’:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:243:18: error: ‘CV_StsBadArg’ was not declared in this scope
243 | CV_Error(CV_StsBadArg, "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< vector<...> >).");
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:257:101: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
257 | string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
| ~^ ~~~~~~~~~~~~~~~~~~~~~
| | |
| int size_t {aka long unsigned int}
| %ld
In file included from /usr/local/include/opencv4/opencv2/core.hpp:54,
from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
from /home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:18:
/home/zww/Desktop/EasyPR/thirdparty/LBP/helper.cpp:258:22: error: ‘CV_StsBadArg’ was not declared in this scope
258 | CV_Error(CV_StsBadArg, error_message);
| ^~~~~~~~~~~~
/usr/local/include/opencv4/opencv2/core/base.hpp:320:42: note: in definition of macro ‘CV_Error’
320 | #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
| ^~~~
In file included from /home/zww/Desktop/EasyPR/include/easypr/core/plate.hpp:15,
from /home/zww/Desktop/EasyPR/include/easypr/core/core_func.h:5,
from /home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:3:
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp: In constructor ‘easypr::CharsIdentify::CharsIdentify()’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:22:3: note: in expansion of macro ‘LOAD_ANN_MODEL’
22 | LOAD_ANN_MODEL(ann_, kDefaultAnnPath);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:23:3: note: in expansion of macro ‘LOAD_ANN_MODEL’
23 | LOAD_ANN_MODEL(annChinese_, kChineseAnnPath);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:24:3: note: in expansion of macro ‘LOAD_ANN_MODEL’
24 | LOAD_ANN_MODEL(annGray_, kGrayAnnPath);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp: In member function ‘void easypr::CharsIdentify::LoadModel(std::string)’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:36:5: note: in expansion of macro ‘LOAD_ANN_MODEL’
36 | LOAD_ANN_MODEL(ann_, path);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp: In member function ‘void easypr::CharsIdentify::LoadChineseModel(std::string)’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:44:5: note: in expansion of macro ‘LOAD_ANN_MODEL’
44 | LOAD_ANN_MODEL(annChinese_, path);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp: In member function ‘void easypr::CharsIdentify::LoadGrayChANN(std::string)’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:143:42: error: expected primary-expression before ‘>’ token
143 | model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/chars_identify.cpp:52:5: note: in expansion of macro ‘LOAD_ANN_MODEL’
52 | LOAD_ANN_MODEL(annGray_, path);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/core_func.cpp: In function ‘cv::Mat easypr::showResult(const cv::Mat&, int)’:
/home/zww/Desktop/EasyPR/src/core/core_func.cpp:2426:27: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
2426 | namedWindow("EasyPR", CV_WINDOW_AUTOSIZE);
| ^~~~~~~~~~~~~~~~~~
make[2]: *** [thirdparty/CMakeFiles/thirdparty.dir/build.make:89: thirdparty/CMakeFiles/thirdparty.dir/LBP/helper.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 44%] Building CXX object CMakeFiles/easypr.dir/src/core/plate_judge.cpp.o
make[2]: *** [CMakeFiles/easypr.dir/build.make:76: CMakeFiles/easypr.dir/src/core/chars_identify.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/easypr.dir/build.make:63: CMakeFiles/easypr.dir/src/core/core_func.cpp.o] Error 1
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getHistogramFeatures(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:36:30: error: ‘CV_RGB2GRAY’ was not declared in this scope
36 | cvtColor(image, grayImage, CV_RGB2GRAY);
| ^~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp:41:47: error: ‘CV_THRESH_OTSU’ was not declared in this scope
41 | threshold(grayImage, img_threshold, 0, 255, CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp:41:64: error: ‘CV_THRESH_BINARY’ was not declared in this scope
41 | threshold(grayImage, img_threshold, 0, 255, CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getColorFeatures(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:53:26: error: ‘CV_BGR2HSV’ was not declared in this scope
53 | cvtColor(src, src_hsv, CV_BGR2HSV);
| ^~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getHOGFeatures(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:111:21: error: ‘cvSize’ was not declared in this scope
111 | HOGDescriptor hog(cvSize(128, 64), cvSize(16, 16), cvSize(8, 8), cvSize(8, 8), 3); //these parameters work well
| ^~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getLBPFeatures(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:136:30: error: ‘CV_RGB2GRAY’ was not declared in this scope
136 | cvtColor(image, grayImage, CV_RGB2GRAY);
| ^~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getGrayPlusProject(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:380:43: error: ‘CV_THRESH_OTSU’ was not declared in this scope
380 | threshold(grayChar, binaryChar, 0, 255, CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp:380:60: error: ‘CV_THRESH_BINARY’ was not declared in this scope
380 | threshold(grayChar, binaryChar, 0, 255, CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp: In function ‘void easypr::getLBPplusHistFeatures(const cv::Mat&, cv::Mat&)’:
/home/zww/Desktop/EasyPR/src/core/feature.cpp:445:30: error: ‘CV_RGB2GRAY’ was not declared in this scope
445 | cvtColor(image, grayImage, CV_RGB2GRAY);
| ^~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp:458:5: error: ‘CV_THRESH_OTSU’ was not declared in this scope
458 | CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/feature.cpp:458:22: error: ‘CV_THRESH_BINARY’ was not declared in this scope
458 | CV_THRESH_OTSU + CV_THRESH_BINARY);
| ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/easypr.dir/build.make:115: CMakeFiles/easypr.dir/src/core/feature.cpp.o] Error 1
In file included from /home/zww/Desktop/EasyPR/include/easypr/core/plate.hpp:15,
from /home/zww/Desktop/EasyPR/include/easypr/core/plate_judge.h:4,
from /home/zww/Desktop/EasyPR/src/core/plate_judge.cpp:1:
/home/zww/Desktop/EasyPR/src/core/plate_judge.cpp: In constructor ‘easypr::PlateJudge::PlateJudge()’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:141:34: error: expected primary-expression before ‘>’ token
141 | model = ml::SVM::load<ml::SVM>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/plate_judge.cpp:20:7: note: in expansion of macro ‘LOAD_SVM_MODEL’
20 | LOAD_SVM_MODEL(svm_, kLBPSvmPath);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/include/easypr/config.h:141:34: error: expected primary-expression before ‘>’ token
141 | model = ml::SVM::load<ml::SVM>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/plate_judge.cpp:24:7: note: in expansion of macro ‘LOAD_SVM_MODEL’
24 | LOAD_SVM_MODEL(svm_, kHistSvmPath);
| ^~~~~~~~~~~~~~
/home/zww/Desktop/EasyPR/src/core/plate_judge.cpp: In member function ‘void easypr::PlateJudge::LoadModel(std::string)’:
/home/zww/Desktop/EasyPR/include/easypr/config.h:141:34: error: expected primary-expression before ‘>’ token
141 | model = ml::SVM::load<ml::SVM>(path);
| ^
/home/zww/Desktop/EasyPR/src/core/plate_judge.cpp:33:7: note: in expansion of macro ‘LOAD_SVM_MODEL’
33 | LOAD_SVM_MODEL(svm_, path);
| ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/easypr.dir/build.make:141: CMakeFiles/easypr.dir/src/core/plate_judge.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: CMakeFiles/easypr.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:153: thirdparty/CMakeFiles/thirdparty.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
猜测类似于 ‘CV_THRESH_OTSU’ was not declared in this scope的报错是由于openCV4.5.1版本不再使用CV_前缀,但其他报错不知道是什么原因,请问有什么办法可以不重新安装openCV的3.1.0版本而解决这个问题吗?
我在Linux下编译EasyPR项目时遇到的问题:
使用Ubuntu系统进行初次编译,报错如下: (check one with "x")
修改了13行的version为4.5.1,并修改/thirdpart/CMakeList.txt对应find_package为4.5.1,可以开始build,但后来报错信息如下:
猜测类似于
‘CV_THRESH_OTSU’ was not declared in this scope
的报错是由于openCV4.5.1版本不再使用CV_前缀,但其他报错不知道是什么原因,请问有什么办法可以不重新安装openCV的3.1.0版本而解决这个问题吗?System: Ubuntu20.04.1 LTS
Compiler version/IDE: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
CMake version: 3.16.3
**OpenCV version:**4.5.1-pre
The text was updated successfully, but these errors were encountered: