Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:
image description
in python, it says
image description
although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config: image description

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:
image description

However, it goes well in the make and make install process, I can even find these infos:
image description

opencv_python also builds, but won't work with xfeatures2d though:
image description

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:
image description

sift = cv2.xfeatures2d.SIFT_create()


in python, it says
image description

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config: image descriptionconfig:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \
-D BUILD_EXAMPLES=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:
image description

However, it goes well in the make and make install process, I can even find these infos:
image description

opencv_python also builds, but won't work with xfeatures2d though:
image description

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:

sift = cv2.xfeatures2d.SIFT_create()


in python, it says

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \

-D BUILD_EXAMPLES=ON \

-D OPENCV_ENABLE_NONFREE=ON \

-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..


In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:
image description

However, it goes well in the make and make install process, I can even find these infos:
image description

opencv_python also builds, but won't work with xfeatures2d though:
image description

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:

sift = cv2.xfeatures2d.SIFT_create()


in python, it says

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \

-D BUILD_EXAMPLES=ON \

-D OPENCV_ENABLE_NONFREE=ON \

-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:
image description

OpenCV modules:

-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto

-- Disabled: world

-- Disabled by dependency: -

-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python3 sfm viz xfeatures2d

-- Applications: tests perf_tests examples apps

-- Documentation: NO

-- Non-free algorithms: YES

However, it goes well in the make and make install process, I can even find these infos:
image description

opencv_python also builds, but won't work with xfeatures2d though:
image description

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:

sift = cv2.xfeatures2d.SIFT_create()


in python, it says

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \

-D BUILD_EXAMPLES=ON \

-D OPENCV_ENABLE_NONFREE=ON \

-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:

OpenCV modules:

-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto

-- Disabled: world

-- Disabled by dependency: -

-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python3 sfm viz xfeatures2d

-- Applications: tests perf_tests examples apps

-- Documentation: NO

-- Non-free algorithms: YES

However, it goes well in the make and make install process, I can even find these infos:
image description

opencv_python also builds, but won't work with xfeatures2d though:
image description

[100%] Linking CXX shared module ../../lib/cv2.so

[100%] Built target opencv_python2

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:

sift = cv2.xfeatures2d.SIFT_create()


in python, it says

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \

-D BUILD_EXAMPLES=ON \

-D OPENCV_ENABLE_NONFREE=ON \

-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:

OpenCV modules:

-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto

-- Disabled: world

-- Disabled by dependency: -

-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python3 sfm viz xfeatures2d

-- Applications: tests perf_tests examples apps

-- Documentation: NO

-- Non-free algorithms: YES

However, it goes well in the make and make install process, I can even find these infos:
image description

[ 78%] Built target opencv_xfeatures2d

[ 78%] Built target example_xfeatures2d_surf_matcher

[ 78%] Built target example_xfeatures2d_shape_transformation

[ 78%] Built target example_xfeatures2d_pct_signatures

[ 79%] Built target example_xfeatures2d_pct_webcam

[ 80%] Built target opencv_perf_xfeatures2d

[ 80%] Built target example_xfeatures2d_video_homography

[ 80%] Built target example_xfeatures2d_gms_matcher

[ 80%] Built target opencv_test_xfeatures2d

[ 80%] Built target example_xfeatures2d_bagofwords_classification

opencv_python also builds, but won't work with xfeatures2d though:

[100%] Linking CXX shared module ../../lib/cv2.so

[100%] Built target opencv_python2

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!

I'm compiling opencv3.4.9 and contrib3.4.9. But it doesn't work with python2.7

I solved many problems and finally, cmake, make, sudo make install, but when I run this code:

sift = cv2.xfeatures2d.SIFT_create()


in python, it says

AttributeError: 'module' object has no attribute 'xfeatures2d'


although everything works perfectly well in c++, I can totally use SIFT in c++. I wonder how I can solve this problem so that I'm able to also use SIFT in python.

here is my Cmake config:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D OPENCV_EXTRA_MODULES_PATH=/Users/lixin/Desktop/material/opencv/opencv_contrib-3.4.9/modules \

-D BUILD_EXAMPLES=ON \

-D OPENCV_ENABLE_NONFREE=ON \

-D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/ ..

In the output of Cmake, I notice something unusual, that xfeatures2d is in both To be built list and Unavailable list but I don't know why:

OpenCV modules:

-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto

-- Disabled: world

-- Disabled by dependency: -

-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python3 sfm viz xfeatures2d

-- Applications: tests perf_tests examples apps

-- Documentation: NO

-- Non-free algorithms: YES

However, it goes well in the make and make install process, I can even find these infos:

[ 78%] Built target opencv_xfeatures2d

[ 78%] Built target example_xfeatures2d_surf_matcher

[ 78%] Built target example_xfeatures2d_shape_transformation

[ 78%] Built target example_xfeatures2d_pct_signatures

[ 79%] Built target example_xfeatures2d_pct_webcam

[ 80%] Built target opencv_perf_xfeatures2d

[ 80%] Built target example_xfeatures2d_video_homography

[ 80%] Built target example_xfeatures2d_gms_matcher

[ 80%] Built target opencv_test_xfeatures2d

[ 80%] Built target example_xfeatures2d_bagofwords_classification

opencv_python also builds, but won't work with xfeatures2d though:

[100%] Linking CXX shared module ../../lib/cv2.so

[100%] Built target opencv_python2

somebody please help!! I'm so desperate now....T_T
Also, I would like to know how I can build opencv with both python2 and python3, I've tried several ways but all failed. I am using MacOS, and my python3 is built in Xcode, it seems opencv only compiles with python2 for some reason.. I've tried:
-DPYTHON_DEFAULT_EXECUTABLE
-DPYTHON3_EXECUTABLE
-DPYTHON3_NUMPY_INCLUDE_DIRS
-DPYTHON3_PACKAGES_PATH
-DPYTHON3_LIBRARIES
-DPYTHON3_INCLUDE_DIRS
-D __INSTALL_PATH_PYTHON3
-DBUILD_NEW_PYTHON_SUPPORT=ON
-DBUILD_opencv_python3=ON
-DHAVE_opencv_python3=ON and such. Please HELP!!!