In this post, we will provide step by step instructions on how to install OpenCV 3 (C++ and Python) on Windows.
If you want to install OpenCV 4 from source, please check out this tutorial: Install OpenCV from source on Windows
We have used Windows Power Shell to run commands. Alternatively, you can use the command prompt too.
Step 1: Install Visual Studio
Download and install Visual Studio 2015 community edition from https://www.visualstudio.com/vs/older-downloads/. If you are finding it difficult to search for Visual Studio 2015, use this link. If you don’t have a Visual Studio Dev Essentials account, create account and login. Run installer, select “Custom” in “type of installation”.
In next screen within Programming Languages, select Visual C++ and Python tools for Visual Studio. Click next.
Now click next. It will take some time to complete the installation.
We have finished installation of Visual Studio 2015.
Note: Since Visual Studio 2017 fails to compile Dlib, we switched back to Visual Studio 2015.
Step 2: Install CMake
Download and install CMake v3.10.0 from https://cmake.org/download/.
During installation select “Add CMake to system PATH”
Step 3: Install Anaconda (a python distribution)
Download and install Anaconda 64-bit version from https://www.anaconda.com/products/individual#Downloads.
Note: Dlib ships a prebuilt binary for Python 3 and not Python 2. Building Dlib’s Python bindings from source is a hassle as you have to build Boost.Python first.
So it is advised to install Anaconda 3. In case you want to build OpenCV’s Python bindings for Python 2, you can install Anaconda 2 as well but you won’t be able to use Dlib in Python 2.
While installing Anaconda make sure that you check both options:
- Add Anaconda to my PATH environment variable
- Register Anaconda as my default Python
Step 4: Download and extract opencv-3.3.1 and opencv_contrib-3.3.1
Go to https://github.com/opencv/opencv/releases and download opencv-3.3.1 source code zip
Go to https://github.com/opencv/opencv_contrib/releases and download opencv_contrib-3.3.1 source code zip
Extract both zip files. Although you can keep opencv and opencv_contrib folders anywhere, I suggest that you should keep both in the same directory. I have placed these two folders in “My Documents” directory.
NOTE : From hereon we will refer the path to opencv-3.3.1 folder as OPENCV_PATH. For example, in my case OPENCV_PATH is C:/Users/Vaibhaw Chandel/Documents/opencv-3.3.1
Depending upon where you have kept opencv-3.3.1 folder, this path would be different.
Step 5: Generate Visual Studio project using CMake
Run Cmake, in box “Where is the source code” write value of OPENCV_PATH (which is path to opencv-3.3.1 folder) and path to build directory. We will choose build directory as OPENCV_PATH/build
Now click configure.
You will be asked for permission to create the build folder. Click Yes.
When prompted to select a compiler, select Visual Studio 14 2015 Win64.
Click finish and in the next window keep the default parameters checked.
Click finish. Now CMake will look in the system directories and generate the makefiles.
Step 5.1: Additional changes to CMake config
We will make few changes in the default configuration generated by CMake. Click on the images to see a larger version.
- Check “INSTALL_C_EXAMPLES” and “INSTALL_PYTHON_EXAMPLES”
- In flag “OPENCV_EXTRA_MODULES_PATH”, give path of modules directory within opencv_contrib-3.3.1. In our case we have kept opencv_contrib-3.3.1 in Documents folder so path is “C:/Users/Vaibhaw Chandel/Documents/opencv_contrib-3.3.1/modules”
Now click configure to apply these changes.
- On Windows 10, opencv_saliency module fails to build. So we will disable it. Uncheck BUILD_opencv_saliency
Now click on configure again to include this change.
Step 5.2 : Add Python paths for both Python2 and Python3 (optional)
This section is only for people who want to generate OpenCV binary for both Python2 and Python 3. If you are going to use just one Python either 2 or 3, you should skip this section.
CMake was unable to find paths for my Python3 files.
So I manually added paths for Python3.
Now click configure again. After configuring is done, search opencv_python in search bar, both BUILD_opencv_python2 and BUILD_opencv_python3 will be automatically checked. Now we are sure that OpenCV binaries for both Python2 and Python 3 will be generated after compilation.
Step 5.3 : Generate build files
If CMake is able to configure without any errors it should say “Configuring done”.
Click generate.
Note: Whenever you make any changes(check/uncheck boxes or change path) to configuration generated by CMake, always click configure and generate.
Step 6: Compile OpenCV
Step 6.1:Compile opencv in Release mode
Open Windows Command Prompt (cmd).
Go to OPENCV_PATH/build directory and run this command
cmake.exe --build . --config Release --target INSTALL
Step 6.2 : Compile opencv in Debug mode
Open CMake GUI again as mentioned in Step 5.
- Search “python” in search box
- Uncheck INSTALL_PYTHON_EXAMPLES, BUILD_opencv_python3 and BUILD_opencv_python2
- Click configure
- Click generate
Now in windows command prompt
Go to OPENCV_PATH/build directory and run this command
cmake.exe --build . --config Debug --target INSTALL
Now that we have compiled OpenCV we will find out how to test a OpenCV project using CMake.
Step 7: Update System Environment Variables
Step 7.1 : Update environment variable – PATH
First of all we will add OpenCV dll files’ path to our system PATH. Press Windows Super key, search for “environment variables”
Click Environment Variables in System Properties window
Under System Variables, Select Path and click edit
Click New, and give path to OPENCV_PATH\build\install\x64\vc14\bin and click Ok. Depending upon where you have kept opencv-3.3.1 folder and what version of Visual Studio you used to compile OpenCV, this path would be different. In my case full path is:
C:\Users\Vaibhaw Chandel\Documents\opencv-3.3.1\build\install\x64\vc14\bin
Now click Ok to save. Don’t close the Environment Variables window yet. We will update OPENCV_DIR variable in next step.
Step 7.2 : Update user environment variable – OPENCV_DIR
Click New in “User Variables” (upper half of right hand side window). Under variable name write OPENCV_DIR and under variable value write OPENCV_PATH\build\install.
As you can see in my case variable value is:
C:\Users\Vaibhaw Chandel\Documents\opencv-3.3.1\build\install
This directory contains file “OpenCVConfig.cmake”. This is used by CMake to configure OpenCV_LIBS and OpenCV_INCLUDE_DIRS variables to generate project files.
Now click OK to save and close environment variables window.
Note: If you have an open Command Prompt/Power Shell window before these values were updated, you have to close and open a new Command Prompt/Power Shell window again.
Step 8: Testing C++ code
Download this redEyeRemover code and extract it into a folder.
Now open Windows Power Shell and navigate to this directory.
Create a file named CMakeLists.txt and put this code in this file.
cmake_minimum_required(VERSION 2.8)
project( redEyeRemover )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( removeRedEyes removeRedEyes.cpp )
target_link_libraries( removeRedEyes ${OpenCV_LIBS} )
This file has information about opencv’s include and library paths.
Now we will compile removeRedEyes.cpp and run it.
# create build directory
mkdir build
cd build
# create Visual Studio project files using cmake
cmake -G "Visual Studio 14 2015 Win64" ..
You can see in the screenshot below that CMake found the OpenCV on my machine.
Now we will build our application.
# build our application
cmake --build . --config Release
# once the build is complete, it will generate exe file in build\Release directory
Since our C++ code assumes that jpg files are in the current directory, we will move to directory RedEyeRemover and run removeRedEyes.exe file from there.
cd ..
.\build\Release\removeRedEyes.exe
After running the application you will see two image windows, one with red eyes and another with black eyes.
Step 9: Testing Python code
Step 9.1 : Quick check
Quick way to check whether OpenCV for Python is installed correctly or not is to import cv2 in python interpreter.
Open command prompt in Windows, run python command. This will open Python interpreter. Run these two commands
import cv2
print(cv2.__version__)
Anaconda comes with a feature-rich Python interpreter called IPython. I tested these commands in IPython.
If OpenCV for Python is installed correctly, running command “import cv2” will give no errors. If any error comes up it means installation failed.
Step 9.2 : Testing redEyeRemover application
Open Windows Power Shell and navigate to directory where you have extracted RedEyeRemover.zip
Now run python code like this:
python .\removeRedEyes.py
If the program runs successfully, you will see two image windows one with red-eyes other with black eyes.
https://uploads.disquscdn.com/images/468e6918e3f737d88af00c85c9c42373d6e14aa1bcfa0917a21fa587d3d0d6fb.jpg
I got as far as step 6.3 and when trying the debug build I got 164 errors. Mostly errors start with- “cannot open input file ‘….libReleaseopencv_…'” and “cmd.exe” exited with code 1.
At what step did you face this error? Is it step 6.3?
From the screenshot I can see that you were building OpenCV in Release mode (step 6.4).
“cannot open input file…” error message generally appears due to 2 reasons:
1. File not present at given path OR
2. File is present but that file corresponds to different platform (x86, x64)
Getting to know the exact step where this error occurred will help in troubleshooting.
I’m getting below error while installing “Step 6.3: Build OpenCV in debug mode” on Win32 machine
https://uploads.disquscdn.com/images/44944ff30f05f5880ff87b723bd084ea41d130a310ec6742528a56996f7b18ab.png https://uploads.disquscdn.com/images/b6c4b3a9f237edcd346ba1f6096c9082a7f4983d787c4f7296d6481697183a29.png
I did not get any issues in previous steps
It seems to be a permission issue:
When you run CMake GUI, search for a variable named CMAKE_INSTALL_PREFIX. This is where final files will be installed. If this directory or any file in this directory needs administrative privileges, you will get this error.
Since in you case, this folder seems to be D:opencv-3.2.0buildinstall so you should not have this problem.
Check this SO answer. Solution suggested here is to close Visual Studio, delete build folder and follow the process again.
Few people have reported that changing CMAKE_INSTALL_PREFIX to a writable folder in C: solved there problem. e.g. here
Do we need CUDA to be installed in the system before we even start installing OpenCV?
Thanks for getting back to me. After a bit of research it appears to be an issue with the cuda libraries I am trying to get included. I just put a new system together with dual GeForce 1080 GPU cards – pretty fun stuff! I was hoping to gain some experience implementing some GPU firepower. It appears that the libraries have not yet been updated to be compatible with VS2017 which I just installed as well. It might work with a VS2015 c++ compiler which I am currently trying to figure out how to implement.
Thanks, Alex. CUDA libraries are problematic on a Mac as well. The latest version of CUDA is not compatible with the latest version of XCode yet.
Dual 1080 cards. That’s a pretty solid machine to train/run neural networks 🙂
To use VS 2015 instead of VS 2017, you have to make changes in Step 1, 5.1 and 6.1
Step 1. Install VS 2015
Step 5.1 Select ‘VS 14 2015 Win64’ in drop down
Step 6.1 Open project in VS 2015
Rest of the steps would be same.
I followed the settings described for python3 in step 5.3, but BUILD_opencv_python3 did not appear in the list. https://uploads.disquscdn.com/images/26e57cc73a8c9c004ef979420c80b58d4b1957247e0a200b088724478075caab.png https://uploads.disquscdn.com/images/99f2b6d9165b76c5c7e4070aba0a23c1c342fb726da6442ae03bc244c3da3f9e.png
Did you click configure again after providing paths for Python 3?
In second screenshot, see the log in lower panel. Python3 paths are not updated.
Yes, I did. But even after configure, cmake just updated Python2. Cmake does not seems to recognize the directories of python3. https://uploads.disquscdn.com/images/905176e89765e739f895387e84327d80d80b30cbbe64287a619a2c3325e31f4b.png
I did all steps again, and now everything is ok. Thanks
Excellent article!
2 little comments from me:
1. After setting the environment variables / PATH, it seems to me that I can to restart the PC to make it effective before going to the next step (I am not sure whether re-login will help).
2. While the library path, include files etc are to be common for all projects that use opencv, may be it is good to put them in a property sheet file.
Sorry for being too picky but I just want to see if my contribution will make the article even better. I really appreciate the effort from you (and your team). Looking forward to attending the Computer Vision for Faces course!!
Tak, Thank you for the feedback. 🙂
1. I think you don’t have to restart Windows after setting PATH and just restarting Visual Studio should work. But I’m not sure about it. So I’ll add this as a note to article.
2. That’s a great suggestion actually. But I didn’t want to overwhelm beginners so I skipped that part.
Coming from a Linux environment(GCC toolchain) I find VS overwhelming too 😉 I think another blog post describing project management in VS will be useful.
Hi Tak,
Regarding your 1st concern, I re-logined and it worked.
Cheers:)
I am having thiss problem:
I have a windows clean install. And I have just installed visual studio 2017 with desktop development c++. When I try to configure make I get the following error:
“fatal error C1083: Cannot open include file: ‘unistd.h’: No such file or directory”
This is very strange. If you are selecting “Visual Studio” as a generator in Step 5.1, it should not look for unistd.h.
Let’s do this.
1. Delete build directory
2. Configure using CMake again
Let us know if you still get the same error.
I have already deleted build directory twice. Also I tried with visual studio 2013 and the error is the same. In Cmake I selected visual studio from the list.
Perhaps by reinstalling Cmake?
I am not really sure what’s going wrong. unistd.h is a file present only in Unix distributions. Running CMake using VS as generator should not look for unistd.h.
There is one issue on OpenCV’s github repo where someone else is having the exact same problem with VS 2013.
Which VS are you using? I have tested this with VS 2015 and VS 2017.
Can you send me the log/files generated by CMake. Clean build directory and configure using CMake again. Zip build directory, upload it somewhere (dropbox, google drive etc) and give me the link to download.
I tested on VS 2017 and VS 2013 and it was the same, So I changed cmake: from 3.8.0 version to 3.8.2 and the problem was solved. I could generate the VS project and build it. Thanks a lot with your help.
I am facing the same error with cmaeke 3.9.0-rc3
The installation was ok. I did a test with python 2 and was ok, but with python 3 there was an error:
PS E:EstudosCursoOpenCVProjectsRedEyeRemoverRedEyeRemover> python .removeRedEyes.py
Traceback (most recent call last):
File “.removeRedEyes.py”, line 70, in
np.copyto(eyeOut, mean, where=mask)
TypeError: Cannot cast scalar from dtype(‘float64’) to dtype(‘uint8’) according to the rule ‘same_kind’
Python 3 is my default.
PS E:EstudosCursoOpenCVProjectsRedEyeRemoverRedEyeRemover> python
Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>
We fixed this error earlier. It seems the download file doesn’t have updated code.
Replace line
np.copyto(eyeOut, mean, where=mask)
witheyeOut = np.where(mask, mean, eyeOut)
Ok. Thanks.
I got a erorr after gen config . how fix it
CMake Error at cmake/OpenCVUtils.cmake:926 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target “opencv_core”. All uses of target_link_libraries with a target
must be either all-keyword or all-plain.
The uses of the keyword signature are here:
* cmake/OpenCVUtils.cmake:926 (target_link_libraries)
Call Stack (most recent call first):
modules/core/CMakeLists.txt:38 (ocv_target_link_libraries)
I’m sorry but I haven’t encountered this error earlier. So I’m not really sure what’s the problem here. What CMake version are you using? Try CMake v3.8.2 This may help solving the issue.
referring to https://learnopencv.com/install-dlib-on-ubuntu/ , as VS2017 cannot be used to compile dlib example, I would suggest to review this article. In particular, the installation “Desktop Development with C++” is only available in VS2017. Besides, the screenshot taken for installing VS is also taken from VS2017.
I have put a note in the article for Dlib users. This is sad that VS 2017 has a bug and gets stuck while compiling dnn modules in Dlib. I’ll update the screenshots too later.
Satya, It is really that hard? A few months ago I Installed OpenCv 2.4.9 on Windows 7. Beyond the installation of OpenCV, I only had to configure 3 parameters of my project properties (Visual Studio 2012).
It’s absolutely true that once you install OpenCV, you just have to configure couple of parameters in project properties. This tutorial mainly deals with compiling OpenCV from source. Why do we want to do that? Because OpenCV team split OpenCV3 into 2 parts: opencv(core library) and opencv_contrib(community contributed modules) unlike OpenCV2 which had everything as one project.
Now OpenCV installer(pre-compiled binary) for Windows is shipped with only core library. So if you want opencv_contrib modules too, you have to compile from source.
Vaibhaw, thanks for your detailed explanation. I wasn’t aware of that.
hello, excellent stuff here!
It ran smoothly till part 8, when I tried to open cv2 on python (I am running the 2.7.13 version). When I try to import cv2, an error pops up
“DLL load failed : %1 is not a valid Win32 application” . I tried reinstalling Anaconda and rebuilding the Cmake files, but no success, any thoughts on this matter?
In this tutorial we are building Python library in Win64 mode. I’m wondering why does it say “not a valid Win32 application”. There are few things that you need to cross-check. Did you install 32-bit Anaconda? Did you select mode as x64 in Visual Studio before building the project?
Thanks for the reply!
Yeah, I double checked my anaconda version and my visual studio builds the debug and release in x64. I looked up some stackexchange forums, actually win32 on the python command prompt means “windows version” not if it is 32 or 64 bit /:
Oh and I am running on win 10, visual studio 2015.
As per this StackOverflow answer, if your OS is 32-bit you should install 32-bit applications. It may help solving the issue.
My Os is 64 bits I checked it. Take a look at this post:
https://stackoverflow.com/questions/28526062/does-64-bit-anaconda-on-win32-uses-32-bit-or-64-bit
Got the following error: OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file ~opencv-3.2.0/modules/core/src/matrix.cpp, line 522 terminate called after throwing an instance of 'cv::Exception' what(): ~/opencv-3.2.0/modules/core/src/matrix.cpp:522: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
As it happens, something wrong may be happening in terms of matrix operations. I've shortened the code for only displaying an image and it worked. 🙂
Another thing that happened to me: I had to move lib files from HOME_PATH/build/lib/Debug and HOME_PATH/build/lib/Release to HOME_PATH/build/install/x64/vc14/lib.
My lib files were:
opencv_calib3d320.lib
opencv_calib3d320d.lib
opencv_core320.lib
opencv_core320d.lib
opencv_cudev320d.lib
opencv_features2d320.lib
opencv_features2d320d.lib
opencv_flann320.lib
opencv_flann320d.lib
opencv_highgui320.lib
opencv_highgui320d.lib
opencv_imgcodecs320.lib
opencv_imgcodecs320d.lib
opencv_imgproc320.lib
opencv_imgproc320d.lib
opencv_ml320.lib
opencv_ml320d.lib
opencv_objdetect320.lib
opencv_objdetect320d.lib
opencv_photo320.lib
opencv_photo320d.lib
opencv_python3.lib
opencv_shape320.lib
opencv_shape320d.lib
opencv_stitching320.lib
opencv_stitching320d.lib
opencv_superres320.lib
opencv_superres320d.lib
opencv_ts320.lib
opencv_ts320d.lib
opencv_video320.lib
opencv_video320d.lib
opencv_videoio320.lib
opencv_videoio320d.lib
opencv_videostab320.lib
opencv_videostab320d.lib
Hi Jose, I also have similar error msg (OpenCV Error: Assertion failed) while using the stitching API in opencv. The same code has no issue using pre-built library from opencv website, any update from your sidea? Cheers Dean
The c++ code is broken in the line that eyesCascade.detectMultiScale( img, eyes, 1.3, 4, 0 |CASCADE_SCALE_IMAGE, Size(100, 100) );
Always returns exception in Assertion failed. f
Thank you for the post and it worked
Glad it worked for you!
Thanks a lot for the article it helped me install openCv and python successfully and programme ran well. I have a facial landmark detection.py code how do you add a .py file in visual studio? Also how to make dlib work in visual studio 2015 for the .py file.
Thank you so much for this post, only had a couple of issues in configuring which was fixed by removing the modules creating errors :). Just a couple of questions using vs 2017,1. Do you have to input the lib files and connect the dependency path every time you create a new project? 2. With building for release I assume its the same except add the .lib’s without the d’s?
Thanks a lot for the article but I have some problem:
if I use VS2012, OpenCV2.4.11 and dlib with facial landmarks C++ code, it’s worked, but the speed is very slow! Is it the VS or OpenCV version too old so the execution time is high? Thanks!
Please check out this post for speeding up dlib
https://learnopencv.com/speeding-up-dlib-facial-landmark-detector/
Thanks for the detailed description. I installed VS 2017 with opencv 3.3.0 along with Cmake 3.8.2. Then I followed all steps to get run the RedEyeRemover.ccp. I added library as 330d.lib. However, when I build RedEyeRemover.ccp, I will get this error:
1>—— Build started: Project: RedEyeRemover, Configuration: Debug x64 ——
1>RedEyeRemover.cpp
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(11): error C2871: ‘cv’: a namespace with this name does not exist
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(14): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(14): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(14): error C2182: ‘fillHoles’: illegal use of type ‘void’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(15): error C2448: ‘fillHoles’: function-style initializer appears to be a function definition
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(32): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(32): error C2146: syntax error: missing ‘;’ before identifier ‘img’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(32): error C2065: ‘img’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(32): error C2065: ‘CV_LOAD_IMAGE_COLOR’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(32): error C3861: ‘imread’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): error C2146: syntax error: missing ‘;’ before identifier ‘imgOut’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): error C2065: ‘imgOut’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): error C2065: ‘img’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): error C2228: left of ‘.clone’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(35): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(38): error C2065: ‘CascadeClassifier’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(38): error C2146: syntax error: missing ‘;’ before identifier ‘eyesCascade’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(38): error C3861: ‘eyesCascade’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(41): error C2039: ‘vector’: is not a member of ‘std’
1>c:userskayassourcereposredeyeremoverredeyeremoverpredefined c++ types (compiler internal)(209): note: see declaration of ‘std’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(41): error C2065: ‘vector’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(41): error C2065: ‘Rect’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(41): error C2065: ‘eyes’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C2065: ‘eyesCascade’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C2228: left of ‘.detectMultiScale’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C2065: ‘img’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C2065: ‘eyes’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C2065: ‘CASCADE_SCALE_IMAGE’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(42): error C3861: ‘Size’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(46): error C2065: ‘eyes’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(46): error C2228: left of ‘.size’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(46): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(50): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(50): error C2146: syntax error: missing ‘;’ before identifier ‘eye’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(50): error C2065: ‘eye’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(50): error C2065: ‘eyes’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(50): error C3861: ‘img’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(53): error C2065: ‘vector’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(53): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(53): error C3861: ‘bgr’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(54): error C2065: ‘eye’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(54): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(54): error C3861: ‘split’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(57): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(57): error C2146: syntax error: missing ‘;’ before identifier ‘mask’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(57): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(57): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(60): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(61): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(61): error C3861: ‘Mat’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(61): error C3861: ‘Point’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(61): error C3861: ‘dilate’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(68): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(68): error C2146: syntax error: missing ‘;’ before identifier ‘mean’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(68): error C2065: ‘mean’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(68): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(69): error C2065: ‘mean’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(69): error C2228: left of ‘.copyTo’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(69): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(69): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(69): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(70): error C2065: ‘mean’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(70): error C2228: left of ‘.copyTo’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(70): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(70): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(70): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(71): error C2065: ‘mean’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(71): error C2228: left of ‘.copyTo’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(71): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(71): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(71): error C2065: ‘mask’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(74): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(74): error C2146: syntax error: missing ‘;’ before identifier ‘eyeOut’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(74): error C2065: ‘eyeOut’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(75): error C2653: ‘cv’: is not a class or namespace name
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(75): error C2065: ‘bgr’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(75): error C2065: ‘eyeOut’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(75): error C3861: ‘merge’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(78): error C2065: ‘eyeOut’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(78): error C2228: left of ‘.copyTo’ must have class/struct/union
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(78): note: type is ‘unknown-type’
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(78): error C2065: ‘eyes’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(78): error C3861: ‘imgOut’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(83): error C2065: ‘img’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(83): error C3861: ‘imshow’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(84): error C2065: ‘imgOut’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(84): error C3861: ‘imshow’: identifier not found
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(85): error C3861: ‘waitKey’: identifier not found
1>Done building project “RedEyeRemover.vcxproj” — FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Would you please help me out how to fix this problem ?
Thanks for this informative and detailed article. I followed the same steps for VS 2017, OpenCV 3.3.0 and CMake 3.8.2. However, when I compile the “RedEyeRemover.ccp”, I got the following error:
1>—— Build started: Project: RedEyeRemover, Configuration: Debug x64 ——
1>RedEyeRemover.cpp
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(11): error C2871: ‘cv’: a namespace with this name does not exist
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(14): error C2065: ‘Mat’: undeclared identifier
1>c:userskayassourcereposredeyeremoverredeyeremoverredeyeremover.cpp(14): error C2065: ‘mask’: undeclared identifier
1>Done building project “RedEyeRemover.vcxproj” — FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
There are several similar errors, but I make it shorter to make it easier. Would you please help me out for this error ?
Much thanks!
Hi
This is a good article.
I need to use opencv with Visual Studio and CUDA. I try to include opencv_world in the project, but I run into lots of problems. First I had to manually add the Additional Include Directories to include ‘D:/opencv-3.2.0/opencv-3.2.0/build3/install/include’. it was a lot of *.hpp files that Visual Studio did not find during compiling.
when I managed to compile correctly, the linker does not work well. I got 8 link errors.
I use Cuda 8.0, Vis Stud 2015.
Is this a wrong combination? I have tried ‘all over internet’ to find someone who can compile OpenCV so it works with Visual Studio and Cuda. Still every place Google finds, reports that it does not work.
Any suggestion to a solution would be appreciated.
I am facing the following problem when compiling redeyeremover:
1>—— Build started: Project: RedEyeRemover, Configuration: Debug x64 ——
1>RedEyeRemover.cpp
1>c:usersraphaelsourcereposredeyeremoverredeyeremoverredeyeremover.cpp(87): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add ‘#include “stdafx.h”‘ to your source?
1>Done building project “RedEyeRemover.vcxproj” — FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What might be wrong ?
After step 6 I dont find the x64 folder even after building it from source. Any points on what I am missing here ??
I have attached screen shots, I don’t have any errors when I built it from source for both debug and release versions.
https://uploads.disquscdn.com/images/803f8d51a1517498832192bde5b940f73e0b4be59a0cf3682af0b55dce491831.png https://uploads.disquscdn.com/images/d60fb58cb738f42ec03e28afb4401f9c304b6f72b0d2c2311eafe5cd4392ccd4.png
I had to choose Visual Studio 15 2017 Win64 for cmake, as my system only has a visual studio15 2017
@vaibhawsinghchandel:disqus hey can you help me with this, I have tried in various configurations, I am not able to build the binaries properly.
I followed the same instructions to install 3.3 on VS2017, however I ended up with different error, for which I am not able to identify the cause. https://uploads.disquscdn.com/images/c34901be75503ee14021ef482ac59c725461f9ca1b9869a067223bfb6dea4880.png
Worth emphasising – looking at the many installation tutorials, it took me 2 days to figure this out – that using VS2015 with the latest OpenCV, you can skip the entire Cmake process and simply link to the opencv_worldXXX.lib.
Could you elaborate on this?
The article implies that you need to compile OpenCV (using Cmake) before being able to use it. This it not the case – you can skip all this, and simply use the pre-compiled libraries that come with OpenCV. In your new VS project you only need to include the header files, link to the lib libraries, and of course make sure the dll libraries accessible run-time. All these files come out-of-the-box with OpenCV.
This also works for the contrib extra modules? Just adding the paths in the C++ and linker configurations of Visual Studio?
Hi! I followed this tutorial to the dot. However, I dont happen to have the opencv_worldxxx.lib file on my computer. It is required for many purposes and I simply dont have it. Any fix for this?
Thanks!
Anyone get to the bottom of where to find the opencv_worldXXX.lib file?
I am facing the problem when I am trying to configure CMake.
can you help me on this problem 🙁
when I am trying to configure the Cmake then I am getting the attached error.can any one help me on this??
Thanks in Advance!!
https://uploads.disquscdn.com/images/59e93debff209cebe908757ef2f90a1025ea1b8dfee31101747116d9fd730214.jpg
Hi Deepak,
Did you get the solution for this error?
This is a network issue. Check the red error message in console. Are you behind proxy? If yes, this won’t work. You will have to find a network where you are not behind proxy.
Thanks for the article. I am encountering lots of issues following the above installation.
I am new to OpenCV and the two programming languages.
I am kind of stuck at Step 7.5 and asking to copy all the lib that you mentioned have been generated. I have installed 3.3 instead of 3.2 and I do not see any such lib bgsegm320d.lib.
Where can I find all the lib as mentioned by you? I think I couldn’t compile because there are files
that cannot be found.
I would appreciate your reply.
When I attempt to run the redeyremover program, it says it ‘The code execution cannot proceed because opencv_imgcodecs330d.dll was not found. reinstalling the program may fix this problem.
Even though I have all the files in the folder as lib, it does this for others including core, highgui, and imgproc
I had the same problem and aparently restarting visual studio worked.
Was facing the same problem today. The dll-Files couldn’t be located.
Actually the dll-Files will be included with Step 7 of the tutorial when editing
the ‘Path’-Variable under System Variables.
In my case the problem was solved by also adding the path of the bin-Folder
to the ‘Path’-Variable under User Variables.
@Satya Mallick:
Thx for this very helpful tutorial!
Can you please tell me which ‘bin’ folder?
The c++ code is broken in the line that eyesCascade.detectMultiScale( img, eyes, 1.3, 4, 0 |CASCADE_SCALE_IMAGE, Size(100, 100) );
Always returns exception in Assertion failed.
Do you have the cascade file in path?
What do you mean by cascade file in path?
i think cascade is the file extension that end with .xml
Hi Satya,
first of all, thanks for this great tutorial!
Currently, I am struggling with the installation of openCV3.3.1 with the extra modules on Windows and using Python 3.5 in Anaconda. I follwed your detailed instructions and build the project using the current version of CMake 3.10.0 and Visual Studio 2017.
The build was successful for both debug and release, but for some strange reason no python files were generated at all (not in the install folder nor in the Anaconda package folders) – so, the test script importing cv2 failed. What could be the reason for this strange behaviour? Again, I followed your instructions on setting the Python3 pathes in CMake and for Anaconda, I updated the index of available packages – no entries or files here.
Did someone have a similar problem before?
Thanks for your help!
Johannes
Faced similar issue… copied cv2….pyd to AnacondaLibsite-packagescv2 and import issue was resolved, but if i trye to access cv2 using something like cv2.__version__, I get this error: “AttributeError: module ‘cv2’ has no attribute ‘__version__'”
Me too!
I have openCV3.4.2 with the extra modules on Windows 10, and using Python 3.5 in Anaconda. I follewed your steps exactly, but after I provided python3 paths and push the “configure” button again, the BUILD_opencv_python3 entry still didn’t show. Could you please have a look at this? Thanks!
Thank you for your sharing, it is very detailed. As a rookie, I learned a lot. But I have a problem in step 6.3, There are some errors shown as follows: https://uploads.disquscdn.com/images/7e0dae71ea27ca47bcc5e494479b01e329b01648ab8580a79ca3bb7b7b8f3d9e.png
How can I fix the problem? Thanks a lot
Excellent tutorial and easy to follow.
https://uploads.disquscdn.com/images/02473963ed011e9b8ed897ae0f86f061de4763fef17fc6a6a286c0300e92bd1d.png hi, i have have an error when try to compile in release and debug
Hello,
Thank you so much for great detailed instruction.
I’ve unziped RedEyeRemover and I don’t have CMakeLists.txt in it and I’m getting this error msg.
“C:UsersmartiDocumentsRedEyeRemoverbuild>cmake -G “Visual Studio 14 2015 Win64” ..
CMake Error: The source directory “C:/Users/marti/Documents/RedEyeRemover” does not appear to contain CMakeLists.txt.
Specify –help for usage, or press the help button on the CMake GUI.”
I’m new to OpenCV and help is appreciated.
Thank you,
Martin
You will not have CMakeLists.txt after unzipping. Instead, You should create a file naming “CMakeLists.txt” and Paste the following code in that file:
cmake_minimum_required(VERSION 2.8)
project( redEyeRemover )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( removeRedEyes removeRedEyes.cpp )
target_link_libraries( removeRedEyes ${OpenCV_LIBS} )
Thank you and pardon me!
I missed very first part of “Step 8” that stated clearly so.
I didn’t miss any steps yet I am getting the same error.
It says “CMake Error: The source directory “D:/noders/RedEyeRemover” does not appear to contain CMakeLists.txt.” .
Yet it is there. Just as specified.
Never mind. It was just a spelling mistake. Thanks anyway.
Build was successful.
But after this, who knows, where the library for the python was supposed to be.
And what enviroment variable should be set in Windows? Only OPENCV_PATH?
Should we also check OPENCV_FORCE_PYTHON_LIBS in CMake? What difference does it make if we uncheck and proceed?
Hello,
I am using VS 2017, but while configuring Cmake file. I got the below error.
could anyone solve this?
Thank you https://uploads.disquscdn.com/images/078e100556514477d5225ccaac8ddf36f31be3719221e2921669329dd02d89fe.png
I have error in step 8.
https://uploads.disquscdn.com/images/a67a94c287e3f22986ecfe9a5a1a728b1f59ca0c6e9f52f805f9c7fabcadb179.png
I finded solution. I should be to moved all files (haarcascade_eye.xml, red_eyes.jpg, red_eyes2.jpg) in Release folder.
I am unable to perform step 6 as i get error
Plz hep me i am getting this error at step 6 https://uploads.disquscdn.com/images/3475d282f1298c3cc6df433d18e05d388703250830fe21b13cd52db21bf9c646.jpg
https://uploads.disquscdn.com/images/0c9ea1e4f92615c268b5c62dcede3cec61716d2fcc65e457791a44049315da34.png
Guys, i met this error and when i google for the error most of the solution is for Ubuntu. How can i solve this issue?
Hey.
I tried to build the python package for OpenCV. All the steps from above were successful, but I can’t import the cv2 module. “Import Error: DLL Load failed”
I use Python 3.6.3 with Anaconda. Does anyone else have similar problems?
did you add this path to your Environment Variables ?
_the_OPENCV_folder_buildinstallx64vc15bin
I have the same issue even after adding the path.
Now it works also with VS2017 and Opencv 3.4.0
CMake Error at cmake/OpenCVModule.cmake:278 (message):
The directory D:/5.Tools/Develop/AI/OpenCV/tools/opencv-3.3.1/modules is
observed for OpenCV modules second time.
Call Stack (most recent call first):
modules/CMakeLists.txt:7 (ocv_glob_modules)
i got above error, need help!!!
When you choose the path for the extra_modules, you need to select the path to opencv_contrib-3.3.1/modules not to opencv-3.3.1/modules !! I hope this helps anyone facing the same problem coz it took me some time to figure it out. I suggest you delete all the files and start all over to avoid any problem.
For me it works fine, I didn`t installed CMake. Instead I followed instructions from this video: https://youtu.be/M-VHaLHC4XI
I simply added .cpp file to my solution, also de xml file and the 2 photos and worked perfectly fine.
But why don`t you explain the code of red eye remover, what the library contains, how it’s used… Thanx
https://uploads.disquscdn.com/images/309fc9100436a609ab0ea2f9d2058d704069d8b84c5d4e3ca623d2699e6e1865.jpg
Hi, I get this problem while rebuilding opencv.
Configuring incomplete when It build with extra modules from opencv_contrib.
And without extra modules, it works well.
I also try with older versions but they got the same problem
Can you help me with this problem, I am trying to using tensorflow with C++ and opencv.
Thank you
You should only use forward slashes in CMake. Best is not to copy paste the link, but to browse for the directory with the little button on the right of the entry for the OPENCV_EXTRA_MODULES_PATH property
Thanks for writing this tutorial. I’m currently trying to install with Anaconda3 on a Windows 10 system with CUDA 9.1 support. I successfully ran cmake with VS2015 as the generator, but when I run Python I’m still unable to import cv2. At first I thought this was just a path problem, so I made sure to add all the path variables you mention. This did not fix the issue, however. Upon further investigation, I found the line “Python Libraries: NO” in the output of cmake. I only have Python3 on this system. Even so, I tried your step 5.2 and re-configured, re-generated, and re-compiled, only to find the same problem again. Clearly there’s something I’m missing here, right?
Any thoughts?
I am getting error while compiling in debug mode “LINK : fatal error LNK1104: cannot open file ‘python36_d.lib'”
Just to add that you don’t necessarily have to install VS2015 for this. You can specify tool-set v140 with Visual Studio 2017 in cmake toolset settings.
getting an error when i am trying to run removeRedEyes.exe
how do i get it to work??
You have to move it to the root folder where you have the image!
anyone can explain why ?? (i was followed the step, but showing like this) https://uploads.disquscdn.com/images/1b52f1d33ba6db6fdc0666bbedcd3683784f18f7fb463013128b0d9f58446155.jpg
i was followed step by step but error, maybe can explain to me why ?? https://uploads.disquscdn.com/images/1b52f1d33ba6db6fdc0666bbedcd3683784f18f7fb463013128b0d9f58446155.jpg
I am also facing same issue, did you get any solution for that?
Hi rifky muzaki,
i am able to solve this issue.
How :- Run Cmake as administrator.
Why :- while configuring cmake try to download some packages and if cmake is not run as administrator it will not have permission to download and keep files in C: drive path which we provided.
Thank you
Ashish
for make there is a flag -j that is used to quicken the build process . Is there a similar option for cmake ?
Step 6.1: Compile opencv in Release mode
Open Windows Command Prompt (cmd).
Go to OPENCV_PATH/build directory and run this command
cmake.exe –build . –config Release –target INSTALL
Got this…
… : fatal error LNK 1112: module type ‘x64’ conflicts with target machine type ‘x86’
My computer is …
System Type 64-bit Operating System, x64-based processor
How can I fix that?
Thanks.
Lennox https://uploads.disquscdn.com/images/844dfd415b6516fd2d62e435fb7b6a6dca072788b21c409f4f8a2268a6b2a2d5.png
Just want to share that I followed the process successfully using:
Visual Studio 2017
Cmake 3.11.1
OpenCV 3.4.1
Anaconda3 – 5.1.0
How do I work from within the Visual Studio 2017 IDE using the RedEyeRemover example ?
It works fine when building with cmake and running from the command prompt.
Getting the below error
INK : fatal error LNK1104: cannot open file ‘python36.lib’ [C:opencv-3.4.0opencv-3.4.0buildmodulespython3openc
v_python3.vcxproj]
when I try to compile opencv using
cmake.exe –build . –config Release –target INSTALL
I met a problem in step 5.1 and this is a quick solution:
– Replace ” by ‘/’ when you paste the link In flag “OPENCV_EXTRA_MODULES_PATH”
Hi,
– 3.4.1 is available
– OPENCV_PATHbuildinstallx64vc14bin isn’t available in 3.4.1. instead one should try OPENCV_PATHbuildCMakeFilesx64vc14bin
same goes to user variables.
Thanks fo rthe article. very useful.
Successfully installed with:
Visual Studio 2017
Cmake 3.11.4
OpenCV 3.4.2
Anaconda 5.2.0
https://uploads.disquscdn.com/images/c43742d864988419e929c8c06136d040c598572e0ac8b443abbe8b8e4560665b.png
Can someone help me with this error? Thanks in advance.
Can someone please help me? I have “Error in configuration process, project files may be invalid” just a few seconds after hitting the Configure button. I also have in CMakeError.log, “LINK : fatal error LNK1158: cannot run ‘rc.exe'” https://uploads.disquscdn.com/images/35cc4547e795d548370f8dbbf0dc20666ddf75c5d6d39e83687a5e8c76017538.png
I’m on Windows 10 with cmake 3.10.0, opencv-3.3.1 source code, and both Visual Studio 2017 and 2015.
Hi! It worked for me! Thank you! VS 2015 and OCV 3.4.2
didn’t work the first time because I checked “With Qt” (I want to use it).
However I have a remark, is that important? : while building your test code I have this:
“OpenCV STATIC: OFF”
Is that that I’ll always need to use dll?
import cv2
Traceback (most recent call last):
File “”, line 1, in
ImportError: DLL load failed: The specified module could not be found.
This is my python version:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Any idea what went wrong?
Very well written and articulated. Worked like a charm on my Windows10 flawlessly. And this is the first time ever that has happened. Kudos to Satya and Co. Keep up the good work!
All very well written tutorial.
https://uploads.disquscdn.com/images/bb28dc85ef87201e096e9f7341f5db812939379814ca7c889b990b9543769369.png
Unable to install. Appears error c2440 ‘=’ cannot convert from ‘const char *’ to ‘char *’
how do I include the library in Visual Studio?
https://uploads.disquscdn.com/images/dc5a1eba70aa9a1e28e5973c927027479600b517d1ea62f5e5ceff1f6a57248b.png
Getting error shown in the image while building in release mode ..
Hi,
I followed the tutorial and encountered compilation errors related to the HDF module. More likely some libraries were missing. Anyway I skipped that part and the rest of the tasks executed successfully BUT for some reason the cv2 python package was not generated. I do not understand why this happened but is there any way to build or download it?
for some reason, when i downloaded anaconda, the whole building process did not work ( it gave me link errors in cmd). Instead i followed the steps in (https://docs.python.org/3/using/windows.html) to download python and was able to build it without any errors.
import cv2
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘cv2’
help me !!!!!!