Error installing opencv_contrib

Hi Experts

I have succesfully installed opencv on my tx2 with the following script:

https://github.com/jetsonhacks/buildOpenCVTX2

import cv2
cv2.version
‘3.4.1-dev’

I tried to install opencv_contrib with:

cmake -DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.1/modules …

But got the following error message below. Any hints?

[100%] Linking CXX shared library …/…/lib/libopencv_videostab.so
[100%] Built target opencv_videostab
Scanning dependencies of target opencv_python3
Scanning dependencies of target opencv_python2
[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o
[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/
/src2/cv2.cpp.o
In file included from /home/nvidia/opencv/opencv/build/modules/python_bindings_generator/pyopencv_custom_headers.h:6:0,
from /home/nvidia/opencv/opencv/modules/python/src2/cv2.cpp:1536:
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverterlinemod::Match
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:54: error: template argument 1 is invalid
template<> struct pyopencvVecConverterlinemod::Match
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverterlinemod::Template
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:57: error: template argument 1 is invalid
template<> struct pyopencvVecConverterlinemod::Template
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:44: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:61: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:63: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:21: error: ‘linemod’ was not declared in this scope
typedef std::vectorlinemod::Match vector_Match;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:35: error: template argument 1 is invalid
typedef std::vectorlinemod::Match vector_Match;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:35: error: template argument 2 is invalid
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:21: error: ‘linemod’ was not declared in this scope
typedef std::vectorlinemod::Template vector_Template;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:38: error: template argument 1 is invalid
typedef std::vectorlinemod::Template vector_Template;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:38: error: template argument 2 is invalid
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:25: error: ‘linemod’ was not declared in this scope
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:42: error: template argument 1 is invalid
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:44: error: template argument 1 is invalid
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:44: error: template argument 2 is invalid
In file included from /home/nvidia/opencv/opencv/build/modules/python_bindings_generator/pyopencv_custom_headers.h:6:0,
from /home/nvidia/opencv/opencv/modules/python/src2/cv2.cpp:1536:
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverterlinemod::Match
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:4:54: error: template argument 1 is invalid
template<> struct pyopencvVecConverterlinemod::Match
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:40: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverterlinemod::Template
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:17:57: error: template argument 1 is invalid
template<> struct pyopencvVecConverterlinemod::Template
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:44: error: ‘linemod’ was not declared in this scope
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:61: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:30:63: error: template argument 1 is invalid
template<> struct pyopencvVecConverter<Ptrlinemod::Modality >
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:21: error: ‘linemod’ was not declared in this scope
typedef std::vectorlinemod::Match vector_Match;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:35: error: template argument 1 is invalid
typedef std::vectorlinemod::Match vector_Match;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:43:35: error: template argument 2 is invalid
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:21: error: ‘linemod’ was not declared in this scope
typedef std::vectorlinemod::Template vector_Template;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:38: error: template argument 1 is invalid
typedef std::vectorlinemod::Template vector_Template;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:44:38: error: template argument 2 is invalid
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:25: error: ‘linemod’ was not declared in this scope
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:42: error: template argument 1 is invalid
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:44: error: template argument 1 is invalid
typedef std::vector<Ptrlinemod::Modality > vector_Ptr_Modality;
^
/home/nvidia/opencv_contrib-3.4.1/modules/rgbd/misc/python/pyopencv_linemod.hpp:45:44: error: template argument 2 is invalid
modules/python3/CMakeFiles/opencv_python3.dir/build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir//src2/cv2.cpp.o’ failed
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/
/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:10283: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all’ failed
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o’ failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/
/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:10176: recipe for target ‘modules/python2/CMakeFiles/opencv_python2.dir/all’ failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:162: recipe for target ‘all’ failed
make: *** [all] Error 2

Since opencv is a 3rd-party lib, please refer to below suggestion.