opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

Errors when compling the opencv_contrib on Ubuntu20.04

Open yuanyuan-lalala opened this issue 1 year ago • 3 comments

My computer configurations are:

  • gcc 11.1.0
  • cuda 11.8
  • cudnn 8.6.0
  • numpy 1.5.3
  • pandas 2.0.2
  • matplotlib 3.7.0
  • scipy 1.10.0

I act as this:

sudo apt-get install build-essential 
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
cd opencv-4.7.0
mkdir build
cd build
sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j8

and act like this:

$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5

Errors occurred as follows: [ 95%] Built target opencv_perf_gapi [ 95%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o [100%] Built target opencv_test_gapi In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:7, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/phase_unwrapping/misc/python/pyopencv_phase_unwrapping.hpp:2:13: error: ‘phase_unwrapping’ in namespace ‘cv’ does not name a type 2 | typedef cv::phase_unwrapping::HistogramPhaseUnwrapping::Params HistogramPhaseUnwrapping_Params; | ^~~~~~~~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:8, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/surface_matching/misc/python/pyopencv_ppf_match_3d.hpp:3:40: error: ‘ppf_match_3d’ was not declared in this scope 3 | template<> struct pyopencvVecConverter<ppf_match_3d::Pose3DPtr > | ^~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/surface_matching/misc/python/pyopencv_ppf_match_3d.hpp:3:64: error: template argument 1 is invalid 3 | template<> struct pyopencvVecConverter<ppf_match_3d::Pose3DPtr > | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/surface_matching/misc/python/pyopencv_ppf_match_3d.hpp:16:21: error: ‘ppf_match_3d’ was not declared in this scope 16 | typedef std::vector<ppf_match_3d::Pose3DPtr> vector_Pose3DPtr; | ^~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/surface_matching/misc/python/pyopencv_ppf_match_3d.hpp:16:44: error: template argument 1 is invalid 16 | typedef std::vector<ppf_match_3d::Pose3DPtr> vector_Pose3DPtr; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/surface_matching/misc/python/pyopencv_ppf_match_3d.hpp:16:44: error: template argument 2 is invalid In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:15, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:2:25: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 2 | typedef std::vectorcv::barcode::BarcodeType vector_BarcodeType; | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:2:25: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 2 | typedef std::vectorcv::barcode::BarcodeType vector_BarcodeType; | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:2:45: error: template argument 1 is invalid 2 | typedef std::vectorcv::barcode::BarcodeType vector_BarcodeType; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:2:45: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:4:44: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 4 | template<> struct pyopencvVecConvertercv::barcode::BarcodeType | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:4:44: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 4 | template<> struct pyopencvVecConvertercv::barcode::BarcodeType | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:4:64: error: template argument 1 is invalid 4 | template<> struct pyopencvVecConvertercv::barcode::BarcodeType | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 1 is invalid 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 1 is invalid 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:47: error: ‘barcode’ is not a member of ‘cv’; did you mean ‘erode’? 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~ | erode /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 1 is invalid 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:67: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:36: error: ‘std::vector’ is not a type 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:42: error: expected ‘,’ or ‘...’ before ‘<’ token 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:6: error: template-id ‘pyopencv_to<>’ for ‘bool pyopencv_to(PyObject, int)’ does not match any template declaration 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:17: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:251:6: note: candidates are: ‘template<class Tp> bool pyopencv_to(PyObject, std::vector<_Tp>&, const ArgInfo&)’ 251 | bool pyopencv_to(PyObject obj, std::vector<Tp>& value, const ArgInfo& info) | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:233:6: note: ‘bool pyopencv_to(PyObject, cv::Vec2i&, ArgInfo&)’ 233 | bool pyopencv_to(PyObject obj, cv::Vec2i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:231:6: note: ‘bool pyopencv_to(PyObject, cv::Vec2f&, ArgInfo&)’ 231 | bool pyopencv_to(PyObject obj, cv::Vec2f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:229:6: note: ‘bool pyopencv_to(PyObject, cv::Vec2d&, ArgInfo&)’ 229 | bool pyopencv_to(PyObject obj, cv::Vec2d& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:227:6: note: ‘bool pyopencv_to(PyObject, cv::Vec3i&, ArgInfo&)’ 227 | bool pyopencv_to(PyObject obj, cv::Vec3i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:225:6: note: ‘bool pyopencv_to(PyObject, cv::Vec3f&, ArgInfo&)’ 225 | bool pyopencv_to(PyObject* obj, cv::Vec3f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:223:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec3d&, ArgInfo&)’ 223 | bool pyopencv_to(PyObject* obj, cv::Vec3d& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:221:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4i&, ArgInfo&)’ 221 | bool pyopencv_to(PyObject* obj, cv::Vec4i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:219:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4f&, ArgInfo&)’ 219 | bool pyopencv_to(PyObject* obj, cv::Vec4f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:217:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4d&, ArgInfo&)’

/home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:94: error: ‘to’ is not a member of ‘PyOpenCV_Converter<cv::line_descriptor::KeyLine, void>’

/home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/barcode/misc/python/pyopencv_barcode.hpp:18:6: error: template-id ‘pyopencv_to<>’ for ‘bool pyopencv_to(PyObject*, int)’ does not match any template declaration 18 | bool pyopencv_to(PyObject o, std::vectorcv::barcode::BarcodeType& types, const ArgInfo& info) | ^~~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:17: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:251:6: note: candidates are: ‘template<class Tp> bool pyopencv_to(PyObject, std::vector<_Tp>&, const ArgInfo&)’ 251 | bool pyopencv_to(PyObject* obj, std::vector<Tp>& value, const ArgInfo& info) | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:233:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec2i&, ArgInfo&)’ 233 | bool pyopencv_to(PyObject* obj, cv::Vec2i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:231:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec2f&, ArgInfo&)’ 231 | bool pyopencv_to(PyObject* obj, cv::Vec2f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:229:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec2d&, ArgInfo&)’ 229 | bool pyopencv_to(PyObject* obj, cv::Vec2d& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:227:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec3i&, ArgInfo&)’ 227 | bool pyopencv_to(PyObject* obj, cv::Vec3i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:225:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec3f&, ArgInfo&)’ 225 | bool pyopencv_to(PyObject* obj, cv::Vec3f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:223:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec3d&, ArgInfo&)’ 223 | bool pyopencv_to(PyObject* obj, cv::Vec3d& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:221:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4i&, ArgInfo&)’ 221 | bool pyopencv_to(PyObject* obj, cv::Vec4i& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:219:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4f&, ArgInfo&)’ 219 | bool pyopencv_to(PyObject* obj, cv::Vec4f& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:217:6: note: ‘bool pyopencv_to(PyObject*, cv::Vec4d&, ArgInfo&)’ 217 | bool pyopencv_to(PyObject* obj, cv::Vec4d& v, ArgInfo& info); | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:213:6: note: ‘template<class _Tp, int cn> bool pyopencv_to(PyObject*, cv::Vec<_Tp, m>&, const ArgInfo&)’ 213 | bool pyopencv_to(PyObject* o, cv::Vec<_Tp, cn>& vec, const ArgInfo& info) | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:63:6: note: ‘template<class _Tp, int m, int n> bool pyopencv_to(PyObject*, cv::Matx<_Tp, m, n>&, const ArgInfo&)’ 63 | bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info) | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:6: note: ‘template<class T> bool pyopencv_to(PyObject*, T&, const ArgInfo&)’ 55 | bool pyopencv_to(PyObject* obj, T& p, const ArgInfo& info) { return PyOpenCV_Converter<T>::to(obj, p, info); } | ^~~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:18, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:40: error: ‘linemod’ was not declared in this scope 4 | template<> struct pyopencvVecConverterlinemod::Match | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:54: error: template argument 1 is invalid 4 | template<> struct pyopencvVecConverterlinemod::Match | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:40: error: ‘linemod’ was not declared in this scope 17 | template<> struct pyopencvVecConverterlinemod::Template | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:57: error: template argument 1 is invalid 17 | template<> struct pyopencvVecConverterlinemod::Template | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:40: error: ‘linemod’ was not declared in this scope 30 | template<> struct pyopencvVecConverterlinemod::Feature | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:56: error: template argument 1 is invalid 30 | template<> struct pyopencvVecConverterlinemod::Feature | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:44: error: ‘linemod’ was not declared in this scope 43 | template<> struct pyopencvVecConverter<Ptrlinemod::Modality > | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:61: error: template argument 1 is invalid 43 | template<> struct pyopencvVecConverter<Ptrlinemod::Modality > | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:63: error: template argument 1 is invalid 43 | template<> struct pyopencvVecConverter<Ptrlinemod::Modality > | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:21: error: ‘linemod’ was not declared in this scope 56 | typedef std::vectorlinemod::Match vector_Match; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:35: error: template argument 1 is invalid 56 | typedef std::vectorlinemod::Match vector_Match; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:56:35: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:21: error: ‘linemod’ was not declared in this scope 57 | typedef std::vectorlinemod::Template vector_Template; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:38: error: template argument 1 is invalid 57 | typedef std::vectorlinemod::Template vector_Template; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:57:38: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:21: error: ‘linemod’ was not declared in this scope 58 | typedef std::vectorlinemod::Feature vector_Feature; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:37: error: template argument 1 is invalid 58 | typedef std::vectorlinemod::Feature vector_Feature; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:58:37: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:25: error: ‘linemod’ was not declared in this scope 59 | typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:42: error: template argument 1 is invalid 59 | typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:44: error: template argument 1 is invalid 59 | typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/rgbd/misc/python/pyopencv_linemod.hpp:59:44: error: template argument 2 is invalid In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:22, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/ximgproc/misc/python/pyopencv_ximgproc.hpp:2:13: error: ‘ximgproc’ in namespace ‘cv’ does not name a type 2 | typedef cv::ximgproc::EdgeDrawing::Params EdgeDrawing_Params; | ^~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:26, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/tracking/misc/python/pyopencv_tracking.hpp:2:9: error: ‘TrackerCSRT’ does not name a type 2 | typedef TrackerCSRT::Params TrackerCSRT_Params; | ^~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/tracking/misc/python/pyopencv_tracking.hpp:3:9: error: ‘TrackerKCF’ does not name a type 3 | typedef TrackerKCF::Params TrackerKCF_Params; | ^~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:27, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/stereo/misc/python/pyopencv_stereo.hpp:2:21: error: ‘stereo’ was not declared in this scope; did you mean ‘cv::gapi::stereo’? 2 | typedef std::vectorstereo::MatchQuasiDense vector_MatchQuasiDense; | ^~~~~~ | cv::gapi::stereo In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_generated_include.h:81, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:11: /home/hitcrt/Downloads/opencv-4.7.0/modules/gapi/include/opencv2/gapi/stereo.hpp:79:19: note: ‘cv::gapi::stereo’ declared here 79 | GAPI_EXPORTS GMat stereo(const GMat& left, | ^~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:27, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/stereo/misc/python/pyopencv_stereo.hpp:2:44: error: template argument 1 is invalid 2 | typedef std::vectorstereo::MatchQuasiDense vector_MatchQuasiDense; | ^ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/stereo/misc/python/pyopencv_stereo.hpp:2:44: error: template argument 2 is invalid /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/stereo/misc/python/pyopencv_stereo.hpp:4:40: error: ‘stereo’ was not declared in this scope; did you mean ‘cv::gapi::stereo’? 4 | template<> struct pyopencvVecConverterstereo::MatchQuasiDense | ^~~~~~ | cv::gapi::stereo In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_generated_include.h:81, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:11: /home/hitcrt/Downloads/opencv-4.7.0/modules/gapi/include/opencv2/gapi/stereo.hpp:79:19: note: ‘cv::gapi::stereo’ declared here 79 | GAPI_EXPORTS GMat stereo(const GMat& left, | ^~~~~~ In file included from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:27, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/stereo/misc/python/pyopencv_stereo.hpp:4:63: error: template argument 1 is invalid 4 | template<> struct pyopencvVecConverterstereo::MatchQuasiDense | ^ In file included from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:17: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp: In instantiation of ‘bool pyopencv_to(PyObject*, T&, const ArgInfo&) [with T = cv::line_descriptor::KeyLine; PyObject = _object]’: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:283:25: required from ‘bool pyopencv_to_generic_vec(PyObject*, std::vector<_Tp>&, const ArgInfo&) [with Tp = cv::line_descriptor::KeyLine; PyObject = _object]’ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/line_descriptor/misc/python/pyopencv_LSDDetector.hpp:7:39: required from here /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:94: error: ‘to’ is not a member of ‘PyOpenCV_Converter<cv::line_descriptor::KeyLine, void>’ 55 | bool pyopencv_to(PyObject* obj, T& p, const ArgInfo& info) { return PyOpenCV_Converter<T>::to(obj, p, info); } | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp: In instantiation of ‘PyObject* pyopencv_from(const T&) [with T = cv::line_descriptor::KeyLine; PyObject = _object]’: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:326:39: required from ‘PyObject* pyopencv_from_generic_vec(const std::vector<_Tp>&) [with Tp = cv::line_descriptor::KeyLine; PyObject = _object]’ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/line_descriptor/misc/python/pyopencv_LSDDetector.hpp:12:41: required from here /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:58:75: error: ‘from’ is not a member of ‘PyOpenCV_Converter<cv::line_descriptor::KeyLine, void>’ 58 | PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp: In instantiation of ‘bool pyopencv_to(PyObject*, T&, const ArgInfo&) [with T = cv::mcc::CChecker; PyObject = _object]’: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:107:27: required from ‘static bool PyOpenCV_Converter<cv::Ptr<_Tp> >::to(PyObject*, cv::Ptr<_Tp>&, const ArgInfo&) [with T = cv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:94: required from ‘bool pyopencv_to(PyObject*, T&, const ArgInfo&) [with T = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:283:25: required from ‘bool pyopencv_to_generic_vec(PyObject*, std::vector<_Tp>&, const ArgInfo&) [with Tp = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/misc/python/pyopencv_cchecker.hpp:9:39: required from here /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:94: error: ‘to’ is not a member of ‘PyOpenCV_Converter<cv::mcc::CChecker, void>’ 55 | bool pyopencv_to(PyObject* obj, T& p, const ArgInfo& info) { return PyOpenCV_Converter<T>::to(obj, p, info); } | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp: In instantiation of ‘PyObject* pyopencv_from(const T&) [with T = cv::mcc::CChecker; PyObject = _object]’: /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:100:29: required from ‘static PyObject* PyOpenCV_Converter<cv::Ptr<_Tp> >::from(const cv::Ptr<_Tp>&) [with T = cv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:58:75: required from ‘PyObject* pyopencv_from(const T&) [with T = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:326:39: required from ‘PyObject* pyopencv_from_generic_vec(const std::vector<_Tp>&) [with Tp = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/misc/python/pyopencv_cchecker.hpp:14:41: required from here /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:58:75: error: ‘from’ is not a member of ‘PyOpenCV_Converter<cv::mcc::CChecker, void>’ 58 | PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/c++allocator.h:33, from /usr/include/c++/11/bits/allocator.h:46, from /usr/include/c++/11/string:41, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/pycompat.hpp:47, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.hpp:38, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:5: /usr/include/c++/11/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = cv::mcc::CChecker; _Args = {}; _Tp = cv::mcc::CChecker]’: /usr/include/c++/11/bits/alloc_traits.h:512:17: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = cv::mcc::CChecker; _Args = {}; _Tp = cv::mcc::CChecker; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocatorcv::mcc::CChecker]’ /usr/include/c++/11/bits/shared_ptr_base.h:519:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = cv::mcc::CChecker; _Alloc = std::allocatorcv::mcc::CChecker; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:650:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = cv::mcc::CChecker; _Alloc = std::allocatorcv::mcc::CChecker; _Args = {}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:1337:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocatorcv::mcc::CChecker; _Args = {}; _Tp = cv::mcc::CChecker; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr.h:409:59: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/c++/11/bits/shared_ptr.h:876:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = cv::mcc::CChecker; _Args = {}]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/core/include/opencv2/core/cvstd_wrapper.hpp:146:43: required from ‘cv::Ptr<_Tp> cv::makePtr(const A1& ...) [with _Tp = cv::mcc::CChecker; A1 = {}]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:106:27: required from ‘static bool PyOpenCV_Converter<cv::Ptr<_Tp> >::to(PyObject*, cv::Ptr<_Tp>&, const ArgInfo&) [with T = cv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:55:94: required from ‘bool pyopencv_to(PyObject*, T&, const ArgInfo&) [with T = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2_convert.hpp:283:25: required from ‘bool pyopencv_to_generic_vec(PyObject*, std::vector<_Tp>&, const ArgInfo&) [with Tp = cv::Ptrcv::mcc::CChecker; PyObject = _object]’ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/misc/python/pyopencv_cchecker.hpp:9:39: required from here /usr/include/c++/11/ext/new_allocator.h:156:11: error: invalid new-expression of abstract class type ‘cv::mcc::CChecker’ 156 | { ::new((void *)__p) _Up(std::forward<_Args>(args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_detector.hpp:32, from /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc.hpp:33, from /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/misc/python/pyopencv_cchecker.hpp:1, from /home/hitcrt/Downloads/opencv-4.7.0/build/modules/python_bindings_generator/pyopencv_custom_headers.h:16, from /home/hitcrt/Downloads/opencv-4.7.0/modules/python/src2/cv2.cpp:88: /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:64:20: note: because the following virtual functions are pure within ‘cv::mcc::CChecker’: 64 | class CV_EXPORTS_W CChecker | ^~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:83:26: note: ‘virtual void cv::mcc::CChecker::setTarget(cv::mcc::TYPECHART)’ 83 | CV_WRAP virtual void setTarget(TYPECHART target) = 0; | ^~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:84:26: note: ‘virtual void cv::mcc::CChecker::setBox(std::vector<cv::Point >)’ 84 | CV_WRAP virtual void setBox(std::vector<Point2f> _box) = 0; | ^~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:85:26: note: ‘virtual void cv::mcc::CChecker::setChartsRGB(cv::Mat)’ 85 | CV_WRAP virtual void setChartsRGB(Mat _chartsRGB) = 0; | ^~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:86:26: note: ‘virtual void cv::mcc::CChecker::setChartsYCbCr(cv::Mat)’ 86 | CV_WRAP virtual void setChartsYCbCr(Mat _chartsYCbCr) = 0; | ^~~~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:87:26: note: ‘virtual void cv::mcc::CChecker::setCost(float)’ 87 | CV_WRAP virtual void setCost(float _cost) = 0; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:88:26: note: ‘virtual void cv::mcc::CChecker::setCenter(cv::Point2f)’ 88 | CV_WRAP virtual void setCenter(Point2f center) = 0; | ^~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:90:31: note: ‘virtual cv::mcc::TYPECHART cv::mcc::CChecker::getTarget()’ 90 | CV_WRAP virtual TYPECHART getTarget() = 0; | ^~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:91:42: note: ‘virtual std::vector<cv::Point > cv::mcc::CChecker::getBox()’ 91 | CV_WRAP virtual std::vector<Point2f> getBox() = 0; | ^~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:92:25: note: ‘virtual cv::Mat cv::mcc::CChecker::getChartsRGB()’ 92 | CV_WRAP virtual Mat getChartsRGB() = 0; | ^~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:93:25: note: ‘virtual cv::Mat cv::mcc::CChecker::getChartsYCbCr()’ 93 | CV_WRAP virtual Mat getChartsYCbCr() = 0; | ^~~~~~~~~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:94:27: note: ‘virtual float cv::mcc::CChecker::getCost()’ 94 | CV_WRAP virtual float getCost() = 0; | ^~~~~~~ /home/hitcrt/Downloads/opencv_contrib-4.7.0/modules/mcc/include/opencv2/mcc/checker_model.hpp:95:29: note: ‘virtual cv::Point2f cv::mcc::CChecker::getCenter()’ 95 | CV_WRAP virtual Point2f getCenter() = 0; | ^~~~~~~~~ make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/build.make:76: modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:8201: modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2 make: *** [Makefile:166: all] Error 2

How can I solve this problem???

yuanyuan-lalala avatar Jul 03 '23 00:07 yuanyuan-lalala

Hi, this problem is reproduced in my environment, ubuntu 20.4. (but I tried with GCC9 instead of GCC11 and without libjasper-dev.)

Following is reproduced steps. It seems that step3 targets for only main, and step 5 targets for both main and contrib. I feel it is not goot situation to reuse same directory.

  1. mkdir build
  2. cd build
  3. cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
  4. make -j 8
  5. cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv-4.7.0-contrib/modules ..
  6. make -j 8 % Failed

Please could you try to execute cmake at once ?

  1. mkdir build
  2. cd build
  3. cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv-4.7.0-contrib/modules ..
  4. make -j 8

Kumataro avatar Jul 04 '23 13:07 Kumataro

I solved it,Thank you very much!

Hi, this problem is reproduced in my environment, ubuntu 20.4. (but I tried with GCC9 instead of GCC11 and without libjasper-dev.)

Following is reproduced steps. It seems that step3 targets for only main, and step 5 targets for both main and contrib. I feel it is not goot situation to reuse same directory.

  1. mkdir build
  2. cd build
  3. cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
  4. make -j 8
  5. cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv-4.7.0-contrib/modules ..
  6. make -j 8 % Failed

Please could you try to execute cmake at once ?

  1. mkdir build
  2. cd build
  3. cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv-4.7.0-contrib/modules ..
  4. make -j 8

yuanyuan-lalala avatar Jul 04 '23 13:07 yuanyuan-lalala

Hi, this problem is reproduced in my environment, ubuntu 20.4, my python both python2.7 and python3.8.

when I try to execute

  • cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv-4.7.0-contrib/modules -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 ..

I solved it.

dahuibigcat avatar Dec 13 '23 01:12 dahuibigcat