Windows Python opencv_contrib install doesn't work
Hey everyone,
I've got following problem, I want to use sift/surf feature detection with Python OpenCV 3.
I followed the install-guide for installing "OpenCV from source" and built the ALL_BUILD and the INSTALL project. But nothing happened to my Python27 directory (no errors in the builds, everything was successful).
My question is: how can I install the INSTALL project to my python directory or how can I get the new cv2.pyd file which I could copy to the python directory? Or is there a known problem with a python-opencv3-contrib installation?
I deleted the cv2.pyd file which I copied to the python directory in a previous installation (prebuild binaries installation) before and after a INSTALL build but nothing changed. If I delete the file, following error will occur: "ImportError: No module named cv2".
Thank you for your help!
Looking for Mfapi.h Looking for Mfapi.h - found Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.4" (found C:/Python27/python.exe) Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.2" (found C:/Python27/python.exe) Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) ERROR: The system was unable to find the specified registry key or value. ERROR: The system was unable to find the specified registry key or value. Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) Tesseract: NO videoio: Removing WinRT API headers by default General configuration for OpenCV 3.0.0 ===================================== Version control: unknown Platform: Host: Windows 6.2 AMD64 CMake: 3.3.1 CMake generator: Visual Studio 12 2013 Win64 CMake build tool: C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe MSVC: 1800 C/C++: Built as dynamic libs?: NO C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe (ver 18.0.21005.1) C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /MP8 /MT /O2 /Ob2 /D NDEBUG /Zi C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /MP8 /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP8 /MT /O2 /Ob2 /D NDEBUG /Zi C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP8 /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 Linker flags (Release): /machine:x64 /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /INCREMENTAL:NO /debug /NODEFAULTLIB:libcmtd.lib Linker flags (Debug): /machine:x64 /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /debug /INCREMENTAL /NODEFAULTLIB:libcmt.lib Precompiled headers: YES Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32 3rdparty dependencies: zlib libjpeg libwebp libpng libtiff libjasper IlmImf OpenCV modules: To be built: hal core ...
you will need https://github.com/Itseez/opencv_contrib (since SIFT/SURF/nonfree was moved to xfeatures2d there). please see readme there, on how to add it to your cmake, and rebuild.
I followed the readme and did exactly what is written there. I configured/generated it with CMake, I followed these instruction link text, as well as I added OPENCV_EXTRA_MODULES_PATH like explained in the readme. Then I built it with VS13 (ALL_BUILD) and I buitl the install project (INSTALL) like explained in the instructions. But it didn't change anything to my Python folder, just to the opencv/build folder. And now I don't know how to install it correctly to Python with the .pyd file. But even though thank you for your fast reply
please go back to your VS13 .sln, and build the INSTALL project. this will do all the copying.
Done again.... But nothing has changed. The INSTALL didn't any copying. It only changed the opencv/build folder but nothing in the python folder... What could I do? Do I have to change something in the project? Thank you
carefully check your build logs again for errors, they are hard to spot in such a large output.
you should try a cv2.getBuildInformation() , to see, if anything changed.
then, it's not in the root python folder, but in lib/site-packages (you can even try to copy it manually there)
I checked all build logs, all the entries are like that one (no errors): Up-to-date: C:/opencv/build/install/include/opencv2/cvconfig.h and finished with that line: 1>Done Building Project "C:\opencv\build\INSTALL.vcxproj" (Build target(s)). And my cv2.getBuildInformation() is the same after the installation, it's still the prebuild binaries one. I would like to copy it manually, but the INSTALL didn't create the cv2.pyd file. Should I send you the logs? Or is there any chance to download the cv2.pyd file with included xfeatures2d?
"Should I send you the logs ?" - well, you could append the cmake output to your question (it won't fit in a comment) . maybe the problem already shows up there.
Thank you very much! I attached the configuration output to the question. I suppose there is a problem because of python version 2.7.10 ("Could NOT find PythonInterp.....") but for my project I can't use python 3.x
ah, thanks, that's indeed helpful:
it found your python exe, but not the required headers, or the python27.lib to lnk to. try to add path to those manually.
unless, " Disabled: python2 " goes away, there will be no progress. atm. it's still a cmake (find the dependancies)problem.
you will have to set:
on my box, outcome looks like this:
Yes I'm using the cmake-gui. I already added the paths manually as you can see in the recently attached image above. Nevertheless python2 is disabled.. Do I need to add more paths?