Installing Opencv With Cmake

A new version of OpenCV has been released so Time to update! (This is an updated version of the article I wrote months ago: Installing and using OpenCV 3.2 with Eclipse and MinGW on Windows 10.

Active1 year ago

I am using OpenCv 3.4.0, Python 3.6.4, Cmake 3.10.2, OpenNI-Windows-x64-2.2, SensorKinect093-Bin-Win32-v5.1.2.1, Visual Studio 2015 and Windows 10. I want to build the cv2.pyd for Python 3.6.4.

Configuring CMake to build OpenCV on Windows. From CMake, configure one time OpenCV (should already be done). Installing 3rd-party software for OpenCV on Windows. Now, let’s compile OpenCV. Open CMake-gui; set src folder as opencv_src and build folder as opencv_src/Mingw_build/. Click on Configure, choosing Eclipse CDT4 - MinGW MakeFile in the next window, then next; Wait for the entire configuration, then hit generate; Now, open the CMD, and navigate to opencv_src/Mingw_build/. I am using OpenCv 3.4.0, Python 3.6.4, Cmake 3.10.2, OpenNI-Windows-x64-2.2, SensorKinect093-Bin-Win32-v5.1.2.1, Visual Studio 2015 and Windows 10.I want to build the cv2.pyd for Python 3.6.4. I follow the step in many others way such as github and OpenCV install opencv_contrib on Windows. After configure in the Cmake, It shows the output about python 3 like this. Then you can install all the important tools and libraries needed for OpenCV (installation takes a few minutes). Sudo apt-get install build-essential git cmake pkg-config libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk2. 0-dev libatlas-base-dev gfortran. C: Users Administrator Documents OpenCV_Installation_4 opencv-master Installation x64 vc14 staticlib. This directory contains file “OpenCVConfig.cmake”. This is used by CMake to configure OpenCV_LIBS and OpenCV_INCLUDE_DIRS variables to generate project files. Click on OK, and click on OK again to close Environment Variables window. I am new to using OpenCV on Linux and I have run into the following problem: I am trying to write some first C++ applications using OpenCV. I downloaded the source code (v.3.4.5) for OpenCV from their webpage. Then I compiled the source code using CMAKE, make and make install.

Windows cmake opencv

I follow the step in many others way such as github and OpenCV install opencv_contrib on Windows

After configure in the Cmake, It shows the output about python 3 like this:

And the Cmake havn't the BUILD_opencv_python3, PYTHON3_INCLUDE_DIR and PYTHON3_LIBRARY, so I append the Bool value of BUILD_opencv_python3 and the locations of PYTHON3_INCLUDE_DIR, PYTHON3_LIBRARY manually. The locations are as followings:

After that, Cmake can't find the Libraries of Python3, albeit it have the correct location of PYTHON3_LIBRARY. The output about Python3 in Cmake like this:

How can I configure the python 3.6.4 with Cmake correctlly? I want to use deep camera so I have to compile the Opencv with OPENNI2.

I am looking for help how can I solve it? Thank you very much.

Bobby BU
Cmake
Bobby BUBobby BU

2 Answers

I give up the python 3, and install the python 2.7.14, OpenCV 3.2.0 instead.

Following the step in OpenCV install opencv_contrib on Windows is easy to install...

It take me too much time to install, I suppose that OpenCV 3.4.0 do not support for Python 3.6.4.

Bobby BUBobby BU
Installing opencv with contrib on raspberry pi

I just found this site which contains instructions:https://www.scivision.co/install-opencv-python-windows/

Windows Cmake Opencv

I was able to use the 'pip install opencv-contrib-python' command to have it auto downloaded and installed. I am using Python 3.7 (but it should also work for the version you listed) and have an anaconda environment activated. If you use anaconda, just make sure you install pip for the environment you are using and activate it before using the pip install command.

Installing Opencv With Cmake

JakeJJakeJ

Install Opencv Cmake Linux

Not the answer you're looking for? Browse other questions tagged pythonwindowsopencvcmake or ask your own question.